[16565] | 1 | using HeuristicLab.Core;
|
---|
[11753] | 2 | using HeuristicLab.Optimization;
|
---|
| 3 |
|
---|
| 4 | namespace HeuristicLab.Problems.Programmable {
|
---|
| 5 | public class CompiledMultiObjectiveProblemDefinition : CompiledProblemDefinition, IMultiObjectiveProblemDefinition {
|
---|
| 6 | public bool[] Maximization { get { return new[] { false, false }; } }
|
---|
| 7 |
|
---|
| 8 | public override void Initialize() {
|
---|
[11880] | 9 | // Use vars.yourVariable to access variables in the variable store i.e. yourVariable
|
---|
[11753] | 10 | // Define the solution encoding which can also consist of multiple vectors, examples below
|
---|
[11900] | 11 | //Encoding = new BinaryVectorEncoding("b", length: 5);
|
---|
| 12 | //Encoding = new IntegerVectorEncoding("i", length: 5, min: 2, max: 14, step: 4);
|
---|
| 13 | //Encoding = new RealVectorEncoding("r", length: 5, min: -1.0, max: 1.0);
|
---|
[11753] | 14 | //Encoding = new PermutationEncoding("p", length: 5, type: PermutationTypes.Absolute);
|
---|
[12724] | 15 | //Encoding = new LinearLinkageEncoding("l", length: 5);
|
---|
| 16 | //Encoding = new SymbolicExpressionTreeEncoding("s", new SimpleSymbolicExpressionGrammar(), 50, 12);
|
---|
[11880] | 17 | // The encoding can also be a combination
|
---|
[11753] | 18 | //Encoding = new MultiEncoding()
|
---|
[11900] | 19 | //.Add(new BinaryVectorEncoding("b", length: 5))
|
---|
| 20 | //.Add(new IntegerVectorEncoding("i", length: 5, min: 2, max: 14, step: 4))
|
---|
| 21 | //.Add(new RealVectorEncoding("r", length: 5, min: -1.0, max: 1.0))
|
---|
[11753] | 22 | //.Add(new PermutationEncoding("p", length: 5, type: PermutationTypes.Absolute))
|
---|
[12731] | 23 | //.Add(new LinearLinkageEncoding("l", length: 5))
|
---|
| 24 | //.Add(new SymbolicExpressionTreeEncoding("s", new SimpleSymbolicExpressionGrammar(), 50, 12))
|
---|
[11753] | 25 | ;
|
---|
[11880] | 26 | // Add additional initialization code e.g. private variables that you need for evaluating
|
---|
[11753] | 27 | }
|
---|
| 28 |
|
---|
| 29 | public double[] Evaluate(Individual individual, IRandom random) {
|
---|
[11880] | 30 | // Use vars.yourVariable to access variables in the variable store i.e. yourVariable
|
---|
[11753] | 31 | var qualities = new[] { 0.0, 0.0 };
|
---|
[11880] | 32 | //qualities = new [] { individual.RealVector("r").Sum(x => x * x), individual.RealVector("r").Sum(x => x * x * x) };
|
---|
[11753] | 33 | return qualities;
|
---|
| 34 | }
|
---|
| 35 |
|
---|
[11880] | 36 | public void Analyze(Individual[] individuals, double[][] qualities, ResultCollection results, IRandom random) {
|
---|
| 37 | // Use vars.yourVariable to access variables in the variable store i.e. yourVariable
|
---|
| 38 | // Write or update results given the range of vectors and resulting qualities
|
---|
[11753] | 39 | }
|
---|
[11880] | 40 | // Implement further classes and methods
|
---|
[11753] | 41 | }
|
---|
| 42 | }
|
---|
| 43 |
|
---|