- Timestamp:
- 08/29/19 13:53:26 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/CompiledProblemDefinition.cs
r16806 r17225 23 23 using System.Collections.Generic; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Data; 25 26 using HeuristicLab.Optimization; 26 27 … … 51 52 where TEncoding : class, IEncoding<TEncodedSolution> 52 53 where TEncodedSolution : class, IEncodedSolution { 53 54 54 protected CompiledSingleObjectiveProblemDefinition() : base() { } 55 55 … … 72 72 where TEncoding : class, IEncoding<TEncodedSolution> 73 73 where TEncodedSolution : class, IEncodedSolution { 74 75 74 protected CompiledMultiObjectiveProblemDefinition() : base() { } 76 75 … … 79 78 80 79 #region ISingleObjectiveProblemDefinition<TEncoding,TEncodedSolution> Members 81 82 80 public int Objectives => Maximization.Length; 83 81 public abstract bool[] Maximization { get; } 82 public abstract IReadOnlyList<double[]> BestKnownFront { get; } 83 public abstract double[] ReferencePoint { get; } 84 84 public abstract double[] Evaluate(TEncodedSolution individual, IRandom random); 85 85 public abstract void Analyze(TEncodedSolution[] individuals, double[][] qualities, ResultCollection results, IRandom random); -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/MultiObjectiveProblemDefinitionScript.cs
r16806 r17225 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using HEAL.Attic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 26 using HeuristicLab.Data; 25 27 using HeuristicLab.Optimization; 26 28 … … 47 49 } 48 50 49 int IMultiObjectiveProblemDefinition<TEncoding, TEncodedSolution>.Objectives => CompiledProblemDefinition.Objectives; 51 public int Objectives => CompiledProblemDefinition.Objectives; 52 public IReadOnlyList<double[]> BestKnownFront => CompiledProblemDefinition.BestKnownFront; 53 public double[] ReferencePoint => CompiledProblemDefinition.ReferencePoint; 54 public bool[] Maximization => CompiledProblemDefinition.Maximization; 50 55 51 bool[] IMultiObjectiveProblemDefinition<TEncoding, TEncodedSolution>.Maximization {52 get { return CompiledProblemDefinition.Maximization; }53 }54 56 55 57 double[] IMultiObjectiveProblemDefinition<TEncoding, TEncodedSolution>.Evaluate(TEncodedSolution individual, IRandom random) { -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/MultiObjectiveProgrammableProblem.cs
r16815 r17225 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using System.Drawing; 23 24 using HEAL.Attic; … … 59 60 } 60 61 62 61 63 [StorableConstructor] 62 64 protected MultiObjectiveProgrammableProblem(StorableConstructorFlag _) : base(_) { } … … 69 71 : base(encoding) { 70 72 Parameters.Add(new FixedValueParameter<MultiObjectiveProblemDefinitionScript<TEncoding, TEncodedSolution>>("ProblemScript", "Defines the problem.", 71 new MultiObjectiveProblemDefinitionScript<TEncoding, TEncodedSolution>() { Name = Name}));73 new MultiObjectiveProblemDefinitionScript<TEncoding, TEncodedSolution>() {Name = Name})); 72 74 ProblemScript.Encoding = (TEncoding)encoding.Clone(); 73 75 … … 93 95 private void OnProblemDefinitionChanged() { 94 96 Parameters.Remove("Maximization"); 95 Parameters.Add(new ValueParameter<BoolArray>("Maximization", "Set to false if the problem should be minimized.", (BoolArray)new BoolArray(Maximization).AsReadOnly()) { Hidden = true});97 Parameters.Add(new ValueParameter<BoolArray>("Maximization", "Set to false if the problem should be minimized.", (BoolArray)new BoolArray(Maximization).AsReadOnly()) {Hidden = true}); 96 98 Encoding = (TEncoding)ProblemScript.Encoding.Clone(); 97 99 … … 108 110 109 111 public override bool[] Maximization { 110 get { return Parameters.ContainsKey("ProblemScript") ? ProblemDefinition.Maximization : new[] { false }; } 112 get { return Parameters.ContainsKey("ProblemScript") ? ProblemDefinition.Maximization : new[] {false}; } 113 } 114 115 public override IReadOnlyList<double[]> BestKnownFront { 116 get { return Parameters.ContainsKey("ProblemScript") ? ProblemDefinition.BestKnownFront : null; } 117 } 118 119 public override double[] ReferencePoint { 120 get { return Parameters.ContainsKey("ProblemScript") ? ProblemDefinition.ReferencePoint : null; } 111 121 } 112 122 -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/SingleObjectiveProblemDefinitionScript.cs
r16751 r17225 48 48 } 49 49 50 bool ISingleObjectiveProblemDefinition<TEncoding, TEncodedSolution>.Maximization { 51 get { return CompiledProblemDefinition.Maximization; } 52 } 50 public bool Maximization => CompiledProblemDefinition.Maximization; 53 51 54 52 double ISingleObjectiveProblemDefinition<TEncoding, TEncodedSolution>.Evaluate(TEncodedSolution individual, IRandom random) { … … 63 61 } 64 62 65 bool ISingleObjectiveProblemDefinition<TEncoding, TEncodedSolution>.IsBetter(double quality, double bestQuality) {63 public bool IsBetter(double quality, double bestQuality) { 66 64 return CompiledProblemDefinition.IsBetter(quality, bestQuality); 67 65 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/Templates/MultiObjectiveCombinedEncodingProblem_Template.cs
r16812 r17225 17 17 public class CompiledMultiObjectiveProblemDefinition : CompiledMultiObjectiveProblemDefinition<CombinedEncoding, CombinedSolution> { 18 18 public override bool[] Maximization { get { return new[] { true, false }; } } 19 public override double[] ReferencePoint { get { return null; } } 20 public override IReadOnlyList<double[]> BestKnownFront { get { return null; } } 19 21 20 22 public override void Initialize() { -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/Templates/MultiObjectiveProblem_Template.cs
r16812 r17225 12 12 public class CompiledMultiObjectiveProblemDefinition : CompiledMultiObjectiveProblemDefinition<ENCODING_CLASS, SOLUTION_CLASS> { 13 13 public override bool[] Maximization { get { return new[] { false, false }; } } 14 public override double[] ReferencePoint { get { return null; } } 15 public override IReadOnlyList<double[]> BestKnownFront { get { return null; } } 14 16 15 17 public override void Initialize() {
Note: See TracChangeset
for help on using the changeset viewer.