Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/24/15 16:43:32 (9 years ago)
Author:
abeham
Message:

#2521: fixed recreation of programmable problem's encoding

Location:
branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/MultiObjectiveProgrammableProblem.cs

    r13350 r13365  
    7171      : base() {
    7272      Parameters.Add(new FixedValueParameter<MultiObjectiveProblemDefinitionScript<TEncoding, TSolution>>("ProblemScript", "Defines the problem.",
    73         new MultiObjectiveProblemDefinitionScript<TEncoding, TSolution>() { Name = Name, Encoding = Encoding }));
     73        new MultiObjectiveProblemDefinitionScript<TEncoding, TSolution>() { Name = Name }));
     74      ProblemScript.Encoding = Encoding = (TEncoding)Encoding.Clone();
    7475      RegisterEvents();
    7576    }
     
    8788      Parameters.Remove("Maximization");
    8889      Parameters.Add(new ValueParameter<BoolArray>("Maximization", "Set to false if the problem should be minimized.", (BoolArray)new BoolArray(Maximization).AsReadOnly()) { Hidden = true });
     90      var multiEnc = ProblemScript.Encoding as MultiEncoding;
     91      if (multiEnc != null) multiEnc.Clear();
     92      ProblemScript.Initialize();
     93      Encoding = (TEncoding)ProblemScript.Encoding.Clone();
    8994
    90       ProblemScript.Initialize();
    9195      OnOperatorsChanged();
    9296      OnReset();
  • branches/ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/SingleObjectiveProgrammableProblem.cs

    r13350 r13365  
    7373      : base() {
    7474      Parameters.Add(new FixedValueParameter<SingleObjectiveProblemDefinitionScript<TEncoding, TSolution>>("ProblemScript", "Defines the problem.",
    75         new SingleObjectiveProblemDefinitionScript<TEncoding, TSolution>() { Name = Name, Encoding = Encoding }));
     75        new SingleObjectiveProblemDefinitionScript<TEncoding, TSolution>() { Name = Name }));
     76      ProblemScript.Encoding = Encoding = (TEncoding)Encoding.Clone();
    7677      Operators.Add(new BestScopeSolutionAnalyzer());
    7778      RegisterEvents();
     
    9091      Parameters.Remove("Maximization");
    9192      Parameters.Add(new FixedValueParameter<BoolValue>("Maximization", "Set to false if the problem should be minimized.", (BoolValue)new BoolValue(Maximization).AsReadOnly()) { Hidden = true });
     93      var multiEnc = ProblemScript.Encoding as MultiEncoding;
     94      if (multiEnc != null) multiEnc.Clear();
    9295      ProblemScript.Initialize();
     96      Encoding = (TEncoding)ProblemScript.Encoding.Clone();
    9397
    9498      OnOperatorsChanged();
Note: See TracChangeset for help on using the changeset viewer.