OptQuest Optimization

Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

Optimization with OptQuest

OptQuest
Investigating every possible scenario can be extremely time-consuming and in many cases, impossible. OptQuest for Flexsim replaces the inaccuracy of trial-and-error with a potent search engine that pinpoints the best decision. Users can quickly determine what combination of variables results in achieving their objectives. OptQuest incorporates metaheuristics to guide its search algorithm toward better solutions. This approach remembers which solutions worked well and recombines them into new, better solutions. In addition, this technique does not get trapped in local solutions or get thrown off course by noisy (uncertain) model data.

Metaheuristics
Metaheuristics is a family of optimization approaches Metaheuristics that includes scatter search, genetic algorithms, simulated annealing, Tabu search, and their hybrids. Tabu search uses search history and memory uses management to guide the problem-solving process. In its simplest form, memory prohibits the search from reinvestigating solutions that have already been evaluated. In OptQuest, memory functions encourage search diversification and intensification. These memory components divert the search from locally optimal solutions to find a globally optimal solutions. Scatter Search is population-based metaheuristic that Scatter Search operates on a collection of reference points with the goal of finding high-quality solutions to an optimization problem.

Decision Variables
The first part of designing an optimization is to define the decision part of designing an optimization is to define the variables for the model. The main decision variables for an optimization can usually be chosen by restating the problem you want to solve. For example, one problem may be: how many machines do we need in this area to get the best throughput? This statement defines the decision variables for the model, the maximum content value of the processor, and the throughput value of the model. Note that these two variables have different roles. The maximum content is a value we want to change and experiment with, while the throughput is our feedback, reflecting the results of our changes. Examples of decision variable could be; number of forklifts required, the speed of the conveyors, batch size or racks capacity.

Types of Decision Variables


The OptQuest Engine manipulates decision variables in search of their optimal values. There are seven types of decision variables: User-controlled: they are used as output variables to get feedback for output variables how well different scenarios do. Integer: a discrete variable with integer bounds and a step size of 1. Integer: a discrete integer bounds and a step size of 1. Discrete: begins at a lower bound and increments by a step size up to increments an upper bound. Continuous: may take on any value between a user-specified lower value between a user-specified lower bound and upper bound. Binary: a discrete variable with a value of 0 or 1.

Types of Decision Variables


Permutation: used to solve sequencing problems. For example, you Permutation: could use this variable to determine the order in which paint should be mixed to minimize cleanup time between color changes. The value of a permutation variable represents the order within the sequence. Design: Used for decisions where value of the variable represents an value of variable represents alternative, and not a quantity. Design variables are useful in optimization problems where the decision variables consist of choosing the best alternative from a catalog, and a larger number may not imply the commitment of more resources. Therefore, choice #10 may not be a more costly or better choice than choice #1. These variables are defined by a lower bound, an upper bound, and a step size that controls the number of choices available within the specified range.

Decision Variables
To add a decision variable, click on the Add button in the Variables panel. This adds a new variable to the variables table. Select this variable by selecting any cell on the row of the new variable, then click the Modify button. This brings up a window to edit this new variable. Each decision variable has an associated name, which will be used by OptQuest. Each variable also has an associated type, like continuous, integer, or user-controlled. User-controlled variables are the "feedback" variables. They are not changed by the OptQuest experimentation, but are used as output variables to get feedback for how well different scenarios do. All other variable types will be changed and experimented with during the optimization.

Decision Variables
Once you have specified the variable name and type, click on the Browse button to associate this variable with a node in the model. This will open a Tree Browse window to select the node that holds this maximum content value. You must select a node that has number data on it, or the optimization will not work properly.

Constraints
Once you have defined your decision variables, you will want to define constraints for the optimization. During the optimization, the optimizer constraints During the optimization, the optimizer will try several scenarios on the decision variables. Constraints are used to nullify certain scenarios if these constraints are not properly met, so that the optimizer doesn't choose an invalid scenario as the optimum. Each constraint has an expression, such as : Production > 1000 IdlePercentage <= 0.10 TotalCost < 350000 To add a constraint, press the Add button, and then fill in the equations button, column.

Objective Function
The objective function is an expression that you want to maximize or function is an expression that you want to minimize. This could be a simple expression like "Throughput" if you have a decision variable called Throughput. It could also be a revenue vs. cost estimation. For example, if each product produced yields $5.00, and the cost for each machine (weighted by the length of the simulation run) is $50, then the objective function could be "(Throughput*5.00) - (MaxNrofProcessors*50.00)". Some other examples are: Maximize Profits Minimize Picking Times Maximize Production and Minimize WIP

