1 | using HeuristicLab.Common;
|
---|
2 | using HeuristicLab.Core;
|
---|
3 | using HeuristicLab.Data;
|
---|
4 | using HeuristicLab.Parameters;
|
---|
5 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
6 |
|
---|
7 | namespace HeuristicLab.Problems.Scheduling.MRCPSP {
|
---|
8 |
|
---|
9 | [Item(nameof(Mode), "")]
|
---|
10 | [StorableClass]
|
---|
11 | public sealed class Mode : ParameterizedNamedItem {
|
---|
12 | //public Mode()
|
---|
13 | // : this() {
|
---|
14 | //}
|
---|
15 |
|
---|
16 | [Storable]
|
---|
17 | private readonly IFixedValueParameter<IntValue> durationParam;
|
---|
18 |
|
---|
19 | [Storable]
|
---|
20 | private readonly IFixedValueParameter<IntValue> numberParam;
|
---|
21 |
|
---|
22 | [Storable]
|
---|
23 | private readonly IValueParameter<ItemList<ResourceDemand>> resourceDemandsParam;
|
---|
24 |
|
---|
25 | public Mode() {
|
---|
26 | Parameters.Add(numberParam = new FixedValueParameter<IntValue>(nameof(Number), new IntValue()));
|
---|
27 | Parameters.Add(resourceDemandsParam = new ValueParameter<ItemList<ResourceDemand>>(nameof(ResourceDemands), new ItemList<ResourceDemand>()));
|
---|
28 | Parameters.Add(durationParam = new FixedValueParameter<IntValue>(nameof(Duration), new IntValue()));
|
---|
29 | }
|
---|
30 |
|
---|
31 | [StorableConstructor]
|
---|
32 | private Mode(bool deserializing)
|
---|
33 | : base(deserializing) { }
|
---|
34 |
|
---|
35 | private Mode(Mode original, Cloner cloner)
|
---|
36 | : base(original, cloner) {
|
---|
37 | numberParam = cloner.Clone(original.numberParam);
|
---|
38 | resourceDemandsParam = cloner.Clone(original.resourceDemandsParam);
|
---|
39 | durationParam = cloner.Clone(original.durationParam);
|
---|
40 | }
|
---|
41 |
|
---|
42 | public int Duration {
|
---|
43 | get => durationParam.Value.Value;
|
---|
44 | set => durationParam.Value.Value = value;
|
---|
45 | }
|
---|
46 |
|
---|
47 | public int Number {
|
---|
48 | get => numberParam.Value.Value;
|
---|
49 | set => numberParam.Value.Value = value;
|
---|
50 | }
|
---|
51 |
|
---|
52 | public ItemList<ResourceDemand> ResourceDemands {
|
---|
53 | get => resourceDemandsParam.Value;
|
---|
54 | set => resourceDemandsParam.Value = value;
|
---|
55 | }
|
---|
56 |
|
---|
57 | public override IDeepCloneable Clone(Cloner cloner) => new Mode(this, cloner);
|
---|
58 |
|
---|
59 | public override string ToString() => $"{Name} (Mode {Number})";
|
---|
60 | }
|
---|
61 | }
|
---|