rtc-tools 2.7.0b1__py3-none-any.whl → 2.7.0b2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rtc-tools might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rtc-tools
3
- Version: 2.7.0b1
3
+ Version: 2.7.0b2
4
4
  Summary: Toolbox for control and optimization of water systems.
5
5
  Home-page: https://oss.deltares.nl/web/rtc-tools/home
6
6
  Download-URL: http://github.com/deltares/rtc-tools/
@@ -25,7 +25,7 @@ Classifier: Operating System :: Unix
25
25
  Classifier: Operating System :: MacOS
26
26
  Requires-Python: >=3.9
27
27
  License-File: COPYING.LESSER
28
- Requires-Dist: casadi!=3.6.6,==3.6.*,>=3.6.3
28
+ Requires-Dist: casadi!=3.6.6,<=3.7,>=3.6.3
29
29
  Requires-Dist: numpy>=1.16.0
30
30
  Requires-Dist: scipy>=1.0.0
31
31
  Requires-Dist: pymoca==0.9.*,>=0.9.1
@@ -1,6 +1,6 @@
1
- rtc_tools-2.7.0b1.dist-info/licenses/COPYING.LESSER,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
1
+ rtc_tools-2.7.0b2.dist-info/licenses/COPYING.LESSER,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
2
2
  rtctools/__init__.py,sha256=91hvS2-ryd2Pvw0COpsUzTwJwSnTZ035REiej-1hNI4,107
3
- rtctools/_version.py,sha256=qpi8lYqShCC9PmcMx5KMwsdJ9rzUpVeHLRvr9yxv_9E,499
3
+ rtctools/_version.py,sha256=q6k6Ps4WmLJhRlFVFHRR2NkjStRHaA6InzR0-8rVGpA,499
4
4
  rtctools/rtctoolsapp.py,sha256=VvoOgpu1R5vzaQsUzBjyB4uPenMv2yWukcA6N9KDEr8,4275
5
5
  rtctools/util.py,sha256=PaeKfDUA174ODZbY5fZjCTf-F-TdhW7yEuP189Ro190,9075
6
6
  rtctools/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -19,9 +19,9 @@ rtctools/data/interpolation/bspline.py,sha256=qevB842XWCH3fWlWMBqKMy1mw37ust-0Yt
19
19
  rtctools/data/interpolation/bspline1d.py,sha256=HAh7m5xLBuiFKzMzuYEqZX_GmCPChKjV7ynTS6iRZOc,6166
20
20
  rtctools/data/interpolation/bspline2d.py,sha256=ScmX0fPDxbUVtj3pbUE0L7UJocqroD_6fUT-4cvdRMc,1693
21
21
  rtctools/optimization/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- rtctools/optimization/collocated_integrated_optimization_problem.py,sha256=qr_Ii_K71zzX48cDwYFD37QpQsh5CsBBiC88uroIEqI,131270
23
- rtctools/optimization/control_tree_mixin.py,sha256=CC6TWp3kFQgMokx6213pRLx9iY17Fd0VcwG4Wpwa0Uo,8974
24
- rtctools/optimization/csv_lookup_table_mixin.py,sha256=JUAwYiOd0FPh-jLmPkfeT2i_3j8VLuBfi3i5UtwfVoU,17325
22
+ rtctools/optimization/collocated_integrated_optimization_problem.py,sha256=gB1RgEsOSgb745NxSosDqjBEJZI_ULtjlHZcuCcRjO4,131267
23
+ rtctools/optimization/control_tree_mixin.py,sha256=ZMMH7Xy_qIVXeLDNtPdXQ8o_0ELRYVdM5QK2R8YulKU,9036
24
+ rtctools/optimization/csv_lookup_table_mixin.py,sha256=TUYAT-u-mzH6HLP0iJHnLBVqV5tWnhYAqDC4Aj17MJg,17399
25
25
  rtctools/optimization/csv_mixin.py,sha256=_6iPVK_EJ8PxnukepzkhFtidceucsozRML_DDEycYik,12453
26
26
  rtctools/optimization/goal_programming_mixin.py,sha256=vdnKnz1Ov3OFN-J9KQiiAwHbrLjWH6o_PeZz2YfLz6k,33320
27
27
  rtctools/optimization/goal_programming_mixin_base.py,sha256=qJQQcJlJdio4GTcrKfuBi6Nho9u16pDuuprzK0LUyhA,43835
@@ -33,7 +33,7 @@ rtctools/optimization/linearized_order_goal_programming_mixin.py,sha256=LQ2qpYt0
33
33
  rtctools/optimization/min_abs_goal_programming_mixin.py,sha256=WMOv9EF8cfDJgTunzXfI_cUmBSQK26u1HJB_9EAarfM,14031
34
34
  rtctools/optimization/modelica_mixin.py,sha256=b_VsEcg_VsAnODnTQybrY0GbuZUNQ3uugQmML6FlklE,18037
