Changeset 16806
- Timestamp:
- 04/17/19 23:06:18 (6 years ago)
- Location:
- branches/2521_ProblemRefactoring
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Interfaces/IEncoding.cs
r16751 r16806 40 40 } 41 41 42 [StorableType("DB23907F-BE6E-44E4-9596-3D3BF1532631")] 42 43 public interface IEncoding<TEncodedSolution> : IEncoding 43 where TEncodedSolution : class, IEncodedSolution {44 where TEncodedSolution : class, IEncodedSolution { 44 45 //new ISolutionCreator<TEncodedSolution> SolutionCreator { get; } 45 46 } -
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Interfaces/IMultiObjectiveProblemDefinition.cs
r16751 r16806 28 28 where TEncoding : class, IEncoding<TEncodedSolution> 29 29 where TEncodedSolution : class, IEncodedSolution { 30 31 int Objectives { get; } 30 32 bool[] Maximization { get; } 31 double[] Evaluate(TEncodedSolution individual, IRandom random);32 void Analyze(TEncodedSolution[] individuals, double[][] qualities, ResultCollection results, IRandom random);33 double[] Evaluate(TEncodedSolution solution, IRandom random); 34 void Analyze(TEncodedSolution[] solutions, double[][] qualities, ResultCollection results, IRandom random); 33 35 } 34 36 } -
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/MultiObjectiveProblem.cs
r16801 r16806 36 36 where TEncodedSolution : class, IEncodedSolution { 37 37 38 protected IValueParameter<BoolArray> MaximizationParameter { 39 get { return (IValueParameter<BoolArray>)Parameters["Maximization"]; } 40 } 41 38 42 [StorableConstructor] 39 43 protected MultiObjectiveProblem(StorableConstructorFlag _) : base(_) { } … … 44 48 } 45 49 46 protected MultiObjectiveProblem() 47 : base() { 50 protected MultiObjectiveProblem() : base() { 51 Parameters.Add(new ValueParameter<BoolArray>("Maximization", "Set to false if the problem should be minimized.", (BoolArray)new BoolArray(Maximization).AsReadOnly())); 52 53 Operators.Add(Evaluator); 54 Operators.Add(new MultiObjectiveAnalyzer<TEncodedSolution>()); 55 56 ParameterizeOperators(); 57 } 58 59 protected MultiObjectiveProblem(TEncoding encoding) : base(encoding) { 48 60 Parameters.Add(new ValueParameter<BoolArray>("Maximization", "Set to false if the problem should be minimized.", (BoolArray)new BoolArray(Maximization).AsReadOnly())); 49 61 … … 59 71 } 60 72 73 public int Objectives => Maximization.Length; 61 74 public abstract bool[] Maximization { get; } 62 public abstract double[] Evaluate(TEncodedSolution individual, IRandom random);63 public virtual void Analyze(TEncodedSolution[] individuals, double[][] qualities, ResultCollection results, IRandom random) { }75 public abstract double[] Evaluate(TEncodedSolution solution, IRandom random); 76 public virtual void Analyze(TEncodedSolution[] solutions, double[][] qualities, ResultCollection results, IRandom random) { } 64 77 65 78 protected override void OnOperatorsChanged() { -
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/SingleObjectiveProblem.cs
r16801 r16806 69 69 } 70 70 71 protected SingleObjectiveProblem() 72 : base() { 71 protected SingleObjectiveProblem() : base() { 73 72 Parameters.Add(new FixedValueParameter<BoolValue>("Maximization", "Set to false if the problem should be minimized.", (BoolValue)new BoolValue(Maximization).AsReadOnly()) { Hidden = true }); 74 73 Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this problem.")); … … 84 83 } 85 84 86 protected SingleObjectiveProblem(TEncoding encoding) 87 : base(encoding) { 85 protected SingleObjectiveProblem(TEncoding encoding) : base(encoding) { 88 86 Parameters.Add(new FixedValueParameter<BoolValue>("Maximization", "Set to false if the problem should be minimized.", (BoolValue)new BoolValue(Maximization).AsReadOnly()) { Hidden = true }); 89 87 Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this problem.")); -
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/Interfaces/ISolutionCreator.cs
r16751 r16806 30 30 public interface ISolutionCreator : IOperator { } 31 31 32 [StorableType("76F17DA0-A81C-4E16-B591-38541D73C370")] 32 33 public interface ISolutionCreator<TEncodedSolution> : ISolutionCreator where TEncodedSolution : class, IEncodedSolution { 33 34 //ILookupParameter<TEncodedSolution> SolutionParameter { get; } // TODO: unify encoding specific parameters by defining ISolutionOperator and ISolutionsOperator -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/CompiledProblemDefinition.cs
r16751 r16806 79 79 80 80 #region ISingleObjectiveProblemDefinition<TEncoding,TEncodedSolution> Members 81 82 public int Objectives => Maximization.Length; 81 83 public abstract bool[] Maximization { get; } 82 84 public abstract double[] Evaluate(TEncodedSolution individual, IRandom random); -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Programmable/3.3/MultiObjectiveProblemDefinitionScript.cs
r16751 r16806 47 47 } 48 48 49 int IMultiObjectiveProblemDefinition<TEncoding, TEncodedSolution>.Objectives => CompiledProblemDefinition.Objectives; 50 49 51 bool[] IMultiObjectiveProblemDefinition<TEncoding, TEncodedSolution>.Maximization { 50 52 get { return CompiledProblemDefinition.Maximization; }
Note: See TracChangeset
for help on using the changeset viewer.