Closed SGeeversAtVortech closed 1 month ago
In GitLab by @SGeeversAtVortech on May 16, 2024, 11:51
requested review from @SGeeversAtVortech
In GitLab by @SGeeversAtVortech on May 16, 2024, 13:03
Commented on src/rtctools/optimization/goal_programming_mixin.py line 629
Why is subproblems replaced by self.__subproblems? It doesn't seem to be accessed outside of this method and it is a private variable, so you should not access it from outside this class.
In GitLab by @SGeeversAtVortech on May 16, 2024, 13:24
There seems to be a new feature for setting theta as a timeseries, but this doesn't seem to be tested. Please add a unit test for this feature.
In GitLab by @SGeeversAtVortech on May 16, 2024, 13:30
Commented on src/rtctools/optimization/homotopy_mixin.py line 65
Why not use self.__theta here? That should be correct.
In GitLab by @SGeeversAtVortech on May 16, 2024, 13:55
Commented on src/rtctools/optimization/homotopy_mixin.py line 40
This syntax seems wrong. We're comparing a boolean with a float here. Please also check other comparisons involving .any().
In GitLab by @SGeeversAtVortech on May 16, 2024, 17:01
Commented on src/rtctools/optimization/homotopy_mixin.py line 58
Can users set this parameter? How should they know?
In GitLab by @SGeeversAtVortech on May 16, 2024, 17:07
It seems that in some applications, the private variable __subproblems are accessed and adjusted based on the homotopy parameter theta. Instead, we could adjust the goals and pathgoals method to select goals of certain priorities based on the theta parameter.
The goals method could look something like this:
def goals(self, ...):
goals = ... # usual calculation of goals
theta = self.parameters()["theta"]
priorities = ... # some logic based on theta
goals = [goal for goal in goals if goal.priority in priorities]
return goals
In GitLab by @SGeeversAtVortech on May 16, 2024, 17:21
It seems that here, we try to add a feature for setting a homotopy parameter theta
that can depend on time in a very specific way.
Instead, the user could do the following:
call the homotopy parameter parameter Real theta_
and add an input input Real theta(fixed=true)
to the Modelica file.
Then overwrite the homotopy_options
method to set homotopy_parameter
to theta_
.
Then extend the priority_started method to calculate theta.
This method could look as follows.
def priority_started()
... # usual stuff
theta_ = self.parameters()["theta_"]
times = ...
theta = ... # calculate theta
self.set_timeseries("theta", times, theta)
In GitLab by @SGeeversAtVortech on May 16, 2024, 11:51
This branch introduces ways to adjust the list of goals during optimization and making it depend on for example the homotopy parameter. It also enables the homotopy parameter theta to depend on time.
This branch seems unnecessary, since there are simpler ways to implement these properties without adding additional features to rtc-tools; see, for example, the comments in this MR and https://gitlab.com/deltares/bos-rijnland/-/merge_requests/42.