Opened 6 years ago

Last modified 3 years ago

#4979 new defect

An optimization with annotations trouble

Reported by: massimo ceraolo Owned by: Vitalij Ruge
Priority: normal Milestone: Future
Component: Optimization Version:
Keywords: Cc: Willi Braun

Description (last modified by massimo ceraolo)

I know that dynamical optimization is only partially supported.
However, I guess that it is useful to report a simple issue I've seen, when dynamical optimisation with annotatios is used.
Consider the file InputOptIssues enclosed. It contains two models:

  • TimeTable: it finds the optimal value for "torque" variable perfectly. Given the constraints, this is first the max allowed value (90), then the max allower power (9000), then min power, min torque.
  • Trapezoid, nearly identical to timetable, but has as load torque a trapezoid. In this case the Trapezoid output is constantly zero instead of the espected shape. The optimal torque is still found, but it is the one corresponding to zero load torque instead of the expected shape.

To reproduce consider that the two models contain all the relevant options inside annotations. So they can reproduced as follows:

  • load OMedit (using all default options)
  • run TimeTable and see the results
  • run Trapezoid and see the results.

Attachments (1)

InputOptIssues.mo (5.6 KB ) - added by massimo ceraolo 6 years ago.

Download all attachments as: .zip

Change History (5)

by massimo ceraolo, 6 years ago

Attachment: InputOptIssues.mo added

comment:1 by Vitalij Ruge, 6 years ago

Cc: Willi Braun added

There some issue with discret values update. The soultion of the Trapezoid is wrong.
I'm not sure if I can fixed it by my self.

comment:2 by massimo ceraolo, 3 years ago

Description: modified (diff)

comment:3 by Francesco Casella, 3 years ago

comment:4 by massimo ceraolo, 3 years ago

I'm looking forward to seeing whether this PR #8036 solves the trapezoid.mo issue.

Today, while reading this model to try to recall what this models' purpose was, I found that they have a mistake that should have been found by OM before starting to optimise.

Indeed it contains the following rows:

  Real targetPhi(nominal = 1) = -torque2.flange.phi "minimize -pos(tf)" annotation(
    isMayer = true);
  Real constPhi(nominal = 100) = -torque2.flange.phi "minimize -phi(tf)" annotation(
    isLagrange = true);

So we have two different targets! I think OM should not accept multiple targets in a model.

@vitalij, do you think it is sufficiently easy to add this check?
Since the DO code is somewhat low level, having a few checks like this would filter out some of the possible mistakes the user can do.

In this case, the first target requires to maximise phi (in a vehicle it means to cover the largest space possible, given the constraints) the second to maximise the integral of phi. The result of timeTable maximises phi, which is what the model was intended to do.

Note: See TracTickets for help on using tickets.