Currently the LinearProgram symbol always saves the state whether it's feasible or not
|
# we save the state regardless of whether it is feasible or not |
|
# In the future we could choose to ignore infeasible states. |
|
states[state_index, :] = self.state(state_index) |
however, this creates an issue. The state contents are undefined and may in fact encode a feasible solution to the LP, or may contain
nans and
infs.
Proposed Solution
Add another feasibility array to the serialized state. This creates 6 cases (because we need to support unspecified i.e., serialized with <=0.7.0)
|
feasible |
infeasible |
unspecified |
| contains nan/inf(s) |
no state1 |
generate a new state, mark infeas2 |
no state |
| no nan/inf(s) |
good state |
use state, mark infeas |
use state |
- This is a bit unintuitive, but we need a way to specify "no state" in the new schema. We could add yet another array but that feels like overkill.
- The generated state might itself be feasible, but the docs say that the state of an LP symbol propagating infeasible is undefined.
Currently the
LinearProgramsymbol always saves the state whether it's feasible or notdwave-optimization/dwave/optimization/symbols/lp.pyx
Lines 280 to 282 in 6a655f6
however, this creates an issue. The state contents are undefined and may in fact encode a feasible solution to the LP, or may contain
nans andinfs.Proposed Solution
Add another
feasibilityarray to the serialized state. This creates 6 cases (because we need to support unspecified i.e., serialized with<=0.7.0)