Page 700 - ExtendSim User Guide

P. 700

```
674 Analysis
Optimization
part of the possible solution space. You can constrain parameter values in almost an infinite number of ways by entering constraint equations in the Optimizer’s Constraints tab.
There are two types of constraints:
• Individualconstraintsareappliedonlytothespecificvariableandcauseittobechanged in some manner. For example, an individual constraint could cause all tank sizes to be in increments of 1000.
• GlobalconstraintscancauseanentiresetofparameterstoberejectedsothattheOpti- mizer will try a different set. For instance, a global constraint could reject a solution set if the sum of all the variables was greater than a certain value.
For this model the constraints to consider are:
• Deliverytanksonlycomeinsizesthathold1000,2000,3000,4000,6000,or8000drinks. • Tanks can be exchanged every 30 minutes except...
• Tanks with 6000 drinks or greater can’t be exchanged more often than every 60 minutes.
☞ For comparison purposes, a model with constraints titled Optimize 3 is located in the \Exam- ples\Tutorial\Optimization folder.
The constrained tank size
The individual constraint equation to granularize the drink tank sizes recalculates delTankSize as follows:
// round to delivery amounts (e.g. 1k, 2k, 3k, 4k, 6k, 8k)
if (DelTankSize<=4000) DelTankSize = int(DelTankSize/1000.0 +
0.5)*1000.0;
else DelTankSize = int(DelTankSize/2000.0 + 0.5)*2000.0;
☞ Comments are preceded by // and are omitted from the calculation.
This equation puts the tank sizes of 4000 or less into multiples of 1000, and tanks sizes greater than 4000 into multiples of 2000, using an individual constraint. For example, if the Optimizer suggests a size of 3300, the equation would convert it to a potential tank size of 3000. If the suggested size were 5200, the ELSE part of the IF statement would round it up to 6000.
The constrained delivery time
The individual constraint equation to granularize the delivery times is:
// round fillup time to listed delivery times (e.g. 30 minutes)
DeliveryTimes = int(DeliveryTimes/30.0 + 0.5)*30.0;
The delivery time is converted to multiples of 30 minute intervals using an individual con- straint, similar to how the delivery tank size was converted, above.
Global constraints for 6000 and 8000 drink tanks
Although the preceding equation constrains the delivery times for most cases, you also need to reject cases where the drink tank is 6000 drinks or more and the delivery time is less than 60 minutes.
Rather than the individual constraints used in the previous two equations, for this equation you need a global constraint. Delivery times for tanks of 6000 and 8000 drinks are not limited to multiples of a specific number as was true for the tank size; they can be any value as long as it
How To
```