sasoptpy.actions.set_objective¶
-
set_objective
(expression, name, sense)[source]¶ Specifies the objective function
- Parameters
- expression
sasoptpy.Expression
Objective function
- namestring
Name of the objective function
- sensestring
Direction of the objective function, so.MAX or so.MIN
- expression
Examples
>>> with so.Workspace('w') as w: >>> x = so.Variable(name='x', lb=1) >>> set_objective(x ** 3, name='xcube', sense=so.minimize) >>> solve() >>> print(so.to_optmodel(w)) proc optmodel; var x >= 1; MIN xcube = (x) ^ (3); solve; quit;