35
35
  rtctools/optimization/netcdf_mixin.py,sha256=-zkXh3sMYE50c3kHsrmUVGWMSFm-0cXQpGrCm0yn-Tc,7563
36
- rtctools/optimization/optimization_problem.py,sha256=qzpc81NaZMeoXKuayFmBF15iXYuNAk5yxmaER_Gcz_A,44131
36
+ rtctools/optimization/optimization_problem.py,sha256=lTk4tUBEb1xy9eyNy7-w0D6L6HxSCJ0MyvxjzrYLsR4,44824
37
37
  rtctools/optimization/pi_mixin.py,sha256=G_6RPlXO-IOjqYxNsMZGY4fmnfxVpwN-_T5Ka3rDwK4,11788
38
38
  rtctools/optimization/planning_mixin.py,sha256=O_Y74X8xZmaNZR4iYOe7BR06s9hnmcapbuHYHQTBPPQ,724
39
39
  rtctools/optimization/single_pass_goal_programming_mixin.py,sha256=Zb9szg3PGT2o6gkGsXluSfEaAswkw3TKfPQDzUrj_Y4,25784
@@ -43,8 +43,8 @@ rtctools/simulation/csv_mixin.py,sha256=rGDUFPsqGHmF0_dWdXeWzWzMpkPmwCNweTBVrwSh
43
43
  rtctools/simulation/io_mixin.py,sha256=WIKOQxr3fS-aNbgjet9iWoUayuD22zLIYmqlWEqxXHo,6215
44
44
  rtctools/simulation/pi_mixin.py,sha256=_TU2DrK2MQqVsyrHBD9W4SDEuot9dYmgTDNiXkDAJfk,9833
45
45
  rtctools/simulation/simulation_problem.py,sha256=v5Lk2x-yuVb5s7ne5fFgxONxGniLHTyTR0XRzYRl1fw,50005
