Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/15/14 10:23:34 (10 years ago)
Author:
abeham
Message:

#2174:

  • Removed SimSharp reference (not the purpose of this branch anymore)
  • Fixed bugs regarding parameter names when no parameter have been defined
  • Added a method to the problem definition to retrieve a neighborhood solution
    • Programmable problem now works with LocalSearch and SimulatedAnnealing
File:
1 edited

Legend:

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

    r10856 r11363  
    3434    protected SingleObjectiveScript(SingleObjectiveScript original, Cloner cloner)
    3535      : base(original, cloner) { }
    36     public SingleObjectiveScript() { }
     36
     37    public SingleObjectiveScript() {
     38      Code = CodeTemplate;
     39    }
    3740
    3841    public override IDeepCloneable Clone(Cloner cloner) {
     
    7881  }
    7982
     83  public IEnumerable<ParameterVector> GetNeighbors(IRandom random, ParameterVector vector) {
     84    // Create new vectors, based on the given one that represent small changes
     85    // This method is only called from move-based algorithms (LocalSearch, SimulatedAnnealing, etc.)
     86    while (true) {
     87      var neighbor = (ParameterVector)vector.Clone();
     88      //e.g. make a bit flip in a binary parameter
     89      //var bIndex = random.Next(neighbor.Binary(""b"").Length);
     90      //neighbor.Binary(""b"")[bIndex] = !neighbor.Binary(""b"")[bIndex];
     91      yield return neighbor;
     92    }
     93  }
     94
    8095  // implement further classes and methods
    8196}";
Note: See TracChangeset for help on using the changeset viewer.