sasoptpy.actions.use_problem

use_problem(problem)[source]

Changes the currently active problem

Parameters
problemsasoptpy.Model

Model to be activated

Examples

>>> from sasoptpy.actions import use_problem
>>> with so.Workspace('w') as w:
>>>     m = so.Model(name='m')
>>>     m2 = so.Model(name='m2')
>>>     use_problem(m)
>>>     x = so.Variable(name='x')
>>>     use_problem(m2)
>>>     m.solve()
>>>     m2.solve()
>>> print(so.to_optmodel(w))
proc optmodel;
    problem m;
    problem m2;
    use problem m;
    var x;
    use problem m2;
    use problem m;
    solve;
    use problem m2;
    solve;
quit;