A method and system for automatically feeding and monitoring rats
Patent Information
- Application Number
- CN202610440066.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-03
- Publication Date
- 2026-08-21
AI Technical Summary
[0005]本发明提供一种对大鼠自动饲喂辅助监测方法与系统,解决相关技术中群养环境下因个体社会等级差异导致饲料摄入不均、无法根据个体竞争行为动态修正投喂量的技术问题
[0016]This invention continuously tracks the dynamic changes in the social hierarchy of a group using a temporal graph neural network and outputs a social hierarchy score. Based on a linear regression mapping between the social hierarchy score and historical feeding-actual intake deviation data, a competitive intake deviation coefficient is calculated, and the feeding amount is adjusted accordingly. This solves the technical problem of feeding decision bias caused by equating feeding amount with actual intake in existing methods, achieving a quantitative compensation for the systematic deviation between feeding amount and actual intake in a group-housed competitive environment. Furthermore, by detecting the magnitude and direction of changes in the temporal-aware embedded vector at adjacent time steps to identify hierarchy exchange events, and resetting the deviation mapping parameters and refitting the mapping relationship when a hierarchy exchange event is detected, this invention solves the technical problem of continuous accumulation of deviation under dynamic changes in social hierarchy with fixed compensation methods, achieving the technical effect of updating the deviation mapping parameters based on new data after hierarchy reorganization. Finally, by adjusting the weight configuration of the multi-objective reward function based on experimental stage labels and using a conditional deep Q-network to modulate the feature representation with stage encoding as a condition, this invention solves the technical problem that a single fixed reward structure cannot cope with the differentiated control needs of multiple stages, achieving the technical effect of automatically adjusting the multi-objective constraint weights when switching experimental stages.
Smart Images

