question

anon-user avatar image
0 Likes"
anon-user asked Felix Möhlmann answered

Why is constraint not working in opt quest?

Hi FlexSim Team,

I am currently experiencing an issue with the constraints in the OptQuest of my model. So Im creating a test model to solve this issue.

In the attached model, I'm trying to find a sequence using the optimizer with a constraint value equal to 0. The expectation from the optimizer is that it should not give a solution sequence which is having a constraint value equal to one.

The sequence is simple [1,2] and for the sequence when the first value is 2, then Im setting the constraint parameter to 1 and when the first value is 1, then Im setting the constraint parameter to 0.

Strangely the optimizer is picking the sequence where the parameter is equal to 1, but it should not be as per the optimization design. What could be the reason?

I have added the code to the model reset.

I would greatly appreciate your assistance in identifying the root cause of the problem and finding a solution.

Best regards, Brijesh Kumar

FlexSim 23.1.1
optquest
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered

Your reset code would have to be executed while the Optimizer is making a choice about the parameters that are used next.

As far as I'm aware the order is: Choose the parameter (while evaluating any constraints), then reset the model. All the contraint is currently doing is to stop the Optimizer from setting the Flag parameter to 0 by itself.

Results are probably all valid because the constraint deals with a parameter and so it is not reevaluated at the end of a replication. If you clone the parameter to a performance measure and use that in the constraint function, the result window will show which replications are infeasible.

1682517669225.png

If you want to mandate fixed points in the sequence I see two options:

- Reduce the sequence to the length that is actually variable and then construct a new sequence array from the known fixed part and the generated part to use in the simulation run. This would be equivalent to the Optimizer to being able to choose ineligible sequences.

- Compare the chosen sequence to the mandated constraints at the start of the model run. If they are not adhered to, end the replication immediately (endreplication(1)) to save time. So the Optimizer can choose ineligible sequences, but the simulation will abort at the start. (Infeasible iterations at 0 throughput)

1682517909978.png

sequence_fm.fsm


1682517669225.png (22.5 KiB)
1682517909978.png (24.8 KiB)
sequence-fm.fsm (101.9 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.