#region License Information /* HeuristicLab * Copyright (C) 2002-2010 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.Problems.VehicleRouting.Interfaces; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; using HeuristicLab.Core; using HeuristicLab.Parameters; using HeuristicLab.Data; using HeuristicLab.Optimization; using HeuristicLab.PluginInfrastructure; using HeuristicLab.Problems.VehicleRouting.Variants; namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { [Item("CVRPTWProblemInstance", "Represents a single depot CVRPTW instance.")] [StorableClass] public class CVRPTWProblemInstance: CVRPProblemInstance, ITimeWindowedProblemInstance { protected IValueParameter ReadyTimeParameter { get { return (IValueParameter)Parameters["ReadyTime"]; } } protected IValueParameter DueTimeParameter { get { return (IValueParameter)Parameters["DueTime"]; } } protected IValueParameter ServiceTimeParameter { get { return (IValueParameter)Parameters["ServiceTime"]; } } protected IValueParameter TimeFactorParameter { get { return (IValueParameter)Parameters["EvalTimeFactor"]; } } protected IValueParameter TardinessPenaltyParameter { get { return (IValueParameter)Parameters["EvalTardinessPenalty"]; } } public DoubleArray ReadyTime { get { return ReadyTimeParameter.Value; } set { ReadyTimeParameter.Value = value; } } public DoubleArray DueTime { get { return DueTimeParameter.Value; } set { DueTimeParameter.Value = value; } } public DoubleArray ServiceTime { get { return ServiceTimeParameter.Value; } set { ServiceTimeParameter.Value = value; } } public DoubleValue TimeFactor { get { return TimeFactorParameter.Value; } set { TimeFactorParameter.Value = value; } } public DoubleValue TardinessPenalty { get { return TardinessPenaltyParameter.Value; } set { TardinessPenaltyParameter.Value = value; } } protected override IEnumerable GetOperators() { return base.GetOperators() .Where(o => o is ITimeWindowedOperator).Cast(); } protected override IEnumerable GetAnalyzers() { return ApplicationManager.Manager.GetInstances() .Where(o => o is IAnalyzer) .Cast().Union(base.GetAnalyzers()); } protected override IVRPEvaluator Evaluator { get { return new CVRPTWEvaluator(); } } [StorableConstructor] protected CVRPTWProblemInstance(bool deserializing) : base(deserializing) { } public CVRPTWProblemInstance() { Parameters.Add(new ValueParameter("ReadyTime", "The ready time of each customer.", new DoubleArray())); Parameters.Add(new ValueParameter("DueTime", "The due time of each customer.", new DoubleArray())); Parameters.Add(new ValueParameter("ServiceTime", "The service time of each customer.", new DoubleArray())); Parameters.Add(new ValueParameter("EvalTimeFactor", "The time factor considered in the evaluation.", new DoubleValue(0))); Parameters.Add(new ValueParameter("EvalTardinessPenalty", "The tardiness penalty considered in the evaluation.", new DoubleValue(100))); } } }