Constraints Equation - check for inequality

Constraints Equation - check for inequality

jay_j
Not applicable
16 Views
5 Replies
Message 1 of 6

Constraints Equation - check for inequality

jay_j
Not applicable

[ FlexSim 17.2.2 ]

How to define Constraints?

FlexSim does not like the 4,5,8

9389-9382-untitled1.png

0 Likes
Accepted solutions (1)
17 Views
5 Replies
Replies (5)
Message 2 of 6

Ben_WilsonADSK
Community Manager
Community Manager
Accepted solution

OptQuest doesn't allow you to specify a "not equal to" constraint.

Comparisons allowed by OptQuest for constraints are greater-than-or-equal to (>=) and less-than-or-equal-to (<=).

Given these rules imposed by the underlying optimization engine, I can't think of a way to implement your constraint requirements as-is.

Constraints are actually a less efficient way to disallow certain input, anyway, because the optimizer will still use the full range of [Variable1] when generating solutions, and then compare those solutions against the defined constraints, throwing out solutions that are out of bounds, thereby wasting the time it took to find that solution.

A more efficient approach will require you to modify your model logic a bit, but will work and also scale better.

Instead of defining your input data in terms of constraints, better would be not to include bad values as inputs at all.

Say your [Variable1] is a label, and valid values are [1, 2, 6, 7, 9, 10]. Right now you're allowing the optimizer to directly set values 1-10 on your label, then generate solutions for all these values, than throw out those that don't meet the constraint criteria. Better would be to use a table to map from the value chosen by OptQuest to the set of valid inputs that you define:

11
22
36
47
59
610

OptQuest could still reference [Variable1] as that same label, but you change the variable bounds to 1-6. Then instead of using the label's value directly, anywhere that you referred to that label, you would instead do a table lookup, using the label value as the lookup row:

MyTable[labelval][1]

In this way you are mapping the optimizer's chosen value to a set of valid inputs.

Comment back if you have any questions.

Message 3 of 6

jay_j
Not applicable

MyTable[labelval][1]
Where to put it

0 Likes
Message 4 of 6

Ben_WilsonADSK
Community Manager
Community Manager

@Jay J,

Anywhere that you referred to that label's value, you would instead do a table lookup, using the label's value as the row of the lookup.

0 Likes
Message 5 of 6

jay_j
Not applicable

@Ben Wilson
example.fsm
Some product can not do some machines
I use pull strategy
EX. Product1 can use machine 1, 2, 6, 7, 9, 10
Product2 can use machine 1, 2, 5, 6, 8, 10
I do not know where to put the code you put into the model. Can you give me an example.


Regards

0 Likes
Message 6 of 6

joerg_vogel_HsH
Mentor
Mentor

Please ask a new question. This is a question about the pull requirement instead of OptQuest. Some other users wouldn't associate an indirectly pull requirement with an OptQuest question. You can tell the community that the new question is related to this answer. Thank you.