Free cookie consent management tool by TermsFeed Policy Generator

Changes between Version 2 and Version 3 of Documentation/DevelopmentCenter/IntegrateHeuristicLab


Ignore:
Timestamp:
06/15/12 22:19:17 (12 years ago)
Author:
ascheibe
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/DevelopmentCenter/IntegrateHeuristicLab

    v2 v3  
    44Attached to this page you can find a zip file containing the sample HeuristicLab file, the needed assemblies as well as a Visual Studio project with the source code.
    55
    6 We will start out by creating a new Visual Studio C# console application. Because we want to read in a user-defined algorithm based on a GA containing a Traveling Salesman Problem, we first need to reference the following assemblies:
     6We will start out by creating a new Visual Studio C# console application. Because we want to read in a user-defined algorithm based on a Genetic Algorithm containing a Traveling Salesman Problem, we first need to reference the following assemblies:
    77
    88[[Image(assemblies.png)]]
     
    4747}}}
    4848
    49 The LoadingCompleted method gets an object of type IStorableContent. This is the object which the ContentManager loaded from the HeuristicLab file. In this simple example we only support user-defined algorithms and the TSP. Therefore we cast the algorithm to a user-defined algorithm and the problem to the TSP. In the next step we can then set the parameters of the problem and the algorithm. After parameterizing the algorithm we have to register event handlers for the algorithm so that we receive status updates during execution. The Parameterize* methods set parameters of the algorithm and the problem:
     49The LoadingCompleted method gets an object of type IStorableContent. This is the object which the ContentManager loaded from the HeuristicLab file. In this simple example we only support user-defined algorithms and the TSP. Therefore we cast the content to a user-defined algorithm and the problem to the TSP. In the next step we can then set the parameters of the problem and the algorithm. After parameterizing the algorithm we have to register event handlers for the algorithm so that we receive status updates during execution. The Parameterize* methods set parameters of the algorithm and the problem:
    5050
    5151{{{#!csharp
     
    6262
    6363Algorithm parameters can be accessed through the parameters collection. In the code above the maximum generations is set from 1000 generations to 5000 generations.
    64 The problem has various properties that can be set, like in the above code we define that the problem is a minimization problem. Another example would be to set the problem data using the coordinates or distance matrix properties.
     64The problem offers some properties that can be changed. For example it is shown how to configure the problem to be a minimization or a maximization problem. Another example would be to set the problem data using the coordinates or distance matrix properties.
    6565
    66 RegisterAlgorithmEventHandlers registers for some events so that the application can print the execution time and state changes of the algorithm during execution.
     66RegisterAlgorithmEventHandlers registers some events so that the application is able to print the execution time and state changes of the algorithm during execution.
    6767
    6868{{{#!csharp
     
    104104}}}
    105105
    106 And that's all! You have now a HeuristicLab console client for a specific algorithm and problem. If you want to use different algorithms and problems, you have to reference the required assemblies and can then parameterize and execute these algorithms.
     106And that's all! You have now created a HeuristicLab console client for a specific algorithm and problem. If you want to use different algorithms and problems, you have to reference the required assemblies and can then parameterize and execute these algorithms.