sasoptpy.Objective¶
-
class
Objective
(**kwargs)[source]¶ Bases:
sasoptpy.core.expression.Expression
Objective represents expressions with sense and used as target value in optimization
- Parameters
- exp
Expression
Objective as an expression
- namestring
Unique name of the expression
- sensestring, optional
Direction of the objective, sasoptpy.MIN (default) or sasoptpy.MAX
- exp
Examples
>>> m = so.Model(name='test_objective') >>> x = m.add_variable(name='x') >>> obj = m.set_objective(2 * x - x ** 3, sense=so.MIN, name='new_obj') >>> str(m.get_objective()) 2 * x - (x) ** (3) >>> type(obj) sasoptpy.Objective