Stop Conditions
Maximum Time for Optimization This is the maximum real time that the optimizer will spend in its optimization. AutoStop If this box is checked, the AutoStop If this box is checked, optimization stops when the value of the objective function stops improving. The Flexsim current setting is to stop when the objective function value of the best solution found does not vary by at least 0.0001 after 100 iterations.

Scenarios
Maximum Scenarios this is the maximum number of different scenarios that the optimizer will try. A scenario is one configuration in the optimizer's search. Current Scenario this is the current scenario number being tested. Current Scenario this is the current scenario number being tested. Current Solution this is the value of the objective function for the Current Solution this is the value of the objective function for current scenario. Best Solution this is the value of the object function for the best the object scenario so far. Simulation Time per Scenario/Real Time per Scenario this is the Time per Scenario/Real Time per Scenario maximum simulation time that the optimizer will spend for each scenario. The optimizer stops a scenario as soon as this is met.

Replications
If you want to run the simulation several times for a given scenario to increase confidence of the mean of the objective function, use the Replications panel to specify how many replications to run.

Perform multiple replications per scenario if this box is checked, the scenario optimizer will perform more that one replication per scenario. Minimum number of replications this is the minimum number of replications to run for each scenario. If there is no Early Exit Criterion then the optimizer will always run the minimum number of replications.

Replications
Maximum number of replications this is the maximum number of replications to run for each scenario. If there is an Early Exit Criterion then the optimizer will run the scenario until the criterion is met, up to this maximum number, after which the optimizer will stop the scenario. Early Exit Criterion this allows the optimizer to stop running further Early Exit Criterion replications for the same scenario, based on the criteria you select. If you've selected "Confidence Interval Satisfied" the optimizer will stop replications once it can determine the objective function's true mean for the scenario with the given confidence and error percentages. For example if you specify an 80% confidence and a 5% error, then the optimizer will stop running replications as soon as it is 80% confident that the true mean of the objective function is within 5% of the mean sampled. If "Best Solution Outside Confidence" is chosen, then the optimizer will stop replications for a given scenario if it can determine, within the given confidence and allowable error percentages, that the best solution can never be met with this scenario.

Optimizing
Once you have configured the parameters, press the Apply button to apply your configuration, then press the Optimize button, and wait until a message appears telling you that the optimization has finished and don't do anything until the optimization has finished.

How many machines of each type do I need to accomplish the maximum profit?
The models has 2 processes. The first part of the process can use two different type of machines, machines type A (up to 7 of them) or machines type B (up to 5) . Each kind has a different process time and operational cost. The faster machines are also the most expensive. At the last part of the process only one kind of machines could be used, machines type C (up to 8) . The inventory between the first and the second process remains under 31 flowitems due to space constraints. As an assumption all the products are sold when finished.

The model to optimize


Type A machines for the first process. Type A machines for the first process. Process Time= 10 seconds. Process Time= 10 seconds. Operation cost per hour = $4,000 pesos. Operation cost per hour = $4,000 pesos. Quantity of machines = 1 to 7. Quantity of machines = 1 to 7. Type C machines for the final process. Type C machines for the final process. Process Time= 13 seg. Process Time= 13 seg. Operation cost per hour = $3,200 pesos. Operation cost per hour = $3,200 pesos. Quantity of machines = 1 a 8. Quantity of machines = 1 a 8.

Sale price per unit= $45. Sale price per unit= $45.

Type B machines for the first process. Type B machines for the first process. Process Time= 108 seconds. Process Time= 108 seconds. Operation cost per hour = $2,600 pesos. Operation cost per hour = $2,600 pesos. Quantity of machines = 1 to 5. Quantity of machines = 1 to 5.

The best solution automatically found: The best solution automatically found: Use 5 type A machines, 2 type B and 8 type C to get a production Use 5 type A machines, 2 type B and 8 type C to get a production of 2,186 units with a profit of $47,570 pesos. of 2,186 units with a profit of $47,570 pesos.

Data from the last scenario analyzed. Data from the last scenario analyzed.

Minimum and maximum range of the Minimum and maximum range of the quantity of machines to be evaluated. quantity of machines to be evaluated.

Objective Function: Maximize Profit Objective Function: Maximize Profit Profit = Incomes Operational Cost Profit = Incomes Operational Cost Sale Price per unit = $45.00 pesos Sale Price per unit = $45.00 pesos Operational Cost: Machine type A = $4,000 Operational Cost: Machine type A = $4,000 Machine type B = $2,600 Machine type B = $2,600 Machine type C = $3,200 Machine type C = $3,200

After a few minutes 280 different scenarios were After a few minutes 280 different scenarios were analyzed in order to find the biggest profit: analyzed in order to find the biggest profit: $47,570 (Best Solution) $47,570 (Best Solution)

The last analyzed scenario showed The last analyzed scenario showed a lost of $5,540 pesos per hour a lost of $5,540 pesos per hour

