sasoptpy.actions.expand

expand()[source]

Prints expanded problem to output

Examples

>>> with so.Workspace(name='w') as w:
>>>     x = so.VariableGroup(3, name='x')
>>>     self.assertEqual(x[0].sym.get_conditions_str(), '')
>>>     # solve
>>>     x[0].set_value(1)
>>>     x[1].set_value(5)
>>>     x[2].set_value(0)
>>>     c = so.ConstraintGroup(None, name='c')
>>>     with iterate([0, 1, 2], 's') as i:
>>>         with condition(x[i].sym > 0):
>>>             c[i] = x[i] >= 1
>>>     set_objective(x[0], name='obj', sense=so.MIN)
>>>     expand()
>>>     solve()
>>> print(so.to_optmodel(w))
proc optmodel;
    var x {{0,1,2}};
    x[0] = 1;
    x[1] = 5;
    x[2] = 0;
    con c {s in {0,1,2}: x[s].sol > 0} : x[s] >= 1;
    MIN obj = x[0];
    expand;
    solve;
quit;