Free cookie consent management tool by TermsFeed Policy Generator

source: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/CVRPTWProblemInstance.cs @ 4362

Last change on this file since 4362 was 4362, checked in by svonolfe, 14 years ago

Added initial version - WIP (#1177)

File size: 4.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Linq;
25using System.Text;
26using HeuristicLab.Problems.VehicleRouting.Interfaces;
27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
28using HeuristicLab.Core;
29using HeuristicLab.Parameters;
30using HeuristicLab.Data;
31using HeuristicLab.Optimization;
32using HeuristicLab.PluginInfrastructure;
33using HeuristicLab.Problems.VehicleRouting.Interfaces.Variants;
34
35namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances {
36  [Item("CVRPTWProblemInstance", "Represents a single depot CVRPTW instance.")]
37  [StorableClass]
38  public class CVRPTWProblemInstance: CVRPProblemInstance, ITimeWindowedProblemInstance {
39    protected ValueParameter<DoubleArray> ReadyTimeParameter {
40      get { return (ValueParameter<DoubleArray>)Parameters["ReadyTime"]; }
41    }
42    protected ValueParameter<DoubleArray> DueTimeParameter {
43      get { return (ValueParameter<DoubleArray>)Parameters["DueTime"]; }
44    }
45    protected ValueParameter<DoubleArray> ServiceTimeParameter {
46      get { return (ValueParameter<DoubleArray>)Parameters["ServiceTime"]; }
47    }
48
49    protected IValueParameter<DoubleValue> TimeFactorParameter {
50      get { return (IValueParameter<DoubleValue>)Parameters["EvalTimeFactor"]; }
51    }
52    public IValueParameter<DoubleValue> TardinessPenaltyParameter {
53      get { return (IValueParameter<DoubleValue>)Parameters["EvalTardinessPenalty"]; }
54    }
55
56    public DoubleArray ReadyTime {
57      get { return ReadyTimeParameter.Value; }
58      set { ReadyTimeParameter.Value = value; }
59    }
60    public DoubleArray DueTime {
61      get { return DueTimeParameter.Value; }
62      set { DueTimeParameter.Value = value; }
63    }
64    public DoubleArray ServiceTime {
65      get { return ServiceTimeParameter.Value; }
66      set { ServiceTimeParameter.Value = value; }
67    }
68    public DoubleValue TimeFactor {
69      get { return TimeFactorParameter.Value; }
70      set { TimeFactorParameter.Value = value; }
71    }
72    public DoubleValue TardinessPenalty {
73      get { return TardinessPenaltyParameter.Value; }
74      set { TardinessPenaltyParameter.Value = value; }
75    }
76   
77    public override IEnumerable<IOperator> Operators {
78      get {
79        return base.Operators
80          .Where(o => o is ITimeWindowedOperator).Cast<IOperator>();
81      }
82    }
83   
84    [StorableConstructor]
85    protected CVRPTWProblemInstance(bool deserializing) : base(deserializing) { }
86
87    public CVRPTWProblemInstance() {
88      Parameters.Add(new ValueParameter<DoubleArray>("ReadyTime", "The ready time of each customer.", new DoubleArray()));
89      Parameters.Add(new ValueParameter<DoubleArray>("DueTime", "The due time of each customer.", new DoubleArray()));
90      Parameters.Add(new ValueParameter<DoubleArray>("ServiceTime", "The service time of each customer.", new DoubleArray()));
91
92      Parameters.Add(new ValueParameter<DoubleValue>("EvalTimeFactor", "The time factor considered in the evaluation.", new DoubleValue(0)));
93      Parameters.Add(new ValueParameter<DoubleValue>("EvalTardinessPenalty", "The tardiness penalty considered in the evaluation.", new DoubleValue(100)));
94    }
95  }
96}
Note: See TracBrowser for help on using the repository browser.