question

Jay J avatar image
0 Likes"
Jay J asked Joerg Vogel commented

Constraints Equation - check for inequality

How to define Constraints?

FlexSim does not like the 4,5,8

FlexSim 17.2.2
optimizerconstraints
9382-untitled1.png (81.0 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.

1 Answer

·
Ben Wilson avatar image
1 Like"
Ben Wilson answered Joerg Vogel commented

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:

1 1
2 2
3 6
4 7
5 9
6 10

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.

· 4
5 |100000

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

Jay J avatar image Jay J commented ·

MyTable[labelval][1]
Where to put it

0 Likes 0 ·
Ben Wilson avatar image Ben Wilson ♦♦ Jay J commented ·

@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 0 ·
Jay J avatar image Jay J Ben Wilson ♦♦ commented ·

@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 0 ·
example.fsm (70.0 KiB)
Show more comments

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.