question

Ranjith Tellis avatar image
1 Like"
Ranjith Tellis asked Ranjith Tellis commented

OptQuest + FlexSim HC: add logical constraints?

Hi All,

We are using OptQuest with Flexsim HC v5.3.4. How can we add logical constraints to OptQuest?

For example:

Var1 == 1 and Var2 == 1 and Var3 == 0 and Var4 == 0

(Var1 == 1 and Var2 == 1) OR (Var3 == 1 and Var4 == 1)

thanks.

FlexSim HC 5.3.4
flexsim hcoptquestconstraints
5 |100000

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

Cliff King avatar image
1 Like"
Cliff King answered Jordan Johnson commented

In general, you should limit the number and complexity of the constraints you define in OptQuest. You're better off defining the constraints (especially if they are constraints on the input variables) within the model itself, using script; rather than have OptQuest waste its time running invalid runs (i.e. runs that don't satisfy the constraints). If the the contraints are a function of the input variables, are you sure you can't better handle them with the lower and upper bounds of the variables themselves? Typically contraints are a function of the PFM's such as LOS < 1440.

I haven't been able to find anyone here who has defined complex contraint logic using AND and OR, but capital AND and OR should work. My suggestion is to test it and see. It's also possible == doesn't work, or at least it doesn't make sense to have constraints that match a specific value (once again, you ought to be able to handle this with the upper/lower limit bounds and/or model script). Try using <=, >=, <, and > only.

· 3
5 |100000

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

Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Ranjith Tellis commented

OptQuest does support using the AND and OR keywords. There could be a bug in our interface with OptQuest, but I am unable to replicate it. If you could post a model, we will be able to investigate the issue. If you want, you can mark the question as private, so that only we here at FlexSim can see the model.

As a workaround for now, you can proceed by creating performance measure called Failed that is just the value of a node in tree. You can set that node to 0 on reset, and then, at time 0 in the model, have a user event that analyzes the variable values. If they meet your requirements, leave the flag alone, and proceed. If they fail, then set the Failed node value to 1, and call the endreplication() command. Be sure to add a simple constraint: Failed <= 0. That way, you don't have to execute a model run just to find out if the variables were invalid. This approach allows you to use FlexScript to define your constraints, which can be more flexible.

· 1
5 |100000

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