odys.optimization.objective_terms.base¶
Internal implementation detail. The ObjectiveTermFormulation base class and ObjectiveTermInputs.
Base class of the model formulation of one objective term.
ObjectiveTermFormulation
¶
Bases: ConstraintGroup, ABC
The optimization model of one objective term: its variables, its @constraint methods and its expression.
It is built only when the objective has a term of its type. Terms read the
profit of the entity formulations with per_scenario_profit(self.formulations),
once the formulations' variables exist.
Source code in src/odys/optimization/objective_terms/base.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
__init__(inputs)
¶
Initialize with the shared indexing and the entity formulations of the problem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs
|
ObjectiveTermInputs
|
The objective, the shared indexing, and the entity formulations. |
required |
Source code in src/odys/optimization/objective_terms/base.py
33 34 35 36 37 38 39 40 | |
add_variables(model)
¶
Add this term's decision variables to the model. The default adds none.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Model
|
The linopy model to add the variables to. |
required |
Source code in src/odys/optimization/objective_terms/base.py
51 52 53 54 55 56 | |
build(inputs)
abstractmethod
classmethod
¶
Return the formulation of this type's objective term, or None if the objective has none.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs
|
ObjectiveTermInputs
|
The objective, the shared indexing, and the entity formulations. |
required |
Source code in src/odys/optimization/objective_terms/base.py
42 43 44 45 46 47 48 49 | |
expression()
abstractmethod
¶
Return the weighted term to maximize.
Source code in src/odys/optimization/objective_terms/base.py
58 59 60 | |
ObjectiveTermInputs
¶
Bases: BaseModel
What an objective term is built from: the objective, the shared indexing, and the entity formulations.
Source code in src/odys/optimization/objective_terms/base.py
15 16 17 18 19 20 21 22 | |