Changes between Version 2 and Version 3 of Documentation/Howto/OptimizeAnyLogicModels


Ignore:
Timestamp:
04/26/11 22:17:41 (10 years ago)
Author:
abeham
Comment:

tbc

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/Howto/OptimizeAnyLogicModels

    v2 v3  
    2525Next we need to go to the "Advanced" section of the properties and configure the experiment loop: perform the parameter retrieval, run the simulation, send the quality back, reset the model and continue with another attempt of retrieving parameters.
    2626
    27 In the "Imports:" section enter following code:
     27The following code samples need to be entered into the respective boxes.
     28
     29==== Imports ====
    2830{{{
    2931#!java
     
    3436}}}
    3537
    36 In the "Additional class code:" section enter following code:
     38==== Additional class code ====
    3739{{{
    3840#!java
     
    6971We 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 ;-)
    7072
    71 Now in the section "Initial experiment setup" we need to initialize our communication driver. Paste the following code:
     73==== Initial experiment setup ====
    7274{{{
    7375#!java
     
    7880The 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).
    7981
    80 In the next section "Before each experiment run" we need to initialize our variables that store the quality and replications and we need to fetch the new parameters. Past the following code:
     82==== Before each experiment run ====
    8183{{{
    8284#!java
     
    8991The call to //getMessage()// will block, that means the simulation will wait here, until we have received a new set of parameters.
    9092
    91 We can leave the next section "Before simulation run" empty, but in the section after that, called "After simulation run" we need to paste following code:
     93==== Before simulation run ====
     94leave this empty
     95
     96==== After simulation run ====
    9297{{{
    9398#!java
     
    100105This calls the cost function in the `Main` object called //meanDailyCost()// in this case. This is the target that we want to optimize (note that we add an increasing penalty term if the customer waiting time is above a certain level).
    101106
    102 Finally in the section "After iteration" we calculate the mean cost among all iterations performed and send that back to !HeuristicLab:
     107==== After iteration ====
    103108{{{
    104109#!java
     
    108113}}}
    109114
    110 We are done here. Save the model. You can now start the !HeuristicLabOptimizationExperiement, although of course it won't do anything but block until it receives parameters.
     115This sends the mean quality of the (possible) replications back to !HeuristicLab. We are done here. Save the model. You can now start the !HeuristicLabOptimizationExperiement, although of course it won't do anything but block until it receives parameters.
    111116
    112117== Preparing the Optimization Problem in !HeuristicLab 3.3 ==