StockPyomo module

Created on Thu Feb 27 16:03:35 2020

@author: John

AfoLogic.StockPyomo.f_con_dam_betweenR(model, params, l_v1, l_k29, l_a, l_z, l_i, l_y1, l_g9, l_w9)

Between year numbers/transfers of

  1. Dams to dams in the current decision variable period (only selected when a dam is changing its sire group e.g. BBB to BBT).

  2. Dams to dams in the following decision variable period.

Note: this constraint is only active when season start is included as a dvp (e.g. not always active in steady state model).

AfoLogic.StockPyomo.f_con_dam_withinR(model, params, l_v1, l_k29, l_a, l_z, l_i, l_y1, l_g9, l_w9)

Within year numbers/transfers of

  1. Dams to dams in the current decision variable period (only selected when a dam is changing its sire group e.g. BBB to BBT).

  2. Dams to dams in the following decision variable period.

AfoLogic.StockPyomo.f_con_matingR(model)

Sire requirements for mating. Links the number of dams being joined during each mating period with the sire activities. The mating periods are necessary to represent because sires may be able to mate with more than one group of dams if joining of different groups is sufficiently dispersed. However, if the mating periods are close together, the same sires may not be ready to use again. These constraints are the link between the number of sires and the availability of those sires in multiple periods.

AfoLogic.StockPyomo.f_con_off_betweenR(model, params, l_v3, l_k3, l_k5, l_z, l_i, l_x, l_g3, l_w9_offs)

Between year numbers/transfers of offspring to offspring in the following decision variable period.

AfoLogic.StockPyomo.f_con_off_withinR(model, params, l_v3, l_k3, l_k5, l_z, l_i, l_x, l_g3, l_w9_offs)

Within year numbers/transfers of offspring to offspring in the following decision variable period.

AfoLogic.StockPyomo.f_con_prog2damsR(model, l_v1)

Numbers/transfer of progeny to dams. This transfer only happens in dvp0.

Note

Originally this constraint was made such that a dam required a certain proportion of single, twin & triplet progeny. However, the requirement was the same for all initial lw patterns of the dams at weaning, this caused problems when scanning for multiples (which has the effect of differentiating the prog) because the multiples are too light to provide sufficient numbers of the high dam starting weight and the single prog are too heavy to provide sufficient numbers of the low dam starting weight. It would be possible to reduce the maximum initial dam weight and increase the minimum so it works, but if we reduce the maximum weight to the highest weight that can be provided by triplets and increase the minimum weight to the lightest of the singles then we will have reduced the weight range significantly. So that removes the benefit of improving nutrition of dams to increase progeny weaning weight and the light progeny (that are below the lowest dam initial weight) can not be distributed and are therefore dropped altogether. The alternative implemented (3 May 21) is to sum the k2 axis for the progreq_dams constraint so that the total number of dams required can be supplied by progeny of any BTRT. The impact of this design is that the optimisation is able to select to sell the heavy singles and retain only the lighter twins as the replacements without incurring a lifetime penalty for the extra twin born lambs that are retained. This is not represented because the dams are generated using a predetermined mix of birth type - although the proportion can be altered prior to running the generator so you can calibrate the dams to represent a high proportion of twin birth type. The impact of this error will be offset by the expected higher reproductive rate of the twin born progeny. A further option might be to calculate the proportion of single, twins and trips required for each of the w slices separately based on an average of the progeny providing to each of those slices.

Note

the k3 axis is summed (same as k5 discussed above) so that the proportion of replacements selected from maidens and adults is not fixed. However, the input on the proportion of the flock replaced is still used to mask whether that age group of dams (particularly the yearlings) can provide replacements.

Note

A similar problem doesn’t exist for the offspring because the offspring have a k5 axis which is the BTRT of the animals. Therefore, the twin born progeny distribute only to twin born offspring (provided that the dams have been scanned to identify the twins) and there is not the problem associated with pre-determined proportions. However, this is not possible for the dams due to model size, including a k5 axis for the dams would require generating the dams with an active b0 axis and including a k5 axis in pyomo, both of which would significantly increase model size.

AfoLogic.StockPyomo.f_con_prog2offsR(model, l_v3)

Numbers/transfer of progeny to offs. This transfer only happens in dvp0.

AfoLogic.StockPyomo.f_con_progR(model)

Numbers/transfer of dam yatf to progeny. At weaning yatf are weaned from the dams and temporarily transferred to a progeny variable before being transferred to either offspring or dam variables (see prog2dams and prog2offs).

AfoLogic.StockPyomo.f_con_stock_trade_profit(model)

Calculate the difference in the total livestock value at the end of the year vs the start of the year.

This is used to account for trade in stock between the good year and the poor years when the numbers are averaged. When the numbers are average that is essentially the poor year buying sheep from the good year but no cashflow occurs. This reflects that transaction so that the poor year can’t unfairly increase its utility. This doesn’t affect overall profit, it only effects which season it gets realised in.

See further comments in sgen.

Used in global constraint (con_terminal_wealth). See CorePyomo

AfoLogic.StockPyomo.f_con_stockinfra(model)

Ensures enough infrastructure exists for all the animals and the associated events (e.g. mustering, shearing, etc).

AfoLogic.StockPyomo.f_stock_asset(model, q, s, p7, z)

Calculate the total asset value of livestock.

Used in global constraint (con_asset). See CorePyomo

AfoLogic.StockPyomo.f_stock_cashflow(model, q, s, p7, z, c1)

Calculate the net cashflow (income - expenses) of livestock and their associated activities.

Used in global constraint (con_profit). See CorePyomo

AfoLogic.StockPyomo.f_stock_cost(model, q, s, p7, z)

Calculate the total cost of livestock (husbandry & infrastructure).

Used in global constraint (con_minroe). See CorePyomo

AfoLogic.StockPyomo.f_stock_labour_anyone(model, q, s, p5, z)

Calculate the total ‘anyone’ labour required for livestock activities.

Used in global constraint (con_labour_any). See CorePyomo

AfoLogic.StockPyomo.f_stock_labour_manager(model, q, s, p5, z)

Calculate the total ‘manager’ labour required for livestock activities.

Used in global constraint (con_labour_any). See CorePyomo

AfoLogic.StockPyomo.f_stock_labour_perm(model, q, s, p5, z)

Calculate the total ‘permanent’ labour required for livestock activities.

Used in global constraint (con_labour_any). See CorePyomo

AfoLogic.StockPyomo.f_stock_me(model, q, s, p6, f, z)

Calculate the total energy required by livestock in each nv pool in each feed period.

Used in global constraint (con_me). See CorePyomo

AfoLogic.StockPyomo.f_stock_pi(model, q, s, p6, f, z)

Calculate the total volume provided by livestock in each nv pool in each feed period.

Used in global constraint (con_vol). See CorePyomo

AfoLogic.StockPyomo.f_stock_wc(model, q, s, c0, p7, z)

Calculate the net wc (income minus expenses since last main source of income e.g. harvest or shearing) of livestock and their associated activities.

Used in global constraint (con_wc). See CorePyomo

AfoLogic.StockPyomo.stock_precalcs(params, r_vals, nv, pkl_fs_info)