Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/23/15 16:14:57 (9 years ago)
Author:
mkommend
Message:

#2521: Rectored problems and encodings.

Location:
branches/ProblemRefactoring/HeuristicLab.Optimization/3.3
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Interfaces/IMultiObjectiveProblemDefinition.cs

    r13336 r13339  
    2323
    2424namespace HeuristicLab.Optimization {
    25   public interface IMultiObjectiveProblemDefinition<TSolution> : IProblemDefinition
    26   where TSolution : class, ISolution {
     25  public interface IMultiObjectiveProblemDefinition<TEncoding, TSolution> : IProblemDefinition<TEncoding, TSolution>
     26    where TEncoding : class, IEncoding<TSolution>
     27    where TSolution : class, ISolution {
    2728    bool[] Maximization { get; }
    2829    double[] Evaluate(TSolution individual, IRandom random);
  • branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Interfaces/IProblemDefinition.cs

    r13336 r13339  
    2121
    2222namespace HeuristicLab.Optimization {
    23   public interface IProblemDefinition {
    24     //IEncoding Encoding { get; }
     23  public interface IProblemDefinition<TEncoding, TSolution>
     24    where TEncoding : class, IEncoding<TSolution>
     25    where TSolution : class, ISolution {
     26    TEncoding Encoding { get; }
    2527  }
    2628}
  • branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Interfaces/ISingleObjectiveProblem.cs

    r13337 r13339  
    2424
    2525namespace HeuristicLab.Optimization {
    26   public interface ISingleObjectiveProblem<TSolution> : IProblem<TSolution>, ISingleObjectiveProblemDefinition<TSolution>, ISingleObjectiveHeuristicOptimizationProblem
     26  public interface ISingleObjectiveProblem<TEncoding, TSolution> : IProblem<TEncoding, TSolution>, ISingleObjectiveProblemDefinition<TEncoding, TSolution>, ISingleObjectiveHeuristicOptimizationProblem
     27    where TEncoding : class, IEncoding<TSolution>
    2728    where TSolution : class, ISolution {
    2829    bool IsBetter(double quality, double bestQuality);
  • branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Interfaces/ISingleObjectiveProblemDefinition.cs

    r13336 r13339  
    2424
    2525namespace HeuristicLab.Optimization {
    26   public interface ISingleObjectiveProblemDefinition<TSolution> : IProblemDefinition
    27   where TSolution : class, ISolution {
     26  public interface ISingleObjectiveProblemDefinition<TEncoding, TSolution> : IProblemDefinition<TEncoding, TSolution>
     27    where TEncoding : class, IEncoding<TSolution>
     28    where TSolution : class, ISolution {
    2829    bool Maximization { get; }
    2930    double Evaluate(TSolution individual, IRandom random);
  • branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/MultiObjectiveProblem.cs

    r13336 r13339  
    2929namespace HeuristicLab.Optimization {
    3030  [StorableClass]
    31   public abstract class MultiObjectiveProblem<TSolution> : Problem<TSolution, MultiObjectiveEvaluator<TSolution>>, IMultiObjectiveHeuristicOptimizationProblem, IMultiObjectiveProblemDefinition<TSolution>
    32   where TSolution : class, ISolution {
     31  public abstract class MultiObjectiveProblem<TEncoding, TSolution> : Problem<TEncoding, TSolution, MultiObjectiveEvaluator<TSolution>>, IMultiObjectiveHeuristicOptimizationProblem, IMultiObjectiveProblemDefinition<TEncoding, TSolution>
     32    where TEncoding : class, IEncoding<TSolution>
     33    where TSolution : class, ISolution {
    3334    [StorableConstructor]
    3435    protected MultiObjectiveProblem(bool deserializing) : base(deserializing) { }
    3536
    36     protected MultiObjectiveProblem(MultiObjectiveProblem<TSolution> original, Cloner cloner)
     37    protected MultiObjectiveProblem(MultiObjectiveProblem<TEncoding, TSolution> original, Cloner cloner)
    3738      : base(original, cloner) {
    3839      ParameterizeOperators();
  • branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Problem.cs

    r13336 r13339  
    3030namespace HeuristicLab.Optimization {
    3131  [StorableClass]
    32   public abstract class Problem<TSolution, TEvaluator> : HeuristicOptimizationProblem<TEvaluator, ISolutionCreator<TSolution>>, IProblemDefinition, IStorableContent
     32  public abstract class Problem<TEncoding, TSolution, TEvaluator> : HeuristicOptimizationProblem<TEvaluator, ISolutionCreator<TSolution>>, IProblemDefinition<TEncoding, TSolution>, IStorableContent
     33    where TEncoding : class, IEncoding<TSolution>
    3334    where TSolution : class, ISolution
    3435    where TEvaluator : class, IEvaluator {
     
    3637    public string Filename { get; set; }
    3738
    38     protected IValueParameter<IEncoding<TSolution>> EncodingParameter {
    39       get { return (IValueParameter<IEncoding<TSolution>>)Parameters["Encoding"]; }
     39    protected IValueParameter<TEncoding> EncodingParameter {
     40      get { return (IValueParameter<TEncoding>)Parameters["Encoding"]; }
    4041    }
    4142
    42     public IEncoding<TSolution> Encoding {
     43    public TEncoding Encoding {
    4344      get { return EncodingParameter.Value; }
    4445      protected set {
     
    6162    protected Problem()
    6263      : base() {
    63       Parameters.Add(new ValueParameter<IEncoding<TSolution>>("Encoding", "Describes the configuration of the encoding, what the variables are called, what type they are and their bounds if any."));
    64       if (Encoding != null) Parameterize();
     64      Parameters.Add(new ValueParameter<TEncoding>("Encoding", "Describes the configuration of the encoding, what the variables are called, what type they are and their bounds if any."));
     65      if (Encoding != null) {
     66        SolutionCreator = Encoding.SolutionCreator;
     67        Parameterize();
     68      }
    6569      RegisterEvents();
    6670    }
    6771
    68     protected Problem(Problem<TSolution, TEvaluator> original, Cloner cloner)
     72    protected Problem(Problem<TEncoding, TSolution, TEvaluator> original, Cloner cloner)
    6973      : base(original, cloner) {
    7074      RegisterEvents();
  • branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/SingleObjectiveProblem.cs

    r13336 r13339  
    3030namespace HeuristicLab.Optimization {
    3131  [StorableClass]
    32   public abstract class SingleObjectiveProblem<TSolution> : Problem<TSolution, SingleObjectiveEvaluator<TSolution>>,
    33     ISingleObjectiveProblemDefinition<TSolution>, ISingleObjectiveHeuristicOptimizationProblem
    34   where TSolution : class, ISolution {
     32  public abstract class SingleObjectiveProblem<TEncoding, TSolution> : Problem<TEncoding, TSolution, SingleObjectiveEvaluator<TSolution>>, ISingleObjectiveProblem<TEncoding, TSolution>
     33    where TEncoding : class, IEncoding<TSolution>
     34    where TSolution : class, ISolution {
    3535
    3636    protected IValueParameter<DoubleValue> BestKnownQualityParameter {
     
    5252    protected SingleObjectiveProblem(bool deserializing) : base(deserializing) { }
    5353
    54     protected SingleObjectiveProblem(SingleObjectiveProblem<TSolution> original, Cloner cloner)
     54    protected SingleObjectiveProblem(SingleObjectiveProblem<TEncoding, TSolution> original, Cloner cloner)
    5555      : base(original, cloner) {
    5656      ParameterizeOperators();
  • branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/Interfaces/IProblem.cs

    r13336 r13339  
    3636  }
    3737
    38   public interface IProblem<TSolution> : IHeuristicOptimizationProblem where TSolution : class, ISolution {
    39     IEncoding<TSolution> Encoding { get; }
     38  public interface IProblem<TEncoding, TSolution> : IHeuristicOptimizationProblem, IProblemDefinition<TEncoding, TSolution>
     39    where TEncoding : class, IEncoding<TSolution>
     40    where TSolution : class, ISolution {
    4041  }
    4142}
  • branches/ProblemRefactoring/HeuristicLab.Optimization/3.3/Problems/HeuristicOptimizationProblem.cs

    r12012 r13339  
    9999    }
    100100
    101     protected virtual void SolutionCreatorParameter_ValueChanged(object sender, EventArgs e) {
     101    private void SolutionCreatorParameter_ValueChanged(object sender, EventArgs e) {
    102102      OnSolutionCreatorChanged();
    103103    }
Note: See TracChangeset for help on using the changeset viewer.