More optimization examples

Routing by objects names

Model Layout

Global Table

Routing by objects names


As you know Flexsim default logic always sends the flowitems to the next destination based on the output port number, not the object name. Routing by object name comes handy if you wish to change the routing destinations for one or more objects really easy, because you only have to write the names of the destination on a global table using the sequence you want without having to connect or disconnect the output ports or change the destination ports number on the object itself. This method gives you great flexibility and could be understood and modified by anyone, without Flexsim knowledge.

Explaining the model


There are different processes in this model, each process has its own There are different processes in this model, each process has its own input queue for sending the flowitems to the processors of their own group. input queue for sending the flowitems to the processors of their own group. The Source and the output queue of each process must be connected to The Source and the output queue of each process must be connected to all the possible destinations (input queues, the sink for exiting the system or all the possible destinations (input queues, the sink for exiting the system or even to their own process input queue to be processed again if needed). even to their own process input queue to be processed again if needed). You could add or delete processors for each process. For adding more You could add or delete processors for each process. For adding more processors just connect them to the input queue and output queue and processors just connect them to the input queue and output queue and define the proper process time. No additional code is need. To delete them define the proper process time. No additional code is need. To delete them just select them and press the Delete key. just select them and press the Delete key. Each process has an output queue which sends the flowitems to the next Each process has an output queue which sends the flowitems to the next destination according to the routing of the table. destination according to the routing of the table. Always write exactly the name of the input queue of each process when Always write exactly the name of the input queue of each process when defining the routing sequence on the global table. defining the routing sequence on the global table.

Explaining the model


A warning message will be displayed when running the model if the correct destination cant be found and it will suggest where the mistake could be located and the simulation will stop. On the Global Table, the columns show the name of the process and the column next to them shows the processing time. You can always change the size of the global table for increasing or decreasing the types of products you require and the model will work without further modification. The process times are read from the global table. If a certain product needs to go through the same process more than more than once then you may define a different process time for each stage.

Explaining the model


You can define at the Source the quantity and types of products you You can define at the Source the quantity and types of products you would like the model to run with. Each product type will show an unique would like the model to run with. Each product type will show an unique color. color. There is a label on each flowitem called step created on the Source There is a label on each flowitem called step created on the Source OnCreation Trigger in order to keep track of the current process step. OnCreation Trigger in order to keep track of the current process step. Custom code is only found in the Send To Port option at the Flow Tab of Custom code is only found in the Send To Port option at the Flow Tab of the Source and the output queues. This option is called Routing according the Source and the output queues. This option is called Routing according to the global table. You only need to write there the name of the global to the global table. You only need to write there the name of the global table which should be used for routing. table which should be used for routing. If you would like to explore this custom code press the code button that If you would like to explore this custom code press the code button that shows the A letter, and you will find something as follows shows the A letter, and you will find something as follows

Send To Port Custom Code


treenode item = parnode(1); treenode current = ownerobject(c); /**Routing according to the global table: */ string table = /**/ "routing" /**/; /** \nThe global table must have the names of the each product destination written on the proper column.*/ // increment by one the flowitem label called "step": inc(label(item,"step"),1); // define variable producto according to the itemtype number: int product = getitemtype(item); // define the variable row number that will be read from the table with the value of the // label: int row = getlabelnum(item,"step"); // define variable column according to the product which will be read from the global table: int column = (product * 2) - 1; // define a text varible with the name of the next destination according from the table: string next_process_name = gettablestr(table,row,column); // this variable gets the total number of output ports from this object: int total_output_ports = nrop(current); // creates a variable for storing the outport port number of the destionation: int destination = 0;

Continue

// text variable for storign the names of the outpot port objects connected to this object: string compare_name; // were creating a foor loop which be repetead as many times as the total output ports // numbers of this object or until the destination output number is found for(int index=1; index<=total_output_ports; index++) { // this variable stores the name of the object with the output number "index": compare_name = getname(outobject(current,index)); // if the name of the output object match the name of the next destination from the // table... if(comparetext(compare_name,next_process_name)==1) { destination = index; // then the destination is found (which is correct // output port number) index = total_output_ports; // this breaks the loop condition in order to // exit from it } // if the destionation is not found and all the possible loops were evaluated... if(destination==0 && index==total_output_ports) { // we send a warning message with some information of where the error could be found // and stop the model run. if(msg(concat("Routing not found for product ", numtostring(getitemtype(item),0,0)), concat("Check name on column ", numtostring(column,0,0)," of the table ", table, ". Verify that all the outpot connections are properly set from the object", getname(current)))==1) stop(); } } return destination; // returns the next destination output port number

Finish

Thanks for your attention!

Any additional questions you may have are always welcome: jorgetoucet@flexsim.com.mx

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy