Free cookie consent management tool by TermsFeed Policy Generator

Changes between Version 11 and Version 12 of Documentation/Howto/OptimizeExternalApplications


Ignore:
Timestamp:
06/07/10 18:47:05 (14 years ago)
Author:
abeham
Comment:

update

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/Howto/OptimizeExternalApplications

    v11 v12  
    151151== Tutorial ==
    152152
    153 In this tutorial we're going to connect the HeuristicLab 3.3 Optimizer with the Race Car Setup Optimization Competition that was organized for the EvoStar 2010 conference. Unfortunately the submission is already closed for this year, but let's hope there will be another competition hopefully in 2011.
     153In this tutorial we're going to connect the HeuristicLab 3.3 Optimizer with the Race Car Setup Optimization Competition that was organized for the !EvoStar 2010 conference. Unfortunately the submission is already closed for this year, but let's hope there will be another competition hopefully in 2011.
    154154
    155155The problem is a classic "simulation-based optimization problem" so there is a simulator, a simulation model, and several configuration parameters that have to be optimized. Additionally there might or might not be noise present in the evaluation of a configuration. More concretely the simulator is called [http://torcs.sourceforge.net/ TORCS], the simulation model consists of a certain simulated driver that tries to race as fast as possible and the configuration parameters are various settings of the race car that can be tuned. The challenging part in this problem is the limitation of the number of simulation time. Each optimizing run is given a certain number of simulation time in which the best parameter has to be found. Each solution is evaluated with a certain slice of that simulation time. It is possible to choose the size of this slice such that one evaluates a shorter time, with more noise on the quality values, but with a bigger number of possible evaluated solutions or a longer time with less noise, but the algorithm can calculate fewer generations. The driver in the simulation model starts where it left off after the last configuration, so there is some noise that depends on the driver's position on the track and some that depends on the previous configuration, which could have sent the driver off the track.
     
    173173
    174174So, first let's give the problem a proper name and a proper description so that when we load the problem later we know what this is all about.
    175  * In the title type "Race Car Configuration Problem (EvoStar 2010)"
    176  * In the description type "Problem that represents race car configuration challenge of EvoStar 2010"
    177 
    178 Now we want to configure the solution representation and for this purpose we click the operator called '''SolutionCreator''' and get following screen.
     175 * In the title type "Race Car Configuration Problem (!EvoStar 2010)"
     176 * In the description type "Problem that represents race car configuration challenge of !EvoStar 2010"
     177
     178Now we want to configure the solution representation and for this purpose we click the operator called '''!SolutionCreator''' and get following screen.
    179179
    180180[[Image(Tutorial_ConfigureSolutionCreator.png)]]
     
    184184[[Image(Tutorial_TypeSelector.png)]]
    185185
    186 The type selector appears that has the ability to show every HeuristicLab object, but in this case, because the SolutionCreator exposes a list of only `IOperator`s we see a dialog with only operators to choose from. We're interested in creating our solution representation and given that our simulation model expects a vector of real values that describe the car's configuration, we will look into the '''HeuristicLab.Encodings.RealVectorEncoding''' namespace. Click on the "+" infront of that namespace to list all the available operators there.
     186The type selector appears that has the ability to show every HeuristicLab object, but in this case, because the !SolutionCreator exposes a list of only `IOperator`s we see a dialog with only operators to choose from. We're interested in creating our solution representation and given that our simulation model expects a vector of real values that describe the car's configuration, we will look into the '''HeuristicLab.Encodings.!RealVectorEncoding''' namespace. Click on the "+" infront of that namespace to list all the available operators there.
    187187
    188188[[Image(Tutorial_TypeSelector_RealVectorEncoding.png)]]
    189189
    190 That is quite a list of operators, but don't get confused. From the names we can see what they are doing, there are several crossovers, manipulators, and a few other operators. Each of these operators has a description that you can see when you click onto it. The description is very helpful in describing what the operator does and there are even references to publications for operators that are taken from the literature. The one operator we are looking for to create a vector of real values is the '''UniformRandomRealVectorCreator'''. Look for it in the list down the bottom and click OK.
     190That is quite a list of operators, but don't get confused. From the names we can see what they are doing, there are several crossovers, manipulators, and a few other operators. Each of these operators has a description that you can see when you click onto it. The description is very helpful in describing what the operator does and there are even references to publications for operators that are taken from the literature. The one operator we are looking for to create a vector of real values is the '''!UniformRandomRealVectorCreator'''. Look for it in the list down the bottom and click OK.
    191191
    192192[[Image(Tutorial_UniformRandomRealVectorCreator.png)]]
     
    194194Views are usually nested in each other and when you click on the operator you should see its view opening to the right. If you can't see the operator's details due to low screen resolution you can double click the operator and it will open in a completely new view and in a new tab next to the tab of the problem.
    195195
    196 What we have to do next is configure this operator. We see in the operators details that it has five parameters: Bounds, Length, Random, RealVector, and Successor. Like before we can ignore the Successor parameter, but the other 4 are interesting to us. You can click on any of these parameters to get a helpful description in the parameter's own view (which is nested again), you can also double click a parameter to open a view in a new tab. The Bounds parameter tells us that it represents "A 2 column matrix specifying the lower and upper bound for each dimension. If there are less rows than dimension the bounds vector is cycled." This is very helpful information indeed! We know, from reading the challenge's manual that the solution vector is bound in every dimension by 0 and 1 and now we have two choices. We could now click on the button with the pencil icon and create a new Bounds matrix directly in the parameter of this operator or we can set the //Actual Name// of this parameter to the name of the parameter that we create in a higher level. If we'd create the parameter directly in the parameter, other operators do not have access to it and because the Bounds are also needed in other operators like Crossover and Mutation it is a better idea to create the bounds matrix at the problem level.
    197 
    198 So we click the yellow plus icon in the parameters list of our problem (marked in the following screenshot).
     196What we have to do next is configure this operator. We see in the operators details that it has five parameters: Bounds, Length, Random, !RealVector, and Successor. Like before we can ignore the Successor parameter, but the other 4 are interesting to us. You can click on any of these parameters to get a helpful description in the parameter's own view (which is nested again), you can also double click a parameter to open a view in a new tab. The Bounds parameter tells us that it represents "A 2 column matrix specifying the lower and upper bound for each dimension. If there are less rows than dimension the bounds vector is cycled." This is very helpful information indeed! We know, from reading the challenge's manual that the solution vector is bound in every dimension by 0 and 1 and now we have two choices. We could now click on the button with the pencil icon and create a new Bounds matrix directly in the parameter of this operator or we can set the //Actual Name// of this parameter to the name of the parameter that we create in a higher level. If we'd create the parameter directly in the parameter, other operators do not have access to it and because the Bounds are also needed in other operators like Crossover and Mutation it is a better idea to create the bounds matrix at the problem level.
     197
     198So we click the yellow plus icon in the parameters list of our problem (marked in the following screenshot). If you have opened the operator in a new tab, switch to the tab of our problem (it starts with "Race Car Configuration...").
    199199
    200200[[Image(Tutorial_CreateBounds.png)]]
     
    208208 2. Value parameters
    209209
    210 Lookup parameters do not have a value of their own, but rather search for this value in a higher scope. Value parameters on the other hand contain a value of their own and do not look for the value in a higher scope. The combination of the two is a !ValueLookupParameter that either has a value in which case it will not look in a higher scope or it does not have a value in which case it will look in a higher scope. So it's the best of the two worlds. Usually when a parameter can be either set directly or looked up a !ValueLookupParameter is well suited. The Bounds parameter for example of the solution creator is such a parameter. In this case however, we're at the problem scope and there's no higher scope so what we need is a new '''ValueParameter<T>'''. The <T> basically states that we have to define the type of the parameter and that we could make a parameter of IOperator for example or in our case, we need a '''ValueParameter<DoubleMatrix>'''. So we select the !ValueParameter, after which a new field becomes visible.
    211 
     210Lookup parameters do not have a value of their own, but rather search for this value in a higher scope. Value parameters on the other hand contain a value of their own and do not look for the value in a higher scope. The combination of the two is a !ValueLookupParameter that either has a value in which case it will not look in a higher scope or it does not have a value in which case it will look in a higher scope. So it's the best of the two worlds. Usually when a parameter can be either set directly or looked up a !ValueLookupParameter is well suited. The Bounds parameter for example of the solution creator is such a parameter. In this case however, we're at the problem scope and there's no higher scope so what we need is a new '''!ValueParameter<T>'''. The <T> basically states that we have to define the type of the parameter and that we could make a parameter of IOperator for example or in our case, we need a '''!ValueParameter<!DoubleMatrix>'''. So we select the !ValueParameter, after which a new field becomes visible.
    212211
    213212[[Image(Tutorial_TypeSelector_NewParameter2.png)]]
     213
     214Click the "T" in this box and the pencil button on the right to set the type. You're presented with a new window of the type selector that you now know already. You can type "matrix" in the search text box which limits your choices to just a few types, among them the '''!DoubleMatrix'''. Double click the !DoubleMatrix and see how the textbox now says "T: !DoubleMatrix". Finally we need to give the parameter a name. Because our real vector solution creator expected it to be called Bounds, it is less configuration effort if we also just name this parameter Bounds. We can also add a description to remind us again what this parameter describes. Let's type: "Defines the upper and lower bounds for the solution vector." It should look like in the next screen before you click OK.
     215
     216[[Image(Tutorial_BoundsParameterConfigured.png)]]
     217
     218Now we need to assign the Bounds, so we click the newly created parameter in the parameter list and click the pencil icon in its detail view just under "Value".
     219
     220[[Image(Tutorial_NewBoundsMatrix.png)]]
     221
     222That's simple! Select OK.
     223
     224Now you should configure the Bounds matrix. Remember the description from the Bounds parameter of the !SolutionCreator: Each row specifies the lower and upper bound for each dimension, if there are less rows than dimensions the rows are cycled. Because all our parameters will have the same bounds we just need to set 1 row and 2 columns and put 0 and 1 in the respective cells. It should look like the next screenshot.
     225
     226[[Image(Tutorial_ConfigureBoundsMatrix.png)]]
     227
     228Now we have the bounds for our vector defined at the problem level and every operator that needs these bounds can find them if they have a lookup parameter defined for it. Let's go back to our !UniformRandomRealVectorCreator. Click on !SolutionCreator and there it is in its operators list. If you have opened the tab earlier you can also just switch to that tab. The next parameter that we're going to examine is the '''Length''' parameter. This defines the length of our solution vector. This is not a parameter that will not be used by other operators that we encounter in this tutorial, so we just set the value directly there. Click the pencil icon. If that pencil icon is hidden to you, again due to screen resolution just double click the Length parameter and perform the actions in the tab. Close this tab again when you're done.
     229
     230[[Image(Tutorial_SetVectorLength.png)]]
     231
     232In the upcoming dialog confirm that it is an '''!IntValue''' and click ok to create the value. Our solution vector is of length 22, because we have 22 values to optimize so insert 22 in the value text box. If you can't see the value text box, double click on Length.
     233
     234[[Image(Tutorial_SetVectorLengthValue.png)]]
     235
     236Let's look at the other parameters. There's Random next and then there is !RealVector. If we click on !RealVector we see that this is the name of the variable that will house our solution vector. We can change this to another name by setting the Actual Name, but since this is our only vector we can leave it at that.
     237
     238So we have defined our !SolutionCreator! Now we need to define the Evaluator, specify some operators to manipulate that real vector and finally specify the connection to our evaluation service.