1. 13 Dec, 2018 4 commits
  2. 12 Dec, 2018 1 commit
  3. 07 Dec, 2018 1 commit
    • Tjerk Vreeken's avatar
      Fix interpolation call in map_path_expression · 2d4a1c73
      Tjerk Vreeken authored
      This could lead to an exception being thrown by CasADi, because the
      integer for "mode" would be passed as the boolean for "equidistant". We
      are lucky that there was no implicit casting of int->bool, or this would
      have turned into an obscure bug.
  4. 26 Nov, 2018 1 commit
  5. 22 Nov, 2018 5 commits
    • Tjerk Vreeken's avatar
      Fix failing constraint() call before optimize() · b9a30ca4
      Tjerk Vreeken authored
      When using GoalProgrammingMixin, it was not possible to call constraint()
      or path_constraints() in e.g. pre(). This is because the subproblem
      constraint variables were not fully initialized yet; they were not
      indexable with "ensemble_member". Only when optimize() was called were
      the variables properly initialized.
    • Tjerk Vreeken's avatar
      Fix reading symbolic nominals in ModelicaMixin · 5b1d8e4e
      Tjerk Vreeken authored
      Earlier on in the affected method we cast to make sure that we always deal
      with a ca.MX instance. However, the substitute call is likely to return a
      ca.DM, which would then fail later on when calling ".to_DM()" on it.
      Closes #1081
    • Jesse VanderWees's avatar
      Properly handle LookupTable __call__() parameters · 0b4c7cf9
      Jesse VanderWees authored
      The handling of LookupTable __call__() parameters was somewhat sloppy,
      without clear error codes if parameters were not supported. Furthermore,
      calling with np.nan would expose undefined behaviour. This commit
      improves error messages and does explicit handling of np.nan parameters.
    • Jorn Baayen's avatar
      PIMixin: Output PI files with time stamps from times() method · 9ceda84d
      Jorn Baayen authored
      Similar fix to previous commit.
    • Jorn Baayen's avatar
      CSVMixin: Output CSV files with time stamps from times() method · 968c5456
      Jorn Baayen authored
      The data interpolation assumes that self.times() dictates the time stamps
      for the output data. The time stamps in the CSV output file, however, were
      taken from the input CSV file and not from the times() method. This
      implicitly assumed that self.times() equates the time steps from the CSV
      input file. This is not always the case, as self.times() may be overridden
      by a subclass.
  6. 05 Nov, 2018 4 commits
    • Jesse VanderWees's avatar
      Fix saving function values of critical goals · a1a3e66f
      Jesse VanderWees authored
      Function values of critical goals were not being written to timeseries,
      even when the variable function_value_timeseries_id was set.
    • Teresa Piovesan's avatar
      Fix seed derivatives · 25856836
      Teresa Piovesan authored
      The value of the derivatives of the initial time step and of the extra
      variables is included the seed.
      Closes issue #1066
    • Tjerk Vreeken's avatar
      Fix formatting of broken escape sequences · 0a119b4c
      Tjerk Vreeken authored
      Flake8 only started reporting this formatting error starting with
      version 3.6 (error code W605), causing our test pipeline to fail even
      though there were no changes to the codebase. This commit makes sure
      that the formatting checks pass again.
    • Tjerk Vreeken's avatar
      Fix formatting of default parameters with types · a93ccfdb
      Tjerk Vreeken authored
      According to Python's formatting rules, default parameters without types
      should have no spaces around the equals operator. However, if the type of
      a parameter _is_ specified, spaces around the operator are required. See
      also PEP-3107 for examples of such code.
      Flake8 only started reporting this formatting error starting with version
      3.6 (error code E252), causing our test pipeline to fail even though there
      were no changes to the codebase. This commit makes sure that the
      formatting checks pass again.
  7. 25 Sep, 2018 12 commits
    • Tjerk Vreeken's avatar
      Pin CasADi and Pymoca versions · 89ffc704
      Tjerk Vreeken authored
      These two packages are relatively unstable or known to make
      substantial (backwards-incompatible) changes. We therefore pin them to
      release series known/expected to work, while allowing bug fixes using a
      wildcard specifier.
    • Tjerk Vreeken's avatar
      Change solver_output from 2-D to 1-D array · b4141be4
      Tjerk Vreeken authored
      Most arrays like lbg/ubg/x0 are already 1-D NumPy arrays if they are not
      a CasADi matrix (MX/DM). It therefore makes sense if the output of the
      solver is also a 1-D array, requiring only a single index to be
      specified to get an element (instead of X[i, 0]).
      We ensure that the results dictionary does not present views onto the
      raw solver_output by making a full copy of it first. This is just a
      safeguard though, as it is undefined behavior what should happen if
      someone changes the arrays in the results like that.
      Contrary to the previous type annotation, the solver output was already
      a numpy array (a 2-D one, see commit 40875b0a).
      Closes #1064
    • Tjerk Vreeken's avatar
      Rename constraint_relaxation to violation_relaxation · d3e1d3a8
      Tjerk Vreeken authored
      The "constraint_relaxation" name was confusing, as the relaxation is
      only indirectly applied to the eventual hard constraint (i.e. it is
      scaled by the goal's function nominal as well). The term
      violation_relaxation much better describes that this relaxation is
      applied to the violation variables (a.k.a. epsilons).
    • Tjerk Vreeken's avatar
      Inlude function_range in repr() of StateGoal · efbe3e71
      Tjerk Vreeken authored
      The function_range was already added to the repr() of Goal, but not to
      StateGoal yet. We add it there as well to provide helpful information
      when e.g. the function_range derived from the bounds and the target
      min/max do not agree.
    • Tjerk Vreeken's avatar
      Improve goal scale by problem size · e7b7c863
      Tjerk Vreeken authored
      The weighing of goals and path goals should not depend on whether they are
      part of the objective or path objective. To make sure it does not, we have
      to divide both objectives by the _total_ number of subproblem objectives.
    • Tjerk Vreeken's avatar
      Fix scale_by_problem_size for path target goals · c103e18f
      Tjerk Vreeken authored
      If a path goal has a target min and/or max, the epsilon will be handled in
      the normal objective (not path_objective()). We therefore have to make
      sure to also divide by the number of time steps after summing an epsilon
      over time if the user has enabled the "scale_by_problem_size" options.
    • Tjerk Vreeken's avatar
      Fix big-M in mixed integer example · c19ab862
      Tjerk Vreeken authored
      Similar to the big-M fix for the goal proramming example done in
      commit a1101002.
    • Teresa Piovesan's avatar
      Make fix_minimized_values False for non-default solvers · e9e4ecfa
      Teresa Piovesan authored
      Solvers like Gurobi and CPLEX cannot handle quadratic equality
      constraints. The default value for fix_minimized_values being True might
      therefore lead to issues if more than one minimization goal is present.
      To provide backwards compatibility, we make sure that the default value
      of True is preserverd for IPOPT and BONMIN. Only in the case that the
      user overrides the solver will the default value be False.
    • Teresa Piovesan's avatar
      Handle fix_minimized_values for normal goals · 8ece605d
      Teresa Piovesan authored
      The fix_minimized_values goal programming option only affected path
      goals. The same logic should however apply to normal goals.
    • Teresa Piovesan's avatar
      Fix goal relaxation with minimization goals · f7d3b695
      Teresa Piovesan authored
      The default value for fix_minimized_values is True, and therefore a goal
      relaxation on minimization goals would result in two constraints, one of
      which would be possibly non-convex.
      The idea behind fix_minimized_values is to impose a possibly non-convex
      _equality_ constraint for interior point methods, to avoid numerical
      issues with small slack variables. We therefore now check if the goal
      has any relaxation, in which case we impose a single inequality
      constraint instead of a single equality constraint.
    • Tjerk Vreeken's avatar
    • Jesse VanderWees's avatar
      Doc note in MI example about solver support · 8045046a
      Jesse VanderWees authored
      Solver support is a FAQ not adequately addressed in the documentation.
      We add a note to the mixed-integer example directing people to
  8. 03 Sep, 2018 1 commit
  9. 27 Aug, 2018 2 commits
  10. 24 Aug, 2018 9 commits
    • Tjerk Vreeken's avatar
      Simulation: opt-in partial workaround for delay() · 1ca2c04d
      Tjerk Vreeken authored
      A workaround is added to support a delay of zero (or make delay expression
      behave as such). By default, this workaround is disabled. The user has to
      explicitly set "_force_zero_delay" to True to enable it.
    • Teresa Piovesan's avatar
      Doc fix goal function range/nominals · f413630d
      Teresa Piovesan authored
      Add explanation on how the function range and function nominal are used
      for minimization goals vs target goals. This also fixes consistency with
      the check introduced in commit e9f500d7.
    • Jorn Baayen's avatar
      Return ca.MX(0) by default in objectives/residuals · db12302f
      Jorn Baayen authored
      Because `ca.MX() + 1 = ca.MX()`, returning an empty symbol could be
      confusing if people override e.g. self.objective().
    • Jorn Baayen's avatar
      CollInt: Handle MX objective with 0x0 shape · 3bb2217b
      Jorn Baayen authored
      If self.objective() returns a 0x0 MX, do not use it as a base to add
      path objectives to, as the result would still be 0x0.
      This is due to the fact that `ca.MX() + 1 = ca.MX()`.
    • Teresa Piovesan's avatar
      Fix examples to comply to new funct_range check · bb84fbfd
      Teresa Piovesan authored
      User can not specify (anymore) the function range for minimization goals.
      Change the examples to comply with the check introduced in commit
    • Olav van Duin's avatar
      Only do duplicate parameter check for PI-XML · 094cdac4
      Olav van Duin authored
      Before, we would (optionally) check if a parameter read from the PI-XML
      files (rtcParameterConfig*.xml) was already set before. This would lead
      to a warning if a parameter occurred in multiple PI-XML files, but also
      if a value was already present in the model file(s). The latter type of
      warning is unnecessary as we expect parameters to be updated at runtime.
      This commit makes sure that only warnings are raised for duplicates
      found in the PI-XML files.
    • Tjerk Vreeken's avatar
      Improve goal function range vs. targets check · f97a0ab4
      Tjerk Vreeken authored
      We now check that the target min/max are not equal to the function range
      lower bound/upper bound respectively as well.
      A target minimum equal to the lower bound of the function range does not
      make any sense, as the corresponding epsilon is then free (and will
      therefore always become zero). Effectively, the goal will behave as a
      critical goal, and users should use those instead if such behavior is
    • Tjerk Vreeken's avatar
      Disallow function_range for minimization goals · 5f3e17df
      Tjerk Vreeken authored
      Minimization goals only use the function nominal for scaling. Requiring
      the user to specify a function range is misleading.
      Closes #1051
    • Olav van Duin's avatar
      Fix flooring of dates/times in PI-XML import · a2f00aff
      Olav van Duin authored
      Before, we would floor based on the base time (midnight 1-1-1970). This
      would mean that having a start date of e.g. 09:35 and a time step of
      00:15 did not work well together. The start date would get rounded down
      to 09:30 instead of the desired 09:35. This commit makes sure that such
      cases are handled correctly, but that rounding is still performed (e.g.
      09:51 will get rounded down to 09:50).
      Closes #1020