Skip to content

check_uncertainty_constraint

Josh Fogg edited this page Jul 31, 2024 · 1 revision
check_uncertainty_constraint(z, w, omega, tol, debug)

Given a solution to a robust OCS problem, this checks the gap in the relaxed term associated with robustness.

In our model for robust genetic selection we relax the objective term $\kappa\sqrt{\mathbf{w}^{T}\Omega\mathbf{w}}$ down to $\kappa z$ and a constraint $z \geq \sqrt{\mathbf{w}^{T}\Omega\mathbf{w}}$ to keep the problem in a solver-friendly form. While mathematically this should be equivalent, this function can be used to check how close $z$ and the right hand side are.

Parameters

  • z : float
    Auxiliary variable $z$ from a solution to the robust selection problem.
  • w : ndarray
    Portfolio vector $\mathbf{w}$ from a solution to the robust selection problem.
  • omega : ndarray
    Covariance matrix $\Omega$ for the distribution of expected breeding values.
  • tol : float, optional
    Tolerance with which to compare the two values. Default is $10^{-8}$.
  • debug : float, optional
    Determines whether to print a comparison of the variables to the terminal. Default is False.

Returns

  • bool
    True if the check was within tolerance successful, False otherwise.

Examples

If using the debug output, some like the following will be printed the terminal:

>>> check_uncertainty_constraint(w, z, omega, debug=True)
     z: 0.37923871642022844
wT*Ω*w: 0.3792386953366983
  Diff: 2.1083530143961582e-08