46
- rtc_tools-2.7.0b1.dist-info/METADATA,sha256=8hM5-9gf_vYP6z514La_JRMsPIbT5qIhSxSTUgKc-Jc,1776
47
- rtc_tools-2.7.0b1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
48
- rtc_tools-2.7.0b1.dist-info/entry_points.txt,sha256=DVS8sWf3b9ph9h8srEr6zmQ7ZKGwblwgZgGPZg-jRNQ,150
49
- rtc_tools-2.7.0b1.dist-info/top_level.txt,sha256=pnBrb58PFPd1kp1dqa-JHU7R55h3alDNJIJnF3Jf9Dw,9
50
- rtc_tools-2.7.0b1.dist-info/RECORD,,
46
+ rtc_tools-2.7.0b2.dist-info/METADATA,sha256=oX-1OeQXLeE-4_UnDJE9DPRSgFJb3FTER2mk2EByFOw,1774
47
+ rtc_tools-2.7.0b2.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
48
+ rtc_tools-2.7.0b2.dist-info/entry_points.txt,sha256=DVS8sWf3b9ph9h8srEr6zmQ7ZKGwblwgZgGPZg-jRNQ,150
49
+ rtc_tools-2.7.0b2.dist-info/top_level.txt,sha256=pnBrb58PFPd1kp1dqa-JHU7R55h3alDNJIJnF3Jf9Dw,9
50
+ rtc_tools-2.7.0b2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.7.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
rtctools/_version.py CHANGED
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2025-04-15T16:04:52+0200",
11
+ "date": "2025-04-23T08:24:20+0200",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "941763cc3e1c0ee1b9644aaa5dee37d25fd3b02c",
15
- "version": "2.7.0b1"
14
+ "full-revisionid": "1c7b20a741febcb81ad1b0b00a5a5d4ece276e13",
15
+ "version": "2.7.0b2"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -2043,9 +2043,7 @@ class CollocatedIntegratedOptimizationProblem(OptimizationProblem, metaclass=ABC
2043
2043
  def controls(self):
2044
2044
  return self.__controls
2045
2045
 
2046
- def _collint_get_lbx_ubx(self, count, indices):
2047
- bounds = self.bounds()
2048
-
2046
+ def _collint_get_lbx_ubx(self, bounds, count, indices):
2049
2047
  lbx = np.full(count, -np.inf, dtype=np.float64)
2050
2048
  ubx = np.full(count, np.inf, dtype=np.float64)
2051
2049
 
@@ -2210,7 +2208,7 @@ class CollocatedIntegratedOptimizationProblem(OptimizationProblem, metaclass=ABC
2210
2208
  count = max(count, control_indices_stop)
2211
2209
 
2212
2210
  discrete = self._collint_get_discrete(count, indices)
2213
- lbx, ubx = self._collint_get_lbx_ubx(count, indices)
2211
+ lbx, ubx = self._collint_get_lbx_ubx(bounds, count, indices)
2214
2212
  x0 = self._collint_get_x0(count, indices)
2215
2213
 
2216
2214
  # Return number of control variables
@@ -2326,7 +2324,7 @@ class CollocatedIntegratedOptimizationProblem(OptimizationProblem, metaclass=ABC
2326
2324
  offset += 1
2327
2325
 
2328
2326
  discrete = self._collint_get_discrete(count, indices)
2329
- lbx, ubx = self._collint_get_lbx_ubx(count, indices)
2327
+ lbx, ubx = self._collint_get_lbx_ubx(bounds, count, indices)
2330
2328
  x0 = self._collint_get_x0(count, indices)
2331
2329
 
2332
2330
  # Return number of state variables
@@ -3112,7 +3110,7 @@ class CollocatedIntegratedOptimizationProblem(OptimizationProblem, metaclass=ABC
3112
3110
  variable_to_all_indices = {k: set(v) for k, v in indices[0].items()}
3113
3111
  for ensemble_indices in indices[1:]:
3114
3112
  for k, v in ensemble_indices.items():
3115
- variable_to_all_indices[k] |= v
3113
+ variable_to_all_indices[k] |= set(v)
3116
3114
 
3117
3115
  if len(inds_up) > 0:
3118
3116
  exceedences = []
@@ -86,6 +86,11 @@ class ControlTreeMixin(OptimizationProblem):
86
86
  logger.debug("ControlTreeMixin: Branching times:")
87
87
  logger.debug(self.__branching_times)
88
88
 
89
+ # Avoid calling constant_inputs() many times
90
+ constant_inputs = [
91
+ self.constant_inputs(ensemble_member=i) for i in range(self.ensemble_size)
92
+ ]
93
+
89
94
  # Branches start at branching times, so that the tree looks like the following:
90
95
  #
91
96
  # *-----
@@ -122,18 +127,16 @@ class ControlTreeMixin(OptimizationProblem):
122
127
  for forecast_variable in options["forecast_variables"]:
123
128
  # We assume the time stamps of the forecasts in all ensemble
124
129
  # members to be identical
125
- timeseries = self.constant_inputs(ensemble_member=0)[forecast_variable]
130
+ timeseries = constant_inputs[0][forecast_variable]
126
131
  els = np.logical_and(
127
132
  timeseries.times >= branching_time_0, timeseries.times < branching_time_1
128
133
  )
129
134
 
130
135
  # Compute distance between ensemble members
131
136
  for i, member_i in enumerate(branches[current_branch]):
132
- timeseries_i = self.constant_inputs(ensemble_member=member_i)[forecast_variable]
137
+ timeseries_i = constant_inputs[member_i][forecast_variable]
133
138
  for j, member_j in enumerate(branches[current_branch]):
134
- timeseries_j = self.constant_inputs(ensemble_member=member_j)[
135
- forecast_variable
136
- ]
139
+ timeseries_j = constant_inputs[member_j][forecast_variable]
137
140
  distances[i, j] += np.linalg.norm(
138
141
  timeseries_i.values[els] - timeseries_j.values[els]
139
142
  )
@@ -359,6 +359,7 @@ class CSVLookupTableMixin(OptimizationProblem):
359
359
  k=k,
360
360
  monotonicity=mono,
361
361
  curvature=curv,
362
+ ipopt_options={"nlp_scaling_method": "none"},
362
363
  )
363
364
  else:
364
365
  raise Exception(
@@ -314,6 +314,24 @@ class OptimizationProblem(DataStoreAccessor, metaclass=ABCMeta):
314
314
  if log_level == logging.ERROR and not log_solver_failure_as_error:
315
315
  log_level = logging.INFO
316
316
 
317
+ if self.solver_options()["solver"].lower() == "knitro":
318
+ list_feas_flags = [
319
+ "KN_RC_OPTIMAL_OR_SATISFACTORY",
320
+ "KN_RC_ITER_LIMIT_FEAS",
321
+ "KN_RC_NEAR_OPT",
322
+ "KN_RC_FEAS_XTOL",
323
+ "KN_RC_FEAS_NO_IMPROVE",
324
+ "KN_RC_FEAS_FTOL",
325
+ "KN_RC_TIME_LIMIT_FEAS",
326
+ "KN_RC_FEVAL_LIMIT_FEAS",
327
+ "KN_RC_MIP_EXH_FEAS",
328
+ "KN_RC_MIP_TERM_FEAS",
329
+ "KN_RC_MIP_SOLVE_LIMIT_FEAS",
330
+ "KN_RC_MIP_NODE_LIMIT_FEAS",
331
+ ]
332
+ if solver_stats["return_status"] in list_feas_flags:
333
+ success = True
334
+
317
335
  return success, log_level
318
336
 
319
337
  @abstractproperty