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.