Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/04/15 10:35:04 (9 years ago)
Author:
mkommend
Message:

#2521: Intermediate version of schedule encoding refactoring.

Location:
branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/Analyzers/BestSchedulingSolutionAnalyzer.cs

    r12012 r13435  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223using System.Linq;
    2324using HeuristicLab.Common;
     
    7778      if (bestSolution == null) {
    7879        bestSolution = (Schedule)solutions[i].Clone();
    79         bestSolution.Quality = (DoubleValue)qualities[i].Clone();
     80        bestSolution.Quality = qualities[i].Value;
    8081        BestSolutionParameter.ActualValue = bestSolution;
    8182        results.Add(new Result("Best Scheduling Solution", bestSolution));
    8283      } else {
    83         if (max && bestSolution.Quality.Value < qualities[i].Value ||
    84           !max && bestSolution.Quality.Value > qualities[i].Value) {
    85           bestSolution.Quality.Value = qualities[i].Value;
    86           bestSolution.Resources = (ItemList<Resource>)solutions[i].Resources.Clone();
     84        if (max && bestSolution.Quality < qualities[i].Value ||
     85          !max && bestSolution.Quality > qualities[i].Value) {
     86          bestSolution.Quality = qualities[i].Value;
     87          bestSolution.Resources.Clear();
     88          bestSolution.Resources.AddRange((IEnumerable<Resource>)solutions[i].Resources.Clone());
    8789        }
    8890      }
  • branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/Decoders/JSMDecoder.cs

    r12012 r13435  
    177177    }
    178178
    179     public override Schedule CreateScheduleFromEncoding(IScheduleEncoding encoding) {
     179    public override Schedule CreateScheduleFromEncoding(ISchedule encoding) {
    180180      var solution = encoding as JSMEncoding;
    181181      if (solution == null) throw new InvalidOperationException("Encoding is not of type JSMEncoding");
  • branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/Decoders/PRVDecoder.cs

    r12012 r13435  
    202202    }
    203203
    204     public override Schedule CreateScheduleFromEncoding(IScheduleEncoding encoding) {
     204    public override Schedule CreateScheduleFromEncoding(ISchedule encoding) {
    205205      var solution = encoding as PRVEncoding;
    206       if (solution == null) throw new InvalidOperationException("Encoding is not of type PWREncoding");
     206      if (solution == null) throw new InvalidOperationException("Encoding is not of type PRVEncoding");
    207207
    208208      var jobs = (ItemList<Job>)JobDataParameter.ActualValue.Clone();
  • branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/Decoders/PWRDecoder.cs

    r12012 r13435  
    5555    }
    5656
    57     public override Schedule CreateScheduleFromEncoding(IScheduleEncoding encoding) {
     57    public override Schedule CreateScheduleFromEncoding(ISchedule encoding) {
    5858      var solution = encoding as PWREncoding;
    5959      if (solution == null) throw new InvalidOperationException("Encoding is not of type PWREncoding");
  • branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/Decoders/ScheduleDecoder.cs

    r12012 r13435  
    3232  public abstract class ScheduleDecoder : SingleSuccessorOperator, IScheduleDecoder {
    3333
    34     public ILookupParameter<IScheduleEncoding> ScheduleEncodingParameter {
    35       get { return (ILookupParameter<IScheduleEncoding>)Parameters["ScheduleEncoding"]; }
     34    public ILookupParameter<ISchedule> ScheduleEncodingParameter {
     35      get { return (ILookupParameter<ISchedule>)Parameters["ScheduleEncoding"]; }
    3636    }
    3737    public ILookupParameter<Schedule> ScheduleParameter {
     
    4444    public ScheduleDecoder()
    4545      : base() {
    46       Parameters.Add(new LookupParameter<IScheduleEncoding>("ScheduleEncoding", "The new scheduling solution represented as encoding."));
     46      Parameters.Add(new LookupParameter<ISchedule>("ScheduleEncoding", "The new scheduling solution represented as encoding."));
    4747      Parameters.Add(new LookupParameter<Schedule>("Schedule", "The decoded scheduling solution represented as generalized schedule."));
    4848    }
    4949
    50     public abstract Schedule CreateScheduleFromEncoding(IScheduleEncoding solution);
     50    public abstract Schedule CreateScheduleFromEncoding(ISchedule solution);
    5151
    5252    public override IOperation Apply() {
  • branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/Interfaces/IScheduleDecoder.cs

    r12012 r13435  
    2424namespace HeuristicLab.Encodings.ScheduleEncoding {
    2525  public interface IScheduleDecoder : IOperator {
    26     ILookupParameter<IScheduleEncoding> ScheduleEncodingParameter { get; }
     26    ILookupParameter<ISchedule> ScheduleEncodingParameter { get; }
    2727    ILookupParameter<Schedule> ScheduleParameter { get; }
    2828  }
  • branches/ProblemRefactoring/HeuristicLab.Problems.Scheduling/3.3/JobShopSchedulingProblem.cs

    r13173 r13435  
    164164      ScheduleEvaluatorParameter.ValueChanged += ScheduleEvaluatorParameter_ValueChanged;
    165165      ScheduleEvaluator.QualityParameter.ActualNameChanged += ScheduleEvaluator_QualityParameter_ActualNameChanged;
    166       SolutionCreator.ScheduleEncodingParameter.ActualNameChanged += SolutionCreator_SchedulingEncodingParameter_ActualNameChanged;
     166      SolutionCreator.ScheduleParameter.ActualNameChanged += SolutionCreator_SchedulingEncodingParameter_ActualNameChanged;
    167167      ScheduleDecoderParameter.ValueChanged += ScheduleDecoderParameter_ValueChanged;
    168168      if (ScheduleDecoder != null) ScheduleDecoder.ScheduleParameter.ActualNameChanged += ScheduleDecoder_ScheduleParameter_ActualNameChanged;
     
    171171    #region Events
    172172    protected override void OnSolutionCreatorChanged() {
    173       SolutionCreator.ScheduleEncodingParameter.ActualNameChanged += SolutionCreator_SchedulingEncodingParameter_ActualNameChanged;
     173      SolutionCreator.ScheduleParameter.ActualNameChanged += SolutionCreator_SchedulingEncodingParameter_ActualNameChanged;
    174174      InitializeOperators();
    175175    }
     
    288288
    289289      if (ScheduleDecoder != null)
    290         ScheduleDecoder.ScheduleEncodingParameter.ActualName = SolutionCreator.ScheduleEncodingParameter.ActualName;
     290        ScheduleDecoder.ScheduleEncodingParameter.ActualName = SolutionCreator.ScheduleParameter.ActualName;
    291291
    292292      if (ScheduleDecoder != null) {
     
    295295      } else if (SolutionCreator is DirectScheduleRandomCreator) {
    296296        var directEvaluator = (DirectScheduleRandomCreator)SolutionCreator;
    297         ScheduleEvaluator.ScheduleParameter.ActualName = directEvaluator.ScheduleEncodingParameter.ActualName;
     297        ScheduleEvaluator.ScheduleParameter.ActualName = directEvaluator.ScheduleParameter.ActualName;
    298298        ScheduleEvaluator.ScheduleParameter.Hidden = true;
    299299      } else {
     
    303303
    304304      foreach (var op in Operators.OfType<IScheduleManipulator>()) {
    305         op.ScheduleEncodingParameter.ActualName = SolutionCreator.ScheduleEncodingParameter.ActualName;
    306         op.ScheduleEncodingParameter.Hidden = true;
     305        op.ScheduleParameter.ActualName = SolutionCreator.ScheduleParameter.ActualName;
     306        op.ScheduleParameter.Hidden = true;
    307307      }
    308308
    309309      foreach (var op in Operators.OfType<IScheduleCrossover>()) {
    310         op.ChildParameter.ActualName = SolutionCreator.ScheduleEncodingParameter.ActualName;
     310        op.ChildParameter.ActualName = SolutionCreator.ScheduleParameter.ActualName;
    311311        op.ChildParameter.Hidden = true;
    312         op.ParentsParameter.ActualName = SolutionCreator.ScheduleEncodingParameter.ActualName;
     312        op.ParentsParameter.ActualName = SolutionCreator.ScheduleParameter.ActualName;
    313313        op.ParentsParameter.Hidden = true;
    314314      }
     
    320320          op.ScheduleParameter.Hidden = true;
    321321        } else if (SolutionCreator is DirectScheduleRandomCreator) {
    322           op.ScheduleParameter.ActualName = ((DirectScheduleRandomCreator)SolutionCreator).ScheduleEncodingParameter.ActualName;
     322          op.ScheduleParameter.ActualName = ((DirectScheduleRandomCreator)SolutionCreator).ScheduleParameter.ActualName;
    323323          op.ScheduleParameter.Hidden = true;
    324324        } else {
Note: See TracChangeset for help on using the changeset viewer.