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.
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.
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.
Thanks for your response @Cliff King.
I agree that the first place to handle the valid values would be in the upper & lower bounds of the variables. But these are constraints in combination with multiple variables.
For the logical keywords in the constraint equation, we already tried these possibilities (AND, and, &, &&, OR, or, |, ||) which did not work; the error message was - error in constraint equation.
Yes, for == the correct form is =.
The question still is why OptQuest in FlexSim HC does not allow the AND, OR keywords in the constraint equation? The OptQuest documentation and OptQuest with other simulation engines shows examples of using these keywords.
@jordan.johnson will you please look into Ranjith's claim that the AND, OR keywords work in OptQuest and other simulation engines, but not in FlexSim HC. Thanks!
OptQuest doesn't accept plain < or >, only >= or <=. Be sure to use those variations.
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.
Thanks for your response Jordan.
We investigated the use of OR & AND further and found that it does work when the decision variable is associated with enabling/disabling the Patient Arrival Object. This does not work even when the decision variable to represented as integer instead of binary. The OR works fine when the decision variable is for example the number of resources in a group.
We did not try your work around. As an alternative, we are creating individual model files with different settings to enable our analysis.
11 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved