Free cookie consent management tool by TermsFeed Policy Generator

Changes between Version 7 and Version 8 of Documentation/Howto/OptimizeAnyLogicModels


Ignore:
Timestamp:
02/14/13 16:18:16 (11 years ago)
Author:
abeham
Comment:

updated tutorial with changes made in integer-vector bounds

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/Howto/OptimizeAnyLogicModels

    v7 v8  
    1010
    1111=== Optimization Problem ===
    12 Let's talk a little about the optimization problem: There are three players in a supply chain of which the first one produces goods from an unlimited source of resources and the last one sells goods to an unlimited number of customers. Each player maintains an inventory of goods out of which it fulfills the demands of the next player. There are ordering costs, holding costs and shipping costs. The optimization consists of defining parameters of an (s,S) inventory policy. The lower //s// in this policy defines the inventory level at which an order will be placed and the upper //S// defines the level which should be filled by the order. The optimization goal is to minimize the sum of all costs in the chain while satisfying a certain service level which is represented as the customer waiting time. If customers have to wait too long then the solution (aka. the parameters of the policy) is considered infeasible. In total we have 6 decision variables, one target variable and a constraint.
     12Let's talk a little about the optimization problem: There are three players in a supply chain of which the first one produces goods from an unlimited source of resources and the last one sells goods to an unlimited number of customers. Each player maintains an inventory of goods out of which it fulfills the demands of the next player. There are ordering costs, holding costs and shipping costs. The optimization consists of defining parameters of an (s,S) inventory policy. The lower //s// in this policy defines the inventory level at which an order will be placed and the upper //S// defines the level which should be filled by the order. The optimization goal is to minimize the sum of all costs in the chain while satisfying a certain service level which is represented by the customer waiting time. If customers have to wait too long then the solution (aka. the parameters of the policy) is considered infeasible. In total we have 6 decision variables, one target variable and a constraint.
    1313
    1414== Preparing the Simulation Model in !AnyLogic 6 ==
     
    7373}}}
    7474
    75 We have defined a method //getMessage()// that calls our library to get the next message from !HeuristicLab and extract the parameters. You'll notice that here I have put the same text as before in the box "Expression" which is an intentional coincidence ;-)
    76 Also notice that we need to check for invalid configurations, so if the value for the lower bound is greater than that for the upper bound I just swap them.
     75We have defined a method //getMessage()// that calls our library to get the next message from !HeuristicLab and extract the parameters. You'll notice that here I have put the same text as before in the box "Expression" which is an intentional coincidence. Also notice that we need to check for invalid configurations, so if the value for the lower bound is greater than that for the upper bound I just swap them.
    7776
    7877==== Initial experiment setup ====
     
    8382}}}
    8483
    85 The number '''2112''' is important as it is the TCP port that our service will be listening on. This must be reachable by !HeuristicLab through a network connection (yes this means you can run !HeuristicLab on a different computer than your simulation model). You can of course choose another port (basically any number from 1 to 65535, but some numbers like 80 might be used by another application already).
     84The number '''2112''' is important as this will be the TCP port that our simulation model will be listening on. This must be reachable by !HeuristicLab through a network connection (yes this means you can run !HeuristicLab on a different computer than your simulation model). You can of course choose another port (basically any number from 1 to 65535, but some numbers like 80 might be used by another application already).
    8685
    8786==== Before each experiment run ====
     
    136135
    137136==== Client ====
    138 Click on the parameter called "Client" to which currently an `EvaluationServiceClient` is attached and you'll see another box with parameters. Among those is one called "Channel" which is currently null, meaning that it has no value defined. Click on Channel and then click on the pencil icon to give it a value. Choose the `EvaluationTCPChannel` by double clicking it in the emerging dialog. Now type the IP Address of the computer where the simulation will run ("127.0.0.1" in case it will be run on the same computer) and enter the port number (remember we chose "2112" above). Okay we're done with the client.
     137Click on the parameter called "Clients" to see the list of clients. For each simulation model that participates in your experiment you have to add a client to this list. So this means you can optimize your parameters faster if you run the simulation on two separate computers (note however, that you need to use the "Parallel Engine" in your algorithm). Per default only one client is configured. Click on `EvaluationServiceClient` and you'll see another box with parameters. Among those is one called "Channel" which is currently null, meaning that it has no value defined. Click on Channel and then click on the pencil icon to give it a value. Choose the `EvaluationTCPChannel` by double clicking it in the emerging dialog. Now type the IP Address of the computer where the simulation will run ("127.0.0.1" in case it will be run on the same computer) and enter the port number (remember we chose "2112" above). Then we're done with the client.
    139138
    140139Next we'll configure the parameter Evaluator. Click on this parameter to get its list of parameters.
     
    150149 * `UniformOnePositionManipulator`
    151150
    152 If you click on the just added `UniformOnePositionManipulator` you'll see two more parameters called Maximum and Minimum. We can either add a value to them here, or add a parameter at a higher level (e.g. at the problem level). So let's add two `ValueParameter<T>` and choose `IntValue` for `T`. Name one of them "Minimum" and the other "Maximum". Choose the value 1 for Minimum and 100 for Maximum.
     151If you click on the just added `UniformOnePositionManipulator` you'll see one parameter called Bounds. We can either add a value to it here, or add a parameter at a higher level (e.g. at the problem level). In this case other operators might also be configured with the same bounds, so it's beneficial to add and configure them at the problem level. Let's add a `ValueParameter<T>`, choose `IntMatrix` for `T` and name it "Bounds" (the dialog to select a type for T may take some time to show up). Make the matrix 1 row and 3 columns and put "1", "101", "1" in those columns. The first column represents the minimum, the second column the exclusive maximum, and the third column holds a step size. So the values can only ever be multiples of that step within that range.
    153152
    154153Now click on and configure the last parameter called !SolutionCreator
    155154
    156155==== !SolutionCreator ====
    157 Click the yellow plus icon and add a `UniformRandomIntegerVectorCreator`. Click on it to see its parameters. You'll note there is an additional one called "Length". Let's add a new `ValueParameter<T>` just like Minimum and Maximum but called Length to the problem's parameters and give it the value 6, because we have six parameters to optimize. You should save the clipboard now to save the problem within it (you can also save the problem to a separate file if you want).
     156Click the yellow plus icon and add a `UniformRandomIntegerVectorCreator`. Click on it to see its parameters. You'll note there is an additional one called "Length". Let's add a new `ValueParameter<T>` to our problem, just like Bounds but called Length and with "IntValue" as its type T. Give this parameter the value 6, because we have six parameters to optimize. You should save the clipboard now to save the problem within it (you can also save the problem to a separate file if you want).
    158157
    159158=== Choosing an Algorithm ===
    160159
    161 We're now done with the problem. We have added a crossover operator and a mutator so we're somewhat limited to a Genetic Algorithm or one of its variants. Algorithms like Tabu Search need more complex operators.
    162 
    163 So create a new Genetic Algorithm by choosing "New" from the File menu.
     160We're now done with the problem. We have added a crossover operator and a mutator so we're somewhat limited to a Genetic Algorithm or one of its variants. So create a new Genetic Algorithm by choosing "New" from the File menu.
    164161
    165162Drag the problem from the clipboard onto the problem tab of the GA that we have just created. Go to the parameters tab and select the mutator that we have added (no mutator is chosen by default).