1. 25 Sep, 2018 11 commits
    • 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
      b4141be4
    • 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).
      d3e1d3a8
    • 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.
      efbe3e71
    • 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.
      e7b7c863
    • 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.
      c103e18f
    • 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.
      c19ab862
    • 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.
      e9e4ecfa
    • 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.
      8ece605d
    • 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.
      f7d3b695
    • Tjerk Vreeken's avatar
      ad7366d0
    • 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
      solver_options().
      8045046a
  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 3 commits