linopy.model.Model.add_objective

linopy.model.Model.add_objective#

Model.add_objective(expr, overwrite=False, sense='min')#

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.

Returns:

linopy.LinearExpression – The objective function assigned to the model.