Skip to content

Commit

Permalink
Fixed var name tree prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmnz committed Jul 24, 2024
1 parent adc5de4 commit 732a250
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/andromede/simulation/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,9 @@ def _create_variables(self) -> None:

var_name: str = f"{model_var.name}"
component_prefix = f"{component.id}_" if component.id else ""
tree_prefix = (
f"{self.context.tree_node}_" if self.context.tree_node else ""
)

for block_timestep in self.context.get_time_indices(var_indexing):
block_suffix = (
Expand Down Expand Up @@ -776,7 +779,7 @@ def _create_variables(self) -> None:
# Internally, it will be indexed by a structure that into account
# the component id, variable name, timestep and scenario separately
solver_var = None
solver_var_name = f"{component_prefix}{var_name}{block_suffix}{scenario_suffix}"
solver_var_name = f"{tree_prefix}{component_prefix}{var_name}{block_suffix}{scenario_suffix}"

if math.isclose(lower_bound, upper_bound):
raise ValueError(
Expand Down

0 comments on commit 732a250

Please sign in to comment.