Free cookie consent management tool by TermsFeed Policy Generator

Changes between Version 3 and Version 11 of Ticket #2174


Ignore:
Timestamp:
09/26/14 11:36:55 (10 years ago)
Author:
abeham
Comment:

After talking with the RG bioinformatics about these developments it was identified that the work of this ticket could support application of HL optimizers in their problems. Their issue is that they do have their own GUIs that allow e.g. a user to select a particular region of an image and create an optimization problem out of the data in that region. The difficult part has been that the problem needs to be described by writing a new problem class that includes all the necessary details of operator discovery, parameters, wiring, cloning, etc. The ProgrammableProblem now is a nice way of not having to do this, but relies heavily on the HeuristicLab UI. Additionally, to the UI it would be nice if this ProgrammableProblem could be instantiated in code and its definition could be given in the same code in a very intuitive and friendly manner. Because the programmable problem configures everything in the background the user doesn't need to take more care, but to assign that problem to an algorithm and start it. The following pseudo code shows such a use case and how the programmable problem could support that:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using HeuristicLab.Algorithms.CMAEvolutionStrategy;
using HeuristicLab.Common;
using HeuristicLab.Core;
using HeuristicLab.Data;
using HeuristicLab.Optimization;
using HeuristicLab.Problems.Programmable;

public class MyScript : HeuristicLab.Scripting.CSharpScriptBase {
  private ManualResetEvent waitHandle = new ManualResetEvent(false);
  
  public override void Main() {
    var definition = new SingleObjectiveProblemDefinition() {
      Configuration = () => {
        return new Configuration().AddRealVector("r", 5, -1, 1);
      },
      Evaluate = (random, vector) => {
        return vector.RealVector("r").Sum(x => x * x);
      }
    };
    
    var prob = new SingleObjectiveProgrammableProblem() {
      ProblemDefinition = definition
    };
    var cmaes = new CMAEvolutionStrategy();
    cmaes.Problem = prob;
    vars.alg = cmaes;
    cmaes.ExecutionStateChanged += executionStateChanged;
    cmaes.Start();
    waitHandle.WaitOne();
  }
  
  private void executionStateChanged(object sender, EventArgs e) {
    waitHandle.Set();
  }
}

These lines of code are very simple to understand and demonstrate.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2174 – Description

    v3 v11  
    11A programmable optimization problem should be created that allows to define parameter vector and evaluation function in an easy way. This will build upon the scripting feature.
     2
     3Open points and Todos:
     4 * Rename AddReal to AddRealVector
     5 * Add StrategyParameter operators for RealVector encoding
     6 * Add an analyzer that will call into an "Analyze" method (tbd) which will receive the result collection, parameter vector array and quality array.
     7 * Rename the script parameter to "ProblemDefinition" to make a better distinction of what is what: the script only defines the problem in terms of encoding and evaluation function, this definition is part of a "problem shell" which is a HeuristicLab wrapper around this definition
     8 * Extract the parameter vector again to a separate multi-vector or combined encoding (?)