Figure CN122603773A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automated management technology for laboratory animals, and more specifically, to a method and system for automated feeding and monitoring of rats. Background Technology
[0002] In long-term group-housed rat experiments, an automated feeding system delivers feed to each target individual according to a preset plan. An auxiliary monitoring module simultaneously collects data on individual weight, feeding behavior, and activity patterns to assess feeding effectiveness and adjust feeding strategies. Multiple rats share a feeding area, and different experimental stages correspond to different weight control targets and allowable fluctuation ranges. The automated feeding system needs to adjust feeding parameters according to the stage transition.
[0003] Existing automated feeding monitoring methods assume that the amount of feed given is approximately equal to the actual intake of the target individual, and use this as a basis for evaluating feeding effectiveness and adjusting strategies.
[0004] However, in group rearing environments, social hierarchy competition exists. Dominant individuals seize feed, leading to actual intake exceeding the feeding amount, while weaker individuals are forced to yield, resulting in actual intake significantly lower than the feeding amount. A systematic bias exists between the feeding amount and actual intake. More importantly, the social hierarchy among rats dynamically evolves with individual maturity and health status. After a hierarchy reshuffling event, the competitive landscape changes, the original bias patterns become ineffective, and fixed monitoring and compensation methods cannot adapt to the new competitive state. This causes the feeding decisions of the automated feeding system to continuously deviate from actual needs, leading to a decrease in the accuracy of individual weight control. Simultaneously, conflicts exist between multi-objective constraints at different experimental stages. Strategy optimization with a single fixed reward structure cannot automatically adjust objective weights during stage transitions, resulting in the inability to meet the differentiated control requirements across multiple stages. Summary of the Invention
[0005] This invention provides an automatic feeding auxiliary monitoring method and system for rats, solving the technical problems in related technologies where uneven feed intake is caused by differences in individual social hierarchy in group rearing environments, and the inability to dynamically adjust the feeding amount based on individual competitive behavior.
[0006] This invention discloses an automated feeding-assisted monitoring method for rats, comprising the following steps: acquiring individual state characteristics and pairwise interaction characteristics of each target rat in a group-housed cage, as well as the target weight value, allowable fluctuation range, and feed budget constraint parameters corresponding to the label of the current experimental stage; constructing a social relationship graph sequence based on the pairwise interaction characteristics according to a fixed time window, inputting the social relationship graph sequence into a time-series graph neural network, and outputting the time-series perceptual embedding vector and social rank score of each individual; based on the social rank score and historical feeding-actual intake deviation data, using linear regression to fit the deviation mapping relationship between the social rank score and the intake deviation, and calculating the individual's... The competitive intake deviation coefficient of the organism; based on the competitive intake deviation coefficient, the competitive deviation correction is performed on the candidate feeding amount of each organism, the corrected candidate feeding action is constrained and screened, an automatic feeding instruction is generated and output to the feeding device for execution; wherein, the temporal graph neural network consists of a graph attention message passing layer and a gated recurrent unit. The graph attention message passing layer calculates the attention weight between the individual and the neighboring nodes on the social relationship graph snapshot at each time step and weighted aggregates the neighbor features to generate a graph embedding representation. The gated recurrent unit fuses the graph embedding representation of the current time step with the hidden state of the previous time step to generate the temporal-aware embedding vector.
[0007] Furthermore, the graph attention message passing layer calculates the attention weights between an individual and its neighboring nodes and weights and aggregates neighboring features to generate a graph embedding representation. This includes: for an individual at the current time step, mapping the individual's node input features and the node input features of each neighboring node to the hidden space using a learnable linear transformation matrix; concatenating the mapped features of the individual and each neighboring node and their corresponding edge weights; compressing the data into a scalar using the attention parameter vector; activating the data using LeakyReLU and taking the exponent; and then normalizing all neighboring nodes of the individual to obtain the attention weights between the individual and each neighboring node; summing the linearly transformed features of each neighboring node according to the attention weights; and generating the graph embedding representation of the individual at the current time step after processing with an activation function. The edge weights are a comprehensive measure of the pairwise interaction features between corresponding individual pairs. The social rank score is obtained by linearly compressing the temporal-aware embedding vector of each individual into a scalar using a learnable weight vector and then mapping it to an open interval of zero to one using the Sigmoid function. A higher score indicates a higher social rank for the individual within the group.
[0008] Furthermore, the individual state characteristics include current weight data, the moving average of daily food intake and the rate of change of food intake, as well as the cumulative value of movement distance and the duration of stay in the feeding area within a preset time period; the pairwise interaction characteristics include the co-occurrence frequency, displacement retreat frequency, and the ratio of the duration each rat occupies when both are in the feeding area; the comprehensive metric of the pairwise interaction characteristics is obtained by weighted summation of the co-occurrence frequency, displacement retreat frequency, and duration ratio after Z-score standardization; in constructing the social relationship graph sequence, each target rat is a graph node, the characteristics of each node are the individual state characteristics after standardization, and the edge weight between any two nodes is the comprehensive metric of the corresponding pairwise interaction characteristics.
[0009] Furthermore, the step of fitting the deviation mapping relationship between social rank scores and intake deviation using linear regression to calculate the competitive intake deviation coefficient for each individual includes: using the social rank score sequence of each individual over a historical time period as input features, using the corresponding deviation ratio as the regression target, and solving the deviation mapping parameters using the mean squared error loss function and the least squares method; substituting the social rank scores of each individual at the current time step into the deviation mapping parameters to obtain the competitive intake deviation coefficient for each individual; wherein, the deviation ratio is the signed ratio obtained by dividing the difference between the actual intake and the feeding amount of each individual by the feeding amount; a positive competitive intake deviation coefficient indicates that the individual's actual intake is greater than the feeding amount, and a negative value indicates that the individual's actual intake is less than the feeding amount.
[0010] Furthermore, the competitive intake deviation correction for each individual's candidate feeding amount based on the competitive intake deviation coefficient includes: the corrected candidate feeding amount for each individual is equal to the individual's original candidate feeding amount divided by the sum of the competitive intake deviation coefficients for that individual; wherein, the original candidate feeding amount is calculated by using the difference between the individual's current weight and the target weight value as the weight deviation, proportionally converting it into the required intake increase or decrease, and combining it with the individual's historical average daily food intake benchmark and superimposing the deviation compensation amount; the competitive intake deviation coefficient is constrained to a value greater than negative one.
[0011] Furthermore, the method includes the step of detecting social rank exchange events and triggering a deviation mapping reset: For each individual, the difference vector between the time-aware embedding vectors of adjacent time steps is calculated, and the L2 norm of the difference vector is used as the magnitude of change, and the direction of the difference vector is used as the direction of change, which are combined into a social position change index; a hierarchical clustering algorithm is used to cluster the social position change index of each individual, and individual pairs whose magnitude of change exceeds a preset change threshold and whose cosine similarity between the difference vectors of the two individuals is less than a preset negative threshold are identified, and the individual pairs that meet the conditions are marked as rank exchange events; when a rank exchange event is detected, the deviation mapping parameters of the deviation mapping relationship are reset, the historical feeding-actual intake deviation data before the rank exchange event is cleared, and linear regression fitting is re-executed based on the newly collected monitoring data after the rank exchange event, and the competitive intake deviation coefficient of each individual is updated.
[0012] Furthermore, the method also includes the step of constructing a multi-objective reward function based on experimental stage parameters: the immediate reward of the multi-objective reward function is equal to the current stage weight deviation weight multiplied by the negative sum of the squares of the relative deviations of each body weight from the target weight value, minus the current stage fluctuation penalty weight multiplied by the sum of the absolute values of each body weight deviation exceeding the allowable fluctuation range, and then minus the current stage cost penalty weight multiplied by the total feed consumption at the current time step; wherein, the weight deviation weight, fluctuation penalty weight, and cost penalty weight are all non-negative real numbers, pre-configured according to the experimental stage, and the weight value corresponding to the new stage is automatically read when the experimental stage label is switched; before being substituted into the calculation of the multi-objective reward function, the excess weight deviation and total feed consumption in the fluctuation penalty item are respectively processed by Z-score standardization.
[0013] Furthermore, the method includes a step of generating a feeding strategy using a conditional deep Q-network: The body weight data, feeding trend data, activity level data, deviation from the target body weight, the experimental phase one-hot encoded vector, and the competitive intake deviation coefficient of each individual are concatenated into an enhanced state vector, which is then input into the conditional deep Q-network to output the Q-values corresponding to each candidate feeding action. The conditional deep Q-network consists of a state encoding layer, a phase conditional modulation layer, and an action Q-value output layer. The state encoding layer is a fully connected neural network that receives the enhanced state vector and outputs a feature representation. The phase conditional modulation layer receives the experimental phase encoding, generates scaling and offset parameters, and performs element-wise scaling and translation on the feature representation to obtain a modulated feature vector. The action Q-value output layer is a fully connected neural network that receives the modulated feature vector and outputs the Q-values corresponding to each candidate feeding action. The candidate feeding action with the highest Q-value that satisfies the feed budget constraint parameters and the allowable fluctuation range is selected as the automatic feeding instruction.
[0014] Furthermore, the method includes a step of updating the parameters of the conditional deep Q-network based on execution feedback: after executing the automatic feeding command, new weight data and feeding monitoring data of each individual are collected, and the immediate reward is calculated using the multi-objective reward function. The enhanced state vector of the current time step, the executed feeding action, the immediate reward, and the enhanced state vector of the next time step are combined to form state transition data and stored in the experience replay buffer. The learnable parameters of the conditional deep Q-network are updated by randomly sampling the state transition data from the experience replay buffer. When a rank exchange event is detected, the random exploration probability during action selection is increased within a preset exploration period after the rank exchange event occurs. After the preset exploration period ends, the random exploration probability returns to the normal level. The length of the preset exploration period is determined based on the minimum amount of data required for refitting the deviation mapping parameters.
[0015] This invention provides an automated feeding auxiliary monitoring system for rats, comprising: a data acquisition module for acquiring individual state characteristics and pairwise interaction characteristics of each target rat in a group-housed cage, as well as the target weight value, allowable fluctuation range, and feed budget constraint parameters corresponding to the label of the current experimental stage; a temporal graph neural network module for constructing a social relationship graph sequence based on the pairwise interaction characteristics at fixed time windows, and outputting the temporal perception embedding vector and social rank score of each individual through a graph attention message passing layer and a gated loop unit; a deviation mapping module for calculating the competitive intake deviation coefficient of each individual by fitting the deviation mapping relationship using linear regression based on the social rank score and historical feeding-actual intake deviation data; and a feeding instruction generation module for correcting the competitive deviation of candidate feeding amounts for each individual based on the competitive intake deviation coefficient, constraining and screening the corrected candidate feeding actions, generating an automated feeding instruction, and outputting it to the feeding device for execution.
[0016] This invention continuously tracks the dynamic changes in the social hierarchy of a group using a temporal graph neural network and outputs a social hierarchy score. Based on a linear regression mapping between the social hierarchy score and historical feeding-actual intake deviation data, a competitive intake deviation coefficient is calculated, and the feeding amount is adjusted accordingly. This solves the technical problem of feeding decision bias caused by equating feeding amount with actual intake in existing methods, achieving a quantitative compensation for the systematic deviation between feeding amount and actual intake in a group-housed competitive environment. Furthermore, by detecting the magnitude and direction of changes in the temporal-aware embedded vector at adjacent time steps to identify hierarchy exchange events, and resetting the deviation mapping parameters and refitting the mapping relationship when a hierarchy exchange event is detected, this invention solves the technical problem of continuous accumulation of deviation under dynamic changes in social hierarchy with fixed compensation methods, achieving the technical effect of updating the deviation mapping parameters based on new data after hierarchy reorganization. Finally, by adjusting the weight configuration of the multi-objective reward function based on experimental stage labels and using a conditional deep Q-network to modulate the feature representation with stage encoding as a condition, this invention solves the technical problem that a single fixed reward structure cannot cope with the differentiated control needs of multiple stages, achieving the technical effect of automatically adjusting the multi-objective constraint weights when switching experimental stages. Attached Figure Description
[0017] Figure 1 This is a flowchart of the automatic feeding and auxiliary monitoring method for rats provided in the embodiments of the present invention; Figure 2 This is a schematic diagram of the comparison between the current weight and target weight of each individual in the embodiments of the present invention (time step 7); Figure 3 This is a schematic diagram of the comparison of Z-score standardized features of each entity (time step 7) provided in the embodiment of the present invention; Figure 4 This is a schematic diagram of the social ranking scores (time step 7) of each individual provided in the embodiments of the present invention; Figure 5 This is a schematic diagram illustrating the linear regression relationship between social ranking score and competitive intake bias coefficient provided in an embodiment of the present invention; Figure 6 This is a schematic diagram comparing the original candidate feeding amount and the corrected feeding amount provided in an embodiment of the present invention; Figure 7 This is a schematic diagram of the Q-value evaluation results of candidate feeding actions (after constraint screening) provided in an embodiment of the present invention; Figure 8 This is a schematic diagram of the changes in body weight at each time step 7 to time step 8 provided in the embodiments of the present invention. Detailed Implementation
[0018] In long-term group-housed rat experiments, an automated feeding system delivers feed to each target individual according to a pre-set protocol. An auxiliary monitoring module simultaneously collects data on individual weight, feeding behavior, and activity patterns to assess feeding effectiveness and adjust feeding strategies. Multiple rats share a feeding area. The automated feeding system calculates the feed amount based on individual weight targets, while the auxiliary monitoring module records actual feeding and spatial interaction, forming a closed-loop control system for feeding execution and monitoring feedback. Different experimental phases correspond to different weight control targets and allowable fluctuation ranges, requiring the automated feeding system to adjust feeding parameters accordingly.
[0019] Existing automated feeding monitoring methods assume that the feed amount is approximately equal to the actual intake of the target individual, and use this assumption to evaluate feeding effectiveness and adjust strategies. However, in group rearing environments, social hierarchy competition exists. Dominant individuals seize feed, leading to actual intake exceeding the feed amount, while weaker individuals are forced to concede, resulting in actual intake significantly lower than the feed amount. This creates a systematic bias between the feed amount and actual intake. More importantly, the social hierarchy among rats dynamically evolves with individual maturity and health status. After a hierarchy reshuffling event, the competitive landscape changes, the original bias patterns become invalid, and fixed monitoring and compensation methods cannot adapt to the new competitive state. This causes the automated feeding system's feeding decisions to continuously deviate from actual needs, leading to a decrease in the accuracy of individual weight control. Furthermore, there are conflicts between the multi-objective constraints in different experimental stages. For example, the rapid weight gain phase emphasizes the rate of weight gain, while the steady-state maintenance phase emphasizes low volatility and cost control. Optimization strategies with a single fixed reward structure cannot automatically adjust the objective weights when switching stages.
[0020] Therefore, there is a need for an automated feeding monitoring method for rats that can continuously track the dynamic evolution of the social hierarchy of the group, quantify the intake bias caused by competition in real time, quickly adapt to the new competitive landscape when the hierarchy is reorganized, and automatically switch between weight control targets and multi-constraint balance strategies between different experimental stages.
[0021] At least one embodiment of the present invention discloses an automated feeding-assisted monitoring method for rats, such as... Figure 1 As shown, it includes the following steps: Step 1: Obtain individual status data, pairwise interaction data, and experimental parameters of the group-housed rats; Acquire current weight, feeding trend, and activity level data of each target rat in the group-housed cage as individual state characteristics; acquire spatial interaction records of the feeding area and extract pairwise interaction features between individuals; read the current experimental stage label and the corresponding target weight value, allowable fluctuation range, and feed budget constraint parameters.
[0022] It should be noted that the above-mentioned feeding trend data refers to the time sequence data of the food intake of each target rat during the preset observation period, including the moving average of daily food intake and the rate of change of food intake, which is used to characterize the feeding behavior trend of an individual.
[0023] It should be noted that the above activity level data refers to the cumulative distance traveled by each target rat within a preset time period and the duration of stay in the feeding area, which is used to characterize the activity level of the individual.
[0024] It should be noted that the above-mentioned paired interaction features refer to the quantitative description of the spatial interaction behavior between any two rats in the feeding area, including the co-occurrence frequency of the two individuals in the feeding area, the displacement and retreat frequency of one rat when it approaches the feed placement position, and the ratio of the duration each rat occupies the placement position when they are both in the feeding area.
[0025] It should be noted that the above experimental stage labels are predefined stage identifiers in the experimental protocol, indicating different experimental stages such as the pre-drug weight gain period, the drug administration steady-state period, or the recovery period. The target weight value, allowable fluctuation range, and feed budget constraint parameters corresponding to each stage are pre-configured in the experimental protocol.
[0026] After collecting individual state features and paired interaction features in step 1, data preprocessing is performed on each feature component to eliminate the influence of dimensional differences on subsequent time-series graph neural network calculations. Specifically, numerical features such as weight data, cumulative movement distance, dwell time, co-occurrence frequency, displacement retreat frequency, and duration ratio are standardized using Z-score, mapping each feature component to a standard distribution with a mean of zero and a variance of one. Experimental stage labels are converted into numerical vectors using one-hot encoding for use by the stage conditional modulation layer of the conditional deep Q-network in step 7.
[0027] Step 2: Input the social relationship graph sequence into the temporal graph neural network to extract the temporal-aware embedding vector and social ranking score of each individual; Based on pairwise interaction features, the pairwise interaction features of each time period are organized into social relationship graph snapshots according to a fixed time window, generating a social relationship graph sequence arranged in chronological order. In each social relationship graph snapshot, each target rat is a graph node, and the features of each node are the individual state features of that individual. The edge weight between any two nodes is the comprehensive metric value of the corresponding pairwise interaction features. The social relationship graph sequence is input into a temporal graph neural network, which outputs the temporal-aware embedding vector and social rank score for each individual.
[0028] It should be noted that the comprehensive metric value of the above-mentioned pairwise interaction features refers to the combination of the three components of co-occurrence frequency, displacement retreat frequency and duration ratio after the standardization process described in step 1, and then the weighted summation method is used as the weight of the edge between the corresponding node pairs. The weight of each component is pre-configured in the experimental scheme.
[0029] It should be noted that the above-mentioned temporal graph neural network consists of two parts: a graph attention message passing layer and a gated recurrent unit. It is an unconventional algorithm, and its processing steps are as follows: Step 2.1: The graph attention message passing layer is executed on the social relationship graph snapshot at each time step. For individuals At time step Calculate individual with neighboring nodes Attention weights between The calculation method is as follows: ; in, For individuals At time step The node input features are the standardized individual state feature vectors obtained in step 1. It is a learnable linear transformation matrix used to map node features to the hidden layer space required for attention computation; This is the attention parameter vector, used to compress the concatenated feature vector into a scalar attention score; For individuals With individuals The edge weights between them are the combined metric of the aforementioned pairwise interaction features; For individuals At time step The set of neighboring nodes, that is, the set of nodes that are related to the individual in the social relationship graph snapshot at that time step. There are all other individuals connected by edges; This represents a vector concatenation operation; Represents an exponential function; For the set of neighboring nodes The summation index variable used to iterate through each neighbor node. Attention weights. Reflecting the individual For individuals The degree of social impact, attention weight The denominator for individuals Summing all neighbors ensures that the weights are normalized.
[0030] Step 2.2: Aggregate the features of neighboring nodes according to attention weights and update the individual. At time step Graph embedding representation The calculation method is as follows: ; in, ReLU is used as the activation function. The attention weights obtained in step 2.1; For individuals At time step Graph embedding representation after graph attention message passing, graph embedding representation Dimensions and linear transformation matrix The output dimensions are the same, capturing individuals. Local neighborhood structure information in the social relationship graph at the current time step.
[0031] Step 2.3: The gated loop unit receives the graph embedding representation output from step 2.2. The historical hidden state of the previous time step To merge and generate individuals At time step Temporally Aware Embedded Vectors The calculation method is as follows: ; in, For standard gated loop unit operation, historical hidden states are selectively retained through gate update and gate reset mechanisms. Long-term information in the graph and its embedding representation in the current graph. Short-term information in the vector enables time-aware embedding. Simultaneously encode individuals The dynamic changing trends of the local interaction state and its historical social position at the current time step. The historical hidden state at the beginning of the sequence. Initialize to a zero vector.
[0032] Step 2.4: The temporal-aware embedding vectors of each individual are processed by linear mapping and Sigmoid normalization to generate social ranking scores. The calculation method is as follows: ; in, For learnable weight vectors, For bias terms, Represents the transpose, a learnable weight vector. and bias terms Embedding time-aware vectors After linear compression to a scalar, it is mapped to the Sigmoid function. The range of values for the social ranking score is [range]. The higher the value, the higher the individual's social status in the group, and the more likely they are to obtain more feed than they are given in feeding competition.
[0033] Furthermore, the aforementioned temporal graph neural network takes the social relationship graph snapshot sequence at each time step as input and the temporal-aware embedding vector of each individual at each time step as input. and time-aware embedding vectors Social ranking score obtained from mapping As output, during training, a social relationship graph sequence constructed from the pairwise interaction features and individual state features of each individual within a historical time period is used as the training sample. The deviation direction of each individual's actual intake relative to the feeding amount, recorded by a feeding monitoring sensor during the same period, is used as the supervision label; that is, individuals with positive deviations correspond to higher-level scores, and individuals with negative deviations correspond to lower-level scores. A binary cross-entropy loss function is used to measure the difference between the predicted level score and the supervision label, and the Adam optimization algorithm is used to update the label. , , and Learnable parameters, etc.
[0034] Step 3: Based on the social rank score fitting deviation mapping relationship, calculate the competitive intake deviation coefficient for each individual; Based on social class scores and historical feeding-to-actual intake deviation data, linear regression is used to fit the mapping relationship between social class scores and intake deviation, and the competitive intake deviation coefficient for each individual is calculated. The input to the linear regression is the social class score sequence for each individual over a historical time period, and the output is the deviation ratio between the corresponding feeding amount and actual intake amount. The deviation mapping parameters are obtained through fitting. Substituting the social class score of each individual at the current time step into the deviation mapping parameters, the competitive intake deviation coefficient for each individual is calculated. .
[0035] It should be noted that the above-mentioned competitive intake bias coefficient The meaning is: when When, it represents an individual In competition, they tend to obtain more feed than they are given, resulting in an actual intake exceeding the amount fed; when When, it represents an individual Being at a disadvantage in competition, the actual intake is less than the feeding amount; when When the value is close to zero, it indicates that the individual is less affected by competition.
[0036] It should be noted that the above-mentioned historical feeding-actual intake deviation data refers to the difference between the amount of food fed to each individual and the actual intake recorded by the feeding monitoring sensor over several past feeding cycles.
[0037] Furthermore, the linear regression described above uses the social rank score sequence of each individual over a historical time period as input features, the deviation ratio between the corresponding feeding amount and the actual intake amount as the regression objective, the mean squared error loss function to measure the fitting error, and the deviation mapping parameter to be solved by the least squares method. Substituting the social rank score of each individual at the current time step into the deviation mapping parameter, the competitive intake deviation coefficient of each individual is obtained. The deviation ratio is calculated by dividing the difference between the actual intake and the feeding amount by the feeding amount. The resulting signed ratio is the deviation ratio sample for that individual at that time step, and is used as the regression target value for linear regression.
[0038] Step 4: Correct the competition deviation of the candidate feeding amount and generate automatic feeding instructions; Based on each individual's current weight data, target weight value, and competitive intake deviation coefficient, the candidate feeding amounts for each individual are corrected for competitive deviation, generating a corrected set of candidate feeding actions. For weaker individuals with a negative competitive intake deviation coefficient, the candidate feeding amount is increased to compensate for competitive losses; for dominant individuals with a positive competitive intake deviation coefficient, the candidate feeding amount is decreased to offset feeding gains. The corrected set of candidate feeding actions is then constrained and screened, removing actions that violate feed budget constraints and allowable fluctuation ranges. From the remaining actions, feeding actions that bring each individual's weight towards the target weight value are selected and output as automatic feeding instructions to the feeding device for execution.
[0039] It should be noted that the calculation method for the competition deviation correction of the above candidate feeding amounts is as follows: ; in, For individuals Original candidate feeding amounts calculated based on body weight deviation. For individuals The competitive intake bias coefficient, This is the corrected candidate feeding amount. When... When the corrected candidate feeding amount is less than the original candidate feeding amount; when At that time, the corrected candidate feeding amount is greater than the original candidate feeding amount, thereby compensating for the intake bias caused by competition.
[0040] It should be noted that the above correction formula requires the denominator to be... That is, the competitive intake bias coefficient Do not take Due to the competitive intake bias coefficient The competitive intake bias coefficient is obtained from linear regression mapping. The physical meaning of the coefficient of variation is the deviation ratio between the actual intake and the feeding amount. In actual feeding scenarios, the actual intake of an individual will not drop to zero, therefore the competitive intake deviation coefficient is... The range of values is constrained as follows: The condition that the denominator is non-zero is naturally satisfied under normal experimental conditions.
[0041] It should be noted that the above-mentioned original candidate feeding amounts The generation method is as follows: the difference between the current weight of each individual and the target weight value is taken as the weight deviation, which is proportionally converted into the increase or decrease of the required intake. Then, the deviation compensation is added to the baseline of the individual's historical average daily food intake to generate several discrete feeding amount candidate values, which constitute the original candidate feeding amount of each individual in the candidate feeding action set.
[0042] In this embodiment of the application, in order to enable the automatic feeding system to quickly adapt to the new competitive landscape when the hierarchy is reorganized, the following hierarchy exchange event detection step is included in addition to step 2: Step 5: Detect the social class exchange event and trigger a deviation mapping reset; Based on the time-aware embedding vectors of adjacent time steps, the embedding change magnitude and direction of each individual are calculated to generate social position change indicators for each individual. Rank exchange events are identified and the deviation mapping parameters are reset. The specific steps are as follows: Step 501: For each individual Calculate adjacent time steps and The difference vector between the time-aware embedding vectors , with the difference vector The norm, representing the magnitude of change, is used, with the direction of the difference vector as the direction of change. Combining the magnitude and direction of change, we arrive at an individual... Social position change indicator.
[0043] Step 502: Use a hierarchical clustering algorithm to cluster the social position change indicators of each individual. The input of the hierarchical clustering algorithm is the social position change indicator of each individual, and the output is the cluster label of each individual. After obtaining the cluster labels, identify individual pairs whose change magnitude exceeds a preset change threshold and whose change direction is opposite. Mark the individual pairs that meet the conditions as level exchange events.
[0044] It should be noted that the method for determining the opposite direction of change is as follows: calculate the two volume difference vectors. and The cosine similarity between the two entities is used. When the cosine similarity is less than a preset negative threshold, the two entities are considered to have opposite directions of change, satisfying the directional condition for a level exchange event. The preset negative threshold ranges from [value missing]. The preset negative threshold is pre-configured in the experimental design to control the strictness of the opposite direction determination: the closer the preset negative threshold is to the desired value, the more stringent the determination. The closer the two volumes' embedding changes are to being completely opposite, the stricter the judgment; the closer the preset negative threshold is to each other... The more lenient the requirement for opposite directions, the more lenient the requirement.
[0045] Step 503: When a rank exchange event is detected, reset the deviation mapping parameters in Step 3, clear the historical feeding-actual intake deviation data before the rank exchange event, re-execute the linear regression fitting in Step 3 based on the newly collected monitoring data after the rank exchange event, and update the competitive intake deviation coefficient of each individual.
[0046] It should be noted that the aforementioned preset change threshold refers to a threshold determined based on the statistical distribution of historical social position change indicators. The average of historical change amplitudes plus a certain multiple of the standard deviation is taken as the preset change threshold. Only when the change amplitude exceeds the preset change threshold is the individual's social position considered to have changed significantly.
[0047] In this embodiment of the application, in order to enable the automatic feeding system to automatically balance multi-objective constraints between different experimental stages, in addition to step 4, the following multi-objective reward function construction step and policy optimization step based on conditional deep Q network are also included, to replace the method of selecting feeding actions based on simple objective convergence in step 4: Step 6: Construct a multi-objective reward function based on the experimental phase parameters; Based on the target weight, allowable fluctuation range, and feed budget constraints of the current experimental phase, a multi-objective reward function is constructed. This function combines weight deviation penalties, fluctuation penalties, and cost penalties with phase-specific weights, calculated as follows: ; in, For time step Instant rewards For individuals At time step weight, This is the target weight value for the current stage. For the current stage The allowable fluctuation range For time step Total feed consumption, , , The current stage The corresponding weight deviation weight, fluctuation penalty weight, and cost penalty weight are all non-negative real numbers, and are pre-configured in stages in the experimental design. This represents the summation over all target rats in a group rearing cage. This is the summation index variable used to iterate over each target rat individual.
[0048] Furthermore, in the aforementioned multi-objective reward function, the time step Instant rewards During the training of the Conditional Deep Q-Network, a long-term reward estimate is accumulated using a temporal difference method: after performing a feeding action at each time step, the immediate reward of the current time step is accumulated. The discount and the maximum Q value of the target network output at the next time step together constitute the temporal difference objective, so that the optimization objective of the multi-objective reward function covers the cumulative weight control effect of multiple steps from the current time step to the end of the experimental phase, rather than just reflecting the weight deviation, fluctuation and cost status of a single step.
[0049] It should be noted that the dimensions of the penalty terms in the multi-objective reward function differ: the weight deviation penalty term... The square of the relative deviation has already yielded a dimensionless quantity; the fluctuation penalty term... The unit is body weight, total feed consumption The units are mass units, and since the two have different dimensions, they cannot be directly weighted and summed. Therefore, before substituting them into the multi-objective reward function calculation, the excess weight deviation and total feed consumption in the fluctuation penalty term are standardized using Z-score, and each term is uniformly mapped to a dimensionless distribution with a mean of zero and a variance of one before being weighted and combined to eliminate the influence of dimensional differences on the value of the multi-objective reward function.
[0050] The weighting configuration differs in different experimental phases; for example, during the pre-drug weight gain period, Take the larger value to help your weight quickly approach your target level. Take the smaller value to relax feed budget constraints; during the steady-state period of drug administration, Take a larger value to suppress weight fluctuations. Choose a moderate value to balance cost control.
[0051] It should be noted that the weight values for each of the above stages are pre-configured in the experimental scheme. When the experimental stage label is switched, the data processing device automatically reads the weight value corresponding to the new stage and updates the multi-objective reward function.
[0052] Step 7: Generate feeding strategies under enhanced states using a conditional deep Q-network; The current weight data, feeding trend data, activity level data, and deviation from the target weight value of each individual are encoded into a state vector. The state vector is concatenated with the current experimental stage encoding and the competitive intake deviation coefficient to form an enhanced state vector. This is input into a conditional deep Q network, and the expected cumulative reward Q value of each candidate feeding action is output.
[0053] It should be noted that the aforementioned conditional deep Q-network is an unconventional algorithm, consisting of three parts: a state coding layer, a stage conditional modulation layer, and an action Q-value output layer. Its processing steps are as follows: Step 7.1: The state coding layer is a fully connected neural network that receives the augmented state vector and outputs the feature representation. Specifically, the enhanced state vector undergoes a layer-by-layer transformation through several fully connected layers and nonlinear activation functions, mapping the original state information into a fixed-dimensional hidden feature representation. This is used as input for the conditional modulation layer in subsequent stages. The enhanced state vector is composed of the individual's weight data, eating trend data, activity level data, and the difference between current weight and the stage target weight value obtained in step 1, as well as the experimental stage one-heat encoding vector obtained in step 1 and the competitive intake bias coefficients of each individual obtained in step 3. It is assembled sequentially.
[0054] Step 7.2: The stage conditional modulation layer receives the current experimental stage code. Generate scaling parameters and offset parameters The feature representation output in step 7.1 An affine transformation is performed to adaptively adjust the feature extraction behavior of the conditional deep Q-network according to different experimental stages. The calculation method is as follows: ; in, For element-wise multiplication, The modulated feature vector, and All are related to feature representation Vectors of the same dimension are encoded in the experimental phase. Generate learnable linear mappings for the input, respectively for the feature representations. Element-wise scaling and translation are performed across each dimension, resulting in different feature response patterns for the Q-value output layer in subsequent actions at different experimental stages. The experimental stage encoding... This refers to the numerical vectors obtained by one-hot encoding the experimental stage labels in step 1. These numerical vectors are then used to generate scaling parameters through their respective independent learnable linear mappings. and offset parameters .
[0055] Step 7.3: The action Q-value output layer is a fully connected neural network that receives the modulated feature vector output from Step 7.2. Output the Q value corresponding to each candidate feeding action. ,in To enhance the state vector, For candidate feeding actions, These are the learnable parameters of a conditional deep Q-network. Specifically, they are the modulated feature vectors. After being transformed layer by layer through several fully connected layers, the modulated feature vector is finally output by the final output layer. The mapping is a Q-value vector with the same dimension as the number of candidate feeding actions, where each element in the Q-value vector corresponds to an estimated expected cumulative reward for a candidate feeding action.
[0056] Based on the Q-values of each candidate feeding action output by the conditional deep Q-network, the expected intake effect of the candidate feeding action is corrected by the competitive intake deviation coefficient. Actions that violate hard constraints such as feed budget constraint parameters and allowable fluctuation range are screened out. The action with the highest Q-value is selected from the remaining actions as the automatic feeding instruction output to the feeding device for execution.
[0057] Furthermore, the aforementioned conditional deep Q-network is used to enhance the state vector. As input, the Q value corresponding to each candidate feeding action As output. During training, a temporal difference learning approach is used, with the immediate reward at the current time step as the output. The discounted sum of the maximum Q-values output by the target network at the next time step is used as the temporal difference objective. The mean square error between the predicted Q-values and the temporal difference objective is used as the loss function. The Adam optimization algorithm is then employed to update the learnable parameters. Furthermore, historical state transition data is randomly sampled using an experience replay buffer to improve training stability. The target network has the same structure as the online network, and its parameters are copied and updated from the online network parameters every fixed number of rounds to provide stable temporal difference target estimation.
[0058] Step 8: Update the conditional depth Q network parameters based on execution feedback; After executing the automatic feeding command, new weight data and feeding monitoring data are collected for each individual. Based on the new weight data and feeding monitoring data, the immediate reward for the current time step is calculated using the multi-objective reward function from step 6. The state transition data, consisting of the augmented state vector at the current time step, the executed feeding action, the immediate reward, and the augmented state vector at the next time step, is stored in the experience replay buffer. A batch of state transition data is randomly sampled from the experience replay buffer, and the learnable parameters of the conditional deep Q-network are updated based on the temporal difference objective. .
[0059] In this embodiment, to enable the Conditional Deep Q-Network to quickly explore effective feeding strategies adapted to the new competitive landscape after hierarchical relationship reorganization, a short-term enhanced exploration is triggered during the action selection process in step 8 when a hierarchical exchange event is detected in step 5. Specifically, within a preset exploration period after the hierarchical exchange event, the probability of random exploration during action selection is increased, allowing the Conditional Deep Q-Network to select candidate feeding actions that are not Q-optimal with a higher probability, thereby collecting diverse state transition data under the new competitive landscape. After the preset exploration period ends, the probability of random exploration returns to normal levels.
[0060] It should be noted that the length of the preset exploration period mentioned above refers to the number of feeding rounds for continuous enhancement exploration after the level exchange event occurs. The length of the preset exploration period is determined based on the minimum amount of data required for refitting the deviation mapping parameters.
[0061] After iterative execution of steps 1 to 8, an adaptive differential automatic feeding monitoring strategy for level changes is output. The adaptive differential automatic feeding monitoring strategy for level changes includes the feeding amount instruction for each individual after competition bias correction, the current social level score and competition intake bias coefficient of each individual, level exchange event markers, and stage adaptation parameters of the multi-objective reward function.
[0062] This implementation addresses the systematic discrepancy between the feed amount and actual intake caused by social competition in automated rat feeding monitoring. It utilizes a temporal graph neural network to process a sequence of social relationship graphs constructed according to fixed time windows. After capturing the spatial interactions between individuals at each time step in the graph attention message passing layer, it employs a gated recurrent unit to fuse historical graph embedding information, thereby continuously tracking the dynamic changes in each individual's social rank position within the group and outputting a social rank score reflecting their competitive status. Based on a linear regression mapping between the social rank score and historical feed-actual intake deviation data, the degree of intake deviation caused by differences in competitive status is quantified. This allows the automated feeding system to specifically adjust the feed amount based on the competitive intake deviation coefficient when generating feeding instructions, thus overcoming the inaccuracy problem of existing methods that equate feed amount with actual intake.
[0063] Furthermore, by calculating the magnitude and direction of changes in the temporal sensing embedding vectors at adjacent time steps and performing cluster analysis, individual pairs with significant embedding changes and opposite directions are identified and marked as rank exchange events. When a rank exchange event is detected, the deviation mapping parameters are reset and the mapping relationship is refitted based on the newly collected monitoring data after the rank exchange event. Therefore, the automatic feeding system can quickly adapt to the new competitive landscape after rank reorganization, overcoming the problem of continuous accumulation of deviation under dynamic changes in social rank in the fixed compensation method.
[0064] Furthermore, by adjusting the weight configuration of weight deviation penalty, fluctuation penalty, and cost penalty in the multi-objective reward function based on the experimental stage label, and by using a conditional deep Q network to modulate the feature representation with stage encoding as a condition, the conditional deep Q network can adaptively adjust the policy preference of the conditional deep Q network in different experimental stages. Therefore, it can automatically balance the conflict between multi-objective constraints when switching stages, overcoming the problem that a single fixed reward structure cannot cope with the differentiated control requirements of multiple stages.
[0065] A laboratory animal center conducted a neuropharmacology study in 2022. Five male Wistar rats (numbered 001 to 005) were housed in a group cage, currently in the pre-administration weight gain phase (experimental phase labeled PRE). The cages were equipped with six weighing sensor nodes, two feeding monitoring sensors, and a spatial tracking device. An automatic feeding system could identify individuals entering the feeding area and dispensing feed according to instructions. The experimental protocol required the five rats to reach a target weight of 280g by the end of the pre-administration weight gain phase, with an allowable fluctuation range of 5g, and a daily feed budget limit of 50g per cage. The data processing device executed a closed-loop feeding decision and monitoring feedback every 24 hours.
[0066] In step 1, the data processing device collected individual state characteristics and paired interaction characteristics of 5 rats at time step 7 (day 7 of the experiment) and read the parameters for the current experimental stage. Body weight data was directly recorded by the weighing sensor; feeding trend data consisted of the moving average of the previous 7 days and the rate of change in food intake; activity level data consisted of the cumulative distance traveled that day and the duration of stay in the feeding area. All features were Z-score standardized for use in subsequent steps.
[0067] Table 1. Original data of individual status and Z-score standardized results:
[0068] Regarding pairwise interaction features, the ratio of co-occurrence frequency, displacement retreat frequency, and duration in the feeding area was standardized by Z-score and then weighted and summed according to pre-configured weights (co-occurrence 0.3, retreat 0.5, duration 0.2) to obtain the comprehensive metric value of the edge weight of each node pair. The parameters for the current experimental stage are: target body weight 280g, allowable fluctuation range 5g, daily feed budget upper limit 50g, and stage label unique heat code [1,0,0] (corresponding to PRE, MED, and REC stages).
[0069] In step 2, the seven social relationship graph snapshots from time steps 1 to 7 are combined into a sequence and input into the temporal graph neural network. Taking time step 7 as an example, the processing of the graph attention message passing layer and the gated recurrent unit is explained.
[0070] Taking the calculation of the attention weight between mouse 001 and mouse 003 as an example, the standardized feature vectors of the two nodes are mapped by the linear transformation matrix W and concatenated with the edge weight 0.76. After compression of the attention parameter vector and activation by LeakyReLU, the unnormalized score is obtained. The set of neighboring nodes of mouse 001 includes mouse 002 to mouse 005. After normalization, the attention weight of mouse 003 to mouse 001 is 0.31, reflecting that the degree of social influence of mouse 003 on mouse 001 ranks second among the four neighbors.
[0071] The gated recurrent unit fuses the graph embedding representation of time step 7 with the historical hidden state of the previous time step, outputting a time-aware embedding vector. Subsequently, after linear mapping and Sigmoid normalization, the social ranking score of each individual is calculated. ; Taking mouse 001 as an example, the linear mapping output value is 1.84, then:
[0072] Table 2 Social Rank Scores for Individuals at Time Step 7:
[0073] Mouse 001 had the highest social rank score (0.863), indicating that it was in a dominant position in the feeding competition and tended to obtain more feed than it was given; Mouse 005 had the lowest score (0.177), indicating that it was at a clear disadvantage.
[0074] In step 3, based on historical data from the past 14 feeding cycles, a linear regression was performed on the social rank score sequence of each individual and the corresponding feeding-actual intake deviation ratio to obtain the deviation mapping parameters (slope 0.512, intercept −0.241). The deviation mapping relationship is as follows:
[0075] Taking mouse 001 as an example, the competitive intake bias coefficient is:
[0076] Taking Mouse 005 as an example:
[0077] Table 3. Calculation results of the competitive intake bias coefficient for each individual:
[0078] In step 4, each individual calculates the initial candidate feeding amount based on the difference between their current weight and target weight. Taking mouse 005 as an example, its current weight is 241.2g, and its target weight is 280g, resulting in a weight deviation of 38.8g. Combined with the historical average daily food intake baseline of 12.8g, an initial candidate feeding amount of 15.3g is generated. Substituting this into the competition deviation correction formula:
[0079] Taking mouse 001 as an example, the original candidate feeding amount was 12.1g, and after correction:
[0080] Table 4. Results of Correction for Competition Bias in Candidate Feeding Amounts:
[0081] During the constraint screening phase, the total corrected feeding amount of 71.4g exceeded the daily feed budget of 50g, triggering budget constraint screening. The corrected feeding amount for each individual was reduced proportionally to meet the budget constraint before the output was an automatic feeding instruction.
[0082] In step 5, at time step 12, the data processing device detects a potential hierarchy exchange signal between mouse 002 and mouse 004. The difference vector between their time-aware embedding vectors at adjacent time steps is calculated:
[0083] The L2 norm of the difference vector for mouse 002 is 0.347, and the L2 norm of the difference vector for mouse 004 is 0.329, both exceeding the preset variation threshold of 0.28 (obtained by adding 1.3 times the standard deviation of 0.10 to the historical variation mean of 0.15). The cosine similarity between the two difference vectors is -0.81, which is less than the preset negative threshold of -0.65, satisfying the condition of opposite directions. The system marks mouse 002 and mouse 004 as a level exchange event, clears the historical deviation data before time step 12, resets the deviation mapping parameters, and re-executes linear regression fitting based on the newly collected data in subsequent feeding rounds.
[0084] In step 6, at time step 7, the weights for the pre-drug-administered weight gain period are configured as follows: weight deviation penalty weight 2.0, fluctuation penalty weight 0.5, and cost penalty weight 0.2, reflecting a strategy preference that emphasizes rapid weight approach to the target and relaxes cost constraints during the weight gain period. The weight data of 5 rats are substituted into the multi-objective reward function:
[0085] Taking mouse 001 as an example, the weight deviation item is:
[0086] The sum of the weight deviation terms for the 5 rats was approximately 0.0312, and the weight deviation penalty after weighting was -2.0 × 0.0312 = -0.0624. The weight of all 5 rats on that day was lower than the target value and the deviation exceeded the 5g fluctuation range. The weighted contribution of the fluctuation penalty term after standardization was approximately -0.5 × 0.83 = -0.415, and the weighted contribution of the cost penalty term after standardization was approximately -0.2 × 0.12 = -0.024. The final immediate reward R(7) ≈ -0.501.
[0087] In step 7, an enhanced state vector is constructed, which includes the weight data, feeding trend data, activity level data, and the difference between each rat and its target weight (-18.6, -26.2, -31.4, -35.9, -38.8g, respectively) of the five rats, as well as the stage unique heat code [1,0,0] and the individual competitive intake deviation coefficients (+0.201, +0.097, 0.000, -0.092, -0.150) concatenated together.
[0088] The stage conditional modulation layer receives the one-hot code [1,0,0] corresponding to the PRE stage, generates scaling and offset parameters through a learnable linear mapping, and performs an element-wise affine transformation on the feature representation output by the state coding layer:
[0089] The action Q-value output layer maps the modulated features to Q-value vectors corresponding to each candidate feeding action. The candidate feeding action set contains combinations of feeding amounts discretized at 0.5g intervals. After filtering out actions whose total feeding amount exceeds the budget of 50g or causes the weight of a single rat to exceed the allowable fluctuation range, the action with the highest Q-value is selected from the remaining actions.
[0090] Table 5. Q-value evaluation results of some candidate feeding actions (after constraint screening):
[0091] The Q value of action ACT-094 is the highest (-1.102), and it is output as an automatic feeding command to the feeding device for execution.
[0092] In step 8, after executing the ACT-094 feeding instruction, the feeding monitoring sensor collects the actual intake of each individual 24 hours later, and the weighing sensor records the new weight data. Taking mouse 001 as an example, it was fed 7.1g, and due to competitive advantage (bias coefficient +0.201), the actual intake was about 8.5g, and the new weight increased to 262.7g. Taking mouse 005 as an example, it was fed 12.5g, and due to competitive disadvantage (bias coefficient -0.150), the actual intake was about 10.6g, and the new weight increased to 242.8g. Based on the new weight data, the immediate reward R(8) is calculated by substituting it into the multi-objective reward function in step 6. This, along with the current enhanced state vector, the executed action ACT-094, the immediate reward R(8), and the enhanced state vector of the next time step, forms the state transition data, which is stored in the experience replay buffer. A batch of historical state transition data is randomly sampled to update the learnable parameters of the conditional deep Q network.
[0093] The data flow throughout the implementation process reflects a rigorous logical chain: In step 1, the individual state features and paired interaction features collected are standardized using Z-scores and then input into step 2 as node features and edge weights of the temporal graph neural network; the social ranking scores output in step 2 (e.g., mouse 001 score 0.863, mouse 005 score 0.177) directly drive the linear regression fitting in step 3, mapping to a competition intake bias coefficient (e.g., +0.201 for mouse 001, -0.150 for mouse 005); step 4 uses the bias coefficient to correct the original candidate feeding amounts, increasing the feeding amount for the weaker individual mouse 005 from 15.3g to 18.0g to compensate for competition losses. Step 5 identifies the rank exchange event between mouse 002 and mouse 004 by monitoring changes in the temporal perception embedding vector (cosine similarity -0.81 is lower than the threshold -0.65), triggering a deviation mapping reset; Step 6 constructs a multi-objective reward function based on weight gain option reconfiguration (weight deviation penalty weight 2.0, fluctuation penalty weight 0.5, cost penalty weight 0.2), providing an evaluation signal for stage adaptation for strategy optimization; Step 7 integrates the competition deviation coefficient and stage encoding into the enhanced state vector, and selects the feeding action ACT-094 with the optimal Q value after conditional modulation; Step 8 calculates the immediate reward based on execution feedback and updates the network parameters, forming a closed-loop iteration. The output data of each step is used as the direct input of subsequent steps, ensuring data consistency and logical coherence throughout the entire chain from social interaction observation to the generation of differentiated feeding instructions.
[0094] The embodiments of the present invention have been described above. However, the embodiments are not limited to the specific implementation methods described above. The specific implementation methods described above are merely illustrative and not restrictive. Those skilled in the art can make more equivalent embodiments under the guidance of the present embodiments, and all of them are within the protection scope of the present embodiments.
Claims
1. A method for automatically monitoring feeding in rats, characterized in that, Includes the following steps: Acquire the individual state characteristics and paired interaction characteristics of each target rat in the group cage, as well as the target weight value, allowable fluctuation range and feed budget constraint parameters corresponding to the label in the current experimental stage; Based on the paired interaction features, a social relationship graph sequence is constructed according to a fixed time window. The social relationship graph sequence is input into a time-series graph neural network, and the time-series-aware embedding vector and social level score of each individual are output. Based on the social rank score and historical feeding-actual intake deviation data, linear regression is used to fit the deviation mapping relationship between social rank score and intake deviation, and the competitive intake deviation coefficient of each individual is calculated. Based on the competitive intake deviation coefficient, the candidate feeding amount of each individual is corrected for competitive deviation, the corrected candidate feeding action is constrained and screened, an automatic feeding instruction is generated and output to the feeding device for execution. The temporal graph neural network consists of a graph attention message passing layer and a gated recurrent unit. The graph attention message passing layer calculates the attention weights between an individual and its neighboring nodes on the social relationship graph snapshot at each time step and aggregates the neighboring features to generate a graph embedding representation. The gated recurrent unit fuses the graph embedding representation of the current time step with the hidden state of the previous time step to generate the temporal-aware embedding vector.
2. The automatic feeding and auxiliary monitoring method for rats according to claim 1, characterized in that, The graph attention message passing layer calculates the attention weights between an individual and its neighboring nodes and weights and aggregates neighboring features to generate a graph embedding representation. This includes: for an individual at the current time step, mapping the individual's node input features and the node input features of each neighboring node to the hidden space using a learnable linear transformation matrix; concatenating the mapped features of the individual and each neighboring node along with their corresponding edge weights; compressing these into a scalar using an attention parameter vector; activating the scalar using LeakyReLU and taking the exponent; and then normalizing all neighboring nodes to obtain the attention weights between the individual and each neighboring node; summing the linearly transformed features of each neighboring node according to the attention weights; and then processing this sum using an activation function to generate the graph embedding representation of the individual at the current time step. The edge weights are a comprehensive measure of the pairwise interaction features between corresponding individuals. The social rank score is obtained by linearly compressing the temporal-aware embedding vector of each individual into a scalar using a learnable weight vector and then mapping it to an open interval of zero to one using a Sigmoid function. A higher score indicates a higher social rank for the individual within the group.
3. The method for automatic feeding and auxiliary monitoring of rats according to claim 1, characterized in that, The individual status characteristics include current weight data, the moving average of daily food intake and the rate of change of food intake, as well as the cumulative value of movement distance and the duration of stay in the feeding area within a preset time period; The paired interaction features include the co-occurrence frequency, displacement retreat frequency, and the ratio of the duration each rat occupies in its feeding position when both are in the feeding area. The comprehensive metric of the paired interaction features is obtained by weighted summation of the co-occurrence frequency, displacement retreat frequency, and duration ratio after Z-score standardization. In constructing the social relationship graph sequence, each target rat is a graph node, and the features of each node are the individual state features after standardization. The edge weight between any two nodes is the comprehensive metric of the corresponding paired interaction features.
4. The method for automatic feeding and auxiliary monitoring of rats according to claim 1, characterized in that, The method of fitting the deviation mapping relationship between social rank scores and intake deviation using linear regression to calculate the competitive intake deviation coefficient for each individual includes: using the social rank score sequence of each individual over a historical time period as input features, using the corresponding deviation ratio as the regression target, and solving the deviation mapping parameters using the mean squared error loss function and the least squares method; substituting the social rank scores of each individual at the current time step into the deviation mapping parameters to obtain the competitive intake deviation coefficient for each individual; wherein, the deviation ratio is the signed ratio obtained by dividing the difference between the actual intake and the feeding amount of each individual by the feeding amount; a positive competitive intake deviation coefficient indicates that the actual intake of the individual is greater than the feeding amount, and a negative value indicates that the actual intake of the individual is less than the feeding amount.
5. The method for automatic feeding and auxiliary monitoring of rats according to claim 1, characterized in that, The method of correcting the candidate feeding amount for each individual based on the competitive intake deviation coefficient includes: the corrected candidate feeding amount for each individual is equal to the original candidate feeding amount for that individual divided by the sum of the competitive intake deviation coefficients for that individual; wherein, the original candidate feeding amount is calculated by taking the difference between the individual's current weight and the target weight value as the weight deviation, proportionally converting it into the required increase or decrease in intake, and combining it with the individual's historical average daily food intake benchmark and superimposing the deviation compensation amount; the value range of the competitive intake deviation coefficient is constrained to be greater than negative one.
6. The method for automatic feeding and auxiliary monitoring of rats according to any one of claims 1 to 5, characterized in that, It also includes the steps of detecting social rank exchange events and triggering deviation mapping reset: For each individual, the difference vector of the time-aware embedding vector between adjacent time steps is calculated, the L2 norm of the difference vector is used as the change amplitude, and the direction of the difference vector is used as the change direction, and they are combined into a social position change index; a hierarchical clustering algorithm is used to cluster the social position change index of each individual, and individual pairs whose change amplitude exceeds a preset change threshold and whose cosine similarity between the difference vectors of the two individuals is less than a preset negative threshold are identified, and the individual pairs that meet the conditions are marked as rank exchange events; When a rank exchange event is detected, the deviation mapping parameters of the deviation mapping relationship are reset, the historical feeding-actual intake deviation data before the rank exchange event is cleared, and the linear regression fitting is re-executed based on the newly collected monitoring data after the rank exchange event to update the competitive intake deviation coefficient of each individual.
7. The method for automatic feeding and auxiliary monitoring of rats according to claim 6, characterized in that, The method also includes the step of constructing a multi-objective reward function based on experimental stage parameters: the immediate reward of the multi-objective reward function is equal to the current stage weight deviation weight multiplied by the negative sum of the squares of the relative deviations of each body weight from the target weight value, minus the current stage fluctuation penalty weight multiplied by the sum of the absolute values of each body weight deviation exceeding the allowable fluctuation range, and then minus the current stage cost penalty weight multiplied by the total feed consumption at the current time step; wherein, the weight deviation weight, fluctuation penalty weight, and cost penalty weight are all non-negative real numbers, pre-configured according to the experimental stage, and the weight value corresponding to the new stage is automatically read when the experimental stage label is switched; before being substituted into the calculation of the multi-objective reward function, the excess weight deviation and total feed consumption in the fluctuation penalty item are respectively processed by Z-score standardization.
8. The method for automatic feeding and auxiliary monitoring of rats according to claim 7, characterized in that, The method also includes the step of generating feeding strategies using a conditional deep Q-network: concatenating the body weight data, feeding trend data, activity level data, deviation from target body weight, one-hot encoded vector of the experimental phase, and competitive intake deviation coefficient of each individual into an enhanced state vector, inputting it into the conditional deep Q-network, and outputting the Q value corresponding to each candidate feeding action; the conditional deep Q-network consists of a state encoding layer, a phase condition modulation layer, and an action Q value output layer; the state encoding layer is a fully connected neural network that receives the enhanced state vector and outputs feature representations. The stage condition modulation layer receives the experimental stage code, generates scaling and offset parameters, and performs element-wise scaling and translation on the feature representation to obtain the modulated feature vector; the action Q-value output layer is a fully connected neural network that receives the modulated feature vector and outputs the Q-value corresponding to each candidate feeding action; the candidate feeding action with the highest Q-value is selected as the automatic feeding instruction from the candidate feeding actions that meet the feed budget constraint parameters and the allowable fluctuation range.
9. The method for automatic feeding and auxiliary monitoring of rats according to claim 8, characterized in that, It also includes the step of updating the parameters of the conditional deep Q-network based on execution feedback: after executing the automatic feeding command, new weight data and feeding monitoring data of each individual are collected, the immediate reward is calculated using the multi-objective reward function, and the enhanced state vector of the current time step, the executed feeding action, the immediate reward, and the enhanced state vector of the next time step are combined to form state transition data and stored in the experience replay buffer. The learnable parameters of the conditional deep Q-network are updated by randomly sampling the state transition data from the experience replay buffer. When a level exchange event is detected, the random exploration probability when selecting actions is increased within a preset exploration period after the level exchange event occurs. After the preset exploration period ends, the random exploration probability returns to the normal level. The length of the preset exploration period is determined according to the minimum amount of data required for refitting the deviation mapping parameters.
10. An automated feeding auxiliary monitoring system for rats, used to perform the automated feeding auxiliary monitoring method for rats as described in any one of claims 1 to 9, characterized in that, include: The data acquisition module is used to acquire the individual state characteristics and paired interaction characteristics of each target rat in the group rearing cage, as well as the target weight value, allowable fluctuation range and feed budget constraint parameters corresponding to the label of the current experimental stage. The temporal graph neural network module is used to construct a social relationship graph sequence based on the pairwise interaction features according to a fixed time window, and outputs the temporal-aware embedding vector and social level score of each individual through the graph attention message passing layer and the gated recurrent unit; The deviation mapping module is used to calculate the competitive intake deviation coefficient of each individual by fitting the deviation mapping relationship using linear regression based on the social grade score and historical feeding-actual intake deviation data. The feeding instruction generation module is used to correct the competitive deviation of the candidate feeding amount for each individual based on the competitive intake deviation coefficient, perform constraint screening on the corrected candidate feeding actions, generate automatic feeding instructions, and output them to the feeding device for execution.