Free cookie consent management tool by TermsFeed Policy Generator

Changes between Version 13 and Version 14 of Documentation/Howto/OptimizeExternalApplications


Ignore:
Timestamp:
06/08/10 09:42:46 (14 years ago)
Author:
abeham
Comment:

update

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/Howto/OptimizeExternalApplications

    v13 v14  
    222222That's simple! Select OK.
    223223
    224 Now 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.
     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 in the next screenshot.
    225225
    226226[[Image(Tutorial_ConfigureBoundsMatrix.png)]]
    227227
    228 Now 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.
     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 !LookupParameter or !ValueLookupParameter 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.
    229229
    230230[[Image(Tutorial_SetVectorLength.png, width=1000)]]
    231231
    232 In 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.
     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 according to the manual we have 22 values to optimize so insert that number in the value text box. If you can't see the value text box, double click on the Length parameter.
    233233
    234234[[Image(Tutorial_SetVectorLengthValue.png, width=1000)]]
     
    237237
    238238So 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.
     239
     240==== Configuring the Evaluator ====
     241
     242The evaluator in our case is an external application, the TORCS simulator. The Evaluator in the External Evaluation Problem is the operator that performs the task of collecting the solution variables, including them in a message and sending that message via the Client to the external process. If we click on the Evaluator we see a similar view to the !SolutionCreator. However the Operators tab in the !SolutionCreator is now named "Collected Values". First lets examine the Parameters tab which lists the parameters of this Evaluator. We can see that there are four parameters: Client, !MessageBuilder, Quality, and Successor. The Client again is a !ValueLookupParameter and its //Actual Name// is the same as the actual name of the !ValueParameter that is defined under the problem parameters. The !MessageBuilder is more interesting for us.
     243
     244[[Image(Tutorial_MessageBuilder.png)]]
     245
     246As you can see there are a number of different converters. These are used to transform the value found in the scope to a variable of a !SolutionMessage. This message is in turn sent to the external process, so here we can influence how our solution objects are represented in the solution message. When you define a new !ExternalEvaluationValuesCollector these are the default converters that are preselected. They will transform any type that is available in !HeuristicLab.Data and also derived types. Our representation is a !RealVector object which lives in the !HeuristicLab.Encodings.RealVectorEncoding namespace. Let's take a look at the class definition of RealVector:
     247{{{#!C
     248public class RealVector : DoubleArray
     249}}}
     250We see that it derives from `DoubleArray` and if we look at the definition of `DoubleArray` we see that it derives from `ValueTypeArray<double>`. When you now however over the !DoubleConverter to get the tooltip you can see that it indeeds converts a `ValueTypeArray<double>` among others and thus also our derived `RealVector`. We can uncheck or remove the others, but there is no harm in leaving them.
     251
     252For writing your own solution representation you can also write an own encoder. All you have to do is implement `IItemToSolutionMessage`, add your code as HeuristicLab plugin and you can add your converter using the yellow plus button. Note that if you have several converters for a given type, the last added converter will be used for that type.
     253
     254So in our case there exists a converter which will convert the !RealVector into a !DoubleArrayVariable and add it to the !SolutionMessage's !DoubleArrayVars.
     255
     256The last parameter we're going to look at is called "Quality" and denotes the variable that houses the fitness value. Let's leave its //Actual Name// as it is. And let's go back to the "Collected Values" tab instead.
     257
     258[[Image(Tutorial_ConfigureExternalEvaluator.png)]]
     259
     260As you may have guessed the next thing we're going to do is to tell the !ExternalEvaluationValuesCollector which variables that it should hand to the converters to include in the solution message. Of course we want to send the !RealVector, so we're going to add a parameter where to find that vector. You probably now know already how this works, basically it should look like in the following screenshot. This time we use a simple !LookupParameter because this parameter always should be looked up.
     261
     262[[Image(Tutorial_ConfigureExternalEvaluator2.png)]]
     263
     264If we now switch back to the Parameters tab, we can also see that there is a RealVector parameter there. All parameters that we add to the "Collected Values" appear also under Parameters.
     265
     266Next in the configuration of the problem and right below the Evaluator we can see another parameter called '''Maximization'''. This tells the algorithm wether it should attempt to increase the quality value (if Maximization = true) or decrease it otherwise. From the possible fitness values we obtain from the simulator there's top speed and distance which we likely want to increase and damage which we want to decrease. Overall, because the !ExternalEvaluationProblem is a single objective problem we have to calculate a single fitness value and it's likely that we want to maximize distance, so we set this to true here.
     267
     268[[Image(Tutorial_Maximization.png)]]