#region License Information /* HeuristicLab * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using System.Collections.Generic; using System.Linq; using System.Text; using HeuristicLab.Core; using HeuristicLab.Parameters; using HeuristicLab.Common; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; using HeuristicLab.Problems.Scheduling.Interfaces; namespace HeuristicLab.Problems.Scheduling.Encodings { public abstract class JSSPDecoder : JSSPOperator, ISchedulingDecoder where T : Item, ISchedulingEncoding { [StorableConstructor] protected JSSPDecoder(bool deserializing) : base(deserializing) { } protected JSSPDecoder(JSSPDecoder original, Cloner cloner) : base(original, cloner) { } public ILookupParameter SchedulingSolutionParameter { get { return (ILookupParameter)Parameters["SchedulingSolution"]; } } public ILookupParameter DecodedSchedulingSolutionParameter { get { return (ILookupParameter)Parameters["DecodedSchedulingSolution"]; } } public JSSPDecoder() : base() { Parameters.Add(new LookupParameter("SchedulingSolution", "The new scheduling solution represented as encoding.")); Parameters.Add(new LookupParameter("DecodedSchedulingSolution", "The decoded scheduling solution represented as generalized schedule.")); } public abstract Schedule CreateScheduleFromEncoding(T solution); public override IOperation Apply() { Schedule result = CreateScheduleFromEncoding(SchedulingSolutionParameter.ActualValue); DecodedSchedulingSolutionParameter.ActualValue = result; return base.Apply(); } } }