-
Notifications
You must be signed in to change notification settings - Fork 0
gurobi_robust_genetics_conic
gurobi_robust_genetics_conic(sigma, mubar, omega, sires, dams, lam, kappa, dimension, upper_bound, lower_bound, time_limit, model_output, debug)
Solve the robust optimal contribution selection problem using Gurobi. Consider a breeding cohort whose relationships are modelled some matrix
-
sigma : ndarray or spmatrix
Relationship matrix$\Sigma$ for the candidates in the cohort. This can either be a dense NumPy array or a sparse SciPy matrix, but either way must be symmetric and positive definite. If an estimated model is being used then any correction should be done before use here. -
mubar : ndarray
Vector$\boldsymbol{\bar\mu}$ of expected values of the expected returns for candidates in the cohort for selection. -
sigma : ndarray or spmatrix
Covariance matrix$\Omega$ for expected returns for candidates in the cohort. This can either be a dense NumPy array or a sparse SciPy matrix, but either way must be symmetric and positive definite. If an estimated model is being used then any correction should be done before use here. -
sires : Any
An object representing an set of indices for all sires (male candidates) in the cohort. Type is not restricted, so could be a NumPy array, a set, a list, an iterator likerange
, etc. -
dams : Any
An object representing an set of indices for all dams (female candidates) in the cohort. Type is not restricted, so could be a NumPy array, a set, a list, an iterator likerange
, etc. -
lam : float
Controls the balance between risk and return, with lower values giving riskier selections and higher more conservative ones. This can take any real value, but$\lambda<0$ effectively corresponds to rewarding inbreeding so should not be considered. -
kappa : float
Controls how resilient the solution must be to variation in expected breeding values. Can take any positive real values, with higher values representing a higher tolerance for uncertainty. Taking$\kappa = 0$ corresponds to assuming is known exactly, while$\kappa = \infty$ corresponds to unlimited tolerance for uncertainty. -
dimension : int
Number of candidates in the cohort, i.e. the dimension of the problem. While strictly speaking this is evident from the other parameters, it's asked for as a convenience to prevent repeated calculation. -
upper_bound : ndarray or float, optional
Upper bound on how much each candidate can contribute. This can be an array of differing bounds for each candidate, or a float which applies to all candidates equally. This value should be such that$0\leq l_i \leq u_i \leq 1$ and the default is,$\mathbf{u} = \mathbf{1}$ , enforced by the contributions$\mathbf{w}$ being a vector proportions rather than absolute values. -
lower_bound : ndarray or float, optional
Lower bound on how much each candidate can contribute. This can be an array of differing bounds for each candidate, or a float which applies to all candidates equally. This value should be such that$0\leq l_i \leq u_i \leq 1$ and the default is,$\mathbf{l} = \mathbf{0}$ , enforced by the contributions$\mathbf{w}$ being a vector proportions rather than absolute values. -
time_limit : float, optional
Maximum amount of time in seconds to give Gurobi to solve the problem. Optional, with the default being no time limit. -
model_output : str, optional
Name to use if saving the model file to the working directory. If given, the string is used as the file name, '{model_output}.mps'. This is optional, and by default the file isn't saved. -
debug : bool, optional
Flag which controls whether Gurobi prints its output to terminal. Default value isFalse
.
-
ndarray
Portfolio vector$\mathbf{w}$ which Gurobi has determined is a solution. -
float
Auxiliary variable$z$ corresponding to uncertainty associated with the portfolio vector which Gurobi has determined is a solution. -
float
Value of the objective function for returned solution.
If a problem had been loaded into Python, then usage of this function might look like
>>> w, z, obj = robustocs.gurobi_robust_genetics_conic(
... sigma, mubar, omega, sires, dams, lam=0.5, kappa=1, dimension=4)
>>> w
array([0.38199858, 0.38199858, 0.11800142, 0.11800142])
>>> z
0.37923871642022844
>>> obj
0.7768401180910653
Note that due to differing methods this need not give exactly the same solution as gurobi_robust_genetics_sqp
or highs_robust_genetics_sqp
, though they should be similar to some tolerance.
This documentation relates to the latest version of the package on GitHub. For past versions, download the zip bundled with the release from here. If anything in this wiki looks incorrect or you think key information is missing, please do open an issue.