Skip to content

Commit

Permalink
Fix variable get structure
Browse files Browse the repository at this point in the history
  • Loading branch information
tbittar committed Aug 21, 2024
1 parent 2c723cd commit 27f8ad8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/andromede/expression/linear_expression_efficient.py
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,7 @@ def _copy_expression(

# TODO : Define shortcuts for "x", is_one etc ....
def var(name: str) -> LinearExpressionEfficient:
# TODO: At term build time, no information on the variable structure is known, we use a default time, scenario varying, maybe discard structure as term attribute ?
return LinearExpressionEfficient(
[
TermEfficient(
Expand Down
2 changes: 1 addition & 1 deletion src/andromede/libs/standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@
var("nb_stop").sum(
shift=ExpressionRange(-param("d_min_down") + 1, literal(0))
)
<= param("nb_units_max").shift(-param("d_min_down")) - var("nb_on"),
<= param("nb_units_max").shift(-param("d_min_down")).sum() - var("nb_on"),
),
],
objective_operational_contribution=(param("cost") * var("generation"))
Expand Down
5 changes: 4 additions & 1 deletion src/andromede/simulation/linear_expression_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ def resolve_variables(
scenario,
term.component_id,
term.variable_name,
term.structure,
# At term build time, no information on the variable structure is known, we use it now
self.context.network.get_component(term.component_id)
.model.variables[term.variable_name]
.structure,
)
)
return solver_vars
Expand Down

0 comments on commit 27f8ad8

Please sign in to comment.