Skip to content

Conversation

@aalzoobi
Copy link
Collaborator

@aalzoobi aalzoobi commented Nov 5, 2025

No description provided.

@aalzoobi aalzoobi requested a review from tbittar November 5, 2025 13:37
objective_operational_contribution: Optional[ExpressionNode] = None
objective_investment_contribution: Optional[ExpressionNode] = None
# Objective contribution approach
objective_contributions: Optional[Dict[str, ExpressionNode]] = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then you should be able to remove objective_operational_contribution and objective_investment_contribution. Besides objective_contributions should be an objet of type ObjectiveContributions which contains an id and an expression

_is_objective_contribution_valid(
self, self.objective_investment_contribution
)
# Validate each contribution if present
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is useless, code is sufficiently explicit


# --- new field ---
objective_contributions: Optional[List[InputObjectiveContribution]] = Field(
default_factory=lambda: [], alias="objective-contributions"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default_factory=lambda: [], alias="objective-contributions"
default_factory=list, alias="objective-contributions"

I think this does the same, but more consistent with previous code

description: Optional[str] = None
extra_outputs: Optional[List[InputExtraOutput]] = None

@model_validator(mode="after")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should explicitly enforce that the models have objective_contributions rather than objective . We do not ant to bother with backward compatibility that will complxify the code (this is not a production code)

…tive-contribution-).

All corresponding libs adapted.
expression: generation >= nb_on * p_min
- id: Number of units variation
expression: nb_on = nb_on[t-1] + nb_start - nb_stop
expression: "nb_on = nb_on[t-1] + nb_start - nb_stop"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this ?

- id: Min down time
expression: sum(t-d_min_down + 1 .. t, nb_stop) <= nb_units_max[t-d_min_down] - nb_on
objective: expec(sum(cost * generation))
expression: "sum(t-d_min_down + 1 .. t, nb_stop) <= nb_units_max[t-d_min_down] - nb_on"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again why " " ?

@tbittar tbittar merged commit 9b1114f into main Dec 19, 2025
2 checks passed
@tbittar tbittar deleted the feature/contributions_objective branch December 19, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants