linopy.model.Model.add_objective#
- Model.add_objective(expr, overwrite=False, sense='min', scaling=1)#
Add an objective function to the model.
- Parameters:
expr (
linopy.LinearExpression,linopy.QuadraticExpression) – Expression describing the objective function.overwrite (
False, optional) – Whether to overwrite the existing objective. The default is False.sense (
"min"or"max", optional) – Objective sense. The default is “min”.scaling (
float, optional) – Positive finite scaling factor for the objective. Solver-side objective coefficients are multiplied by this factor and reported objective values are divided back. The default is 1.
- Returns:
linopy.LinearExpression– The objective function assigned to the model.