fun, success and x are not added when an LPResult is created, see below.
This leads to an awkward situation, where if you have a locked model and want to inspect the state of the underlying LP, you cannot unless you added them explicitly before locking.
I think these should be added in the __init__, but perhaps there's a good reason not to?
class LPResult:
"""The outputs of a linear program run."""
lp: LinearProgram
"""The LinearProgram symbol."""
def __init__(self, lp: LinearProgram):
self.lp = lp
@functools.cached_property
def fun(self) -> LinearProgramObjectiveValue:
"""The value of the objective as an array symbol."""
return LinearProgramObjectiveValue(self.lp)
@functools.cached_property
def success(self) -> LinearProgramFeasible:
"""``True`` if the linear program found the optimal value as an array symbol."""
return LinearProgramFeasible(self.lp)
@functools.cached_property
def x(self) -> LinearProgramSolution:
"""The assignments to the decision variables as an array symbol."""
return LinearProgramSolution(self.lp)
fun,successandxare not added when an LPResult is created, see below.This leads to an awkward situation, where if you have a locked model and want to inspect the state of the underlying LP, you cannot unless you added them explicitly before locking.
I think these should be added in the
__init__, but perhaps there's a good reason not to?