1. 25 Sep, 2018 2 commits
  2. 03 Sep, 2018 1 commit
  3. 27 Aug, 2018 2 commits
  4. 24 Aug, 2018 17 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.
      1ca2c04d
    • 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.
      f413630d
    • 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().
      db12302f
    • 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()`.
      3bb2217b
    • 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
      e9f500df.
      bb84fbfd
    • 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.
      094cdac4
    • 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
      desired.
      f97a0ab4
    • 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
      5f3e17df
    • 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
      a2f00aff
    • Teresa Piovesan's avatar
      Doc fix type of scale_by_problem_size · 9ce64c09
      Teresa Piovesan authored
      9ce64c09
    • Tjerk Vreeken's avatar
      bde691b4
    • Tjerk Vreeken's avatar
      Fix discrepancy between goal and path goal scaling · cd33c423
      Tjerk Vreeken authored
      Path goals were not divided by the number of time steps, meaning that
      formulting a problem with a bunch of normal goals using state_at() (one
      for each time step) and a path goal would lead to different objectives and
      results.
      
      To fix the discrepancy, we disable the division by the number of
      goals/time steps by default. This is conservative in the sense that we
      then guarantee at least as accurate a result as before this commit. For
      very tricky/badly scaled problems it may however lead to convergence
      issues.
      
      Should scaling with the problem size be desired, the new
      "scale_by_problem_size" goal programming option can be set to True.
      
      Closes #1046
      cd33c423
    • Teresa Piovesan's avatar
      399a7f7c
    • Tjerk Vreeken's avatar
      Fix theta parameter availability · 4df6d5bb
      Tjerk Vreeken authored
      When using the HomotopyMixin, a call to parameters() would fail in
      pre(), because the parameter __theta is only initialized in the
      optimize() call.
      
      Also add a comment explaining why we do not initialize theta right away.
      4df6d5bb
    • Tjerk Vreeken's avatar
      Fix parameter inlining for path objective/constraints · 0b6c34f7
      Tjerk Vreeken authored
      When using goal programming, parameters would only get inlined in the
      first priority (i.e. the first call to the transcribe() method).
      
      Note that regular objective and constraints cannot/should not refer to
      parameters with the variable() or state() methods (which return an MX
      symbol), and instead always rely on state_at() and parameters(). The
      latter two always return a numberic value, and we therefore we do not
      need to perform any inlining on the regular objective and constraints.
      0b6c34f7
    • Tjerk Vreeken's avatar
      Fix parameter inlining for delayed expressions · fa49e368
      Tjerk Vreeken authored
      If we inline a parameter, we have to make sure to also inline it in the
      delay expression and duration. The latter was already taken care of
      somewhere else in the code, but has been moved near the newly added
      processing of the delay expressions.
      
      Note that evaluating the delayed_feedback_function() could still
      give non-NaN results even if inputs were missing, which made this bug
      somewhat hard to encounter and track down.
      The fact that this happens is due to the expand() call; if we would call
      the original MX function, it would complain about free variables. Why
      CasADi does not always return NaN for outputs of which not all inputs
      were specified is unknown though.
      fa49e368
    • Tjerk Vreeken's avatar
      Use delay() operator in tests · c3043141
      Tjerk Vreeken authored
      Some tests were already addressed in 14c1702e, but not all.
      c3043141
  5. 04 Aug, 2018 6 commits
  6. 14 Jul, 2018 12 commits
    • Tjerk Vreeken's avatar
      Documentation restore tight x-axis layout · d9d28d8e
      Tjerk Vreeken authored
      Making plots with Matplotlib 2+ has whitespace on both ends of the x-axis,
      which is not what we want. To restore the previous behavior, we explicitly
      tightly scale the x-axis.
      d9d28d8e
    • Tjerk Vreeken's avatar
      1dfcbfb6
    • Tjerk Vreeken's avatar
      b0ba8172
    • Tjerk Vreeken's avatar
      Documentation fix for LinearizationMixin · 060e0247
      Tjerk Vreeken authored
      The documentation page was not referenced, and therefore not listed or
      reachable.
      060e0247
    • Tjerk Vreeken's avatar
      Documentation fix for SimulationProblem · 77c90eb0
      Tjerk Vreeken authored
      Both "finalize" and "get_options" were removed in the conversion from
      JModelica/FMU-based simulation to Pymoca/CasADi-based simulation.
      77c90eb0
    • Tjerk Vreeken's avatar
      Documentation fix for lookup tables · 6ed9fd84
      Tjerk Vreeken authored
      6ed9fd84
    • Tjerk Vreeken's avatar
      Documentation fix for reference to LookupTable · 6bb630e3
      Tjerk Vreeken authored
      Regression in 91af5370.
      6bb630e3
    • Tjerk Vreeken's avatar
      Fix reading csv files in documentation of examples · 90bfb70b
      Tjerk Vreeken authored
      By default, NumPy does not convert bytes to strings. Specifying
      "encoding=None" will use the system default to produce strings.
      
      See also 962659ce, which fixed a similar issue for CSVMixin.
      90bfb70b
    • Tjerk Vreeken's avatar
      Fix goal constraint min/max bounds consistency · 40567dba
      Tjerk Vreeken authored
      It could happen that lower (later) priority goals for an already
      constrained state would result in an answer that would be slightly
      outside the hard constraints due to feasibilty tolerances.
      When combining the soft constraint and existing hard constraint in a new
      hard constraint, the existing hard constraint values could be shifted,
      basically enforcing a solution that may or may not be feasible.
      
      An example for a typical state with goals at multiple priorities:
      
      +----------+------------+------------+
      | Priority | Target Min | Target Max |
      +----------+------------+------------+
      |        1 |        0.0 |        0.7 |
      |        2 |        0.7 |        0.7 |
      +----------+------------+------------+
      
      The first priority could end up with a hard constraint exactly matching,
      i.e. (0.0, 0.7). Exaggerating the numerical differences that can occur,
      the second priority could end up with a value of 0.701 for the state in
      question.
      What would happen before this commit is that we would calculate a new
      hard constraint (0.701, 0.7). This would then be corrected to (0.701,
      0.701), which would then replace the original hard constraint.
      
      It is safer to keep enforcing the old hard constraint (which led to the
      solution of 0.701) making the new constraint (0.7, 0.7). This is the
      behavior that this commit makes happen.
      40567dba
    • Tjerk Vreeken's avatar
      Fix goal consistency and monotonicity checks · 4b82a3ec
      Tjerk Vreeken authored
      If a goal had both a target min and a target max, the latter would not
      get checked for consistency due to the "elif" instead of "if".
      
      The check for target min/max exceedence of the function range compared
      the True/False value returned by has_target_* instead of the actual
      target min/max value.
      
      Furthermore, the monotonicity checks path goals were behind the option
      flag, but those of (normal) goals were not.
      4b82a3ec
    • Tjerk Vreeken's avatar
      Remove linux tags from CI file · 0bf28c2a
      Tjerk Vreeken authored
      This allows us to run using GitLab's runners. If we ever end up running
      Windows docker images, we can then make Windows the exception with a
      "windows" tag.
      0bf28c2a
    • Tjerk Vreeken's avatar
      Fix unwanted conversion to MX in substitute calls · 80c8656b
      Tjerk Vreeken authored
      It could happen that a DM expression would be converted to an MX
      expression, which would then later confuse the solver (e.g. when the
      values are the lower/upper bounds of the constraints).
      
      One example is that when passing as expr a 15x1 DM array of all 293.55
      values, the resulting value would be "MX(all_293.65(15x1))". This in
      turn would confuse the solver call, resulting in an exception.
      80c8656b