Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/15/14 15:06:57 (10 years ago)
Author:
abeham
Message:

#2174: Worked on programmable problem

  • Changed ProblemBase to IProblemDefinition and SingleObjectiveProblemBase to ISingleObjectiveProblemDefinition
  • Derived ParameterVectorCreater, -Crossover, and -Manipulator from MultiOperator<> instead of InstrumentedOperator
  • Split the megamoth ScriptOnInstanceChanged to multiple methods dealing with single-vector and multi-vector encodings separately, it's still a lot of tedious code
  • Removed maximization from Configuration again (would not be consistent with multi-objective problems)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SimSharp/HeuristicLab.Problems.Programmable/3.3/SingleObjectiveScript.cs

    r10850 r10856  
    4040    }
    4141
    42     public new SingleObjectiveProblemBase Instance {
    43       get { return (SingleObjectiveProblemBase)base.Instance; }
     42    public new ISingleObjectiveProblemDefinition Instance {
     43      get { return (ISingleObjectiveProblemDefinition)base.Instance; }
    4444      protected set { base.Instance = value; }
    4545    }
     
    5656using HeuristicLab.Problems.Programmable;
    5757
    58 public class MyProblem : HeuristicLab.Problems.Programmable.SingleObjectiveProblemBase {
    59   public MyProblem() {
     58public class ProblemDefinition : ISingleObjectiveProblemDefinition {
     59  public ProblemDefinition() {
    6060    // initialize private fields
    6161  }
    6262
    63   public override Configuration GetConfiguration() {
     63  public bool IsMaximizationProblem { get { return false; } }
     64
     65  public Configuration GetConfiguration() {
    6466    return new Configuration()
    65       // .SetMaximization(true)
    66       // add an arbitrary number of uniquely named parameter vectors
    67       // .AddBinary(""p"", length: 5)
     67      // .AddBinary(""b"", length: 5)
    6868      // .AddInteger(""i"", length: 5, min: 2, max: 14, step: 4)
    6969      // .AddReal(""r"", length: 5, min: -1.0, max: 1.0)
    70       // .AddPermutation(""P"", type: PermutationTypes.Absolute, length: 5)
     70      // .AddPermutation(""P"", length: 5, type: PermutationTypes.Absolute)
    7171    ;
    7272  }
    7373
    74   public override double Evaluate(IRandom random, ParameterVector vector) {
     74  public double Evaluate(IRandom random, ParameterVector vector) {
    7575    var quality = 0.0;
    7676    // quality = vector.Real(""r"").Select(x => x * x).Sum();
Note: See TracChangeset for help on using the changeset viewer.