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(ResourceDemand), "")]
|
---|
10 | [StorableClass]
|
---|
11 | public sealed class ResourceDemand : ParameterizedNamedItem {
|
---|
12 | //public ResourceDemand()
|
---|
13 | // : this() {
|
---|
14 | //}
|
---|
15 |
|
---|
16 | [Storable]
|
---|
17 | private readonly IFixedValueParameter<IntValue> demandParam;
|
---|
18 |
|
---|
19 | [Storable]
|
---|
20 | private readonly IFixedValueParameter<IntValue> numberParam;
|
---|
21 |
|
---|
22 | public ResourceDemand() {
|
---|
23 | Parameters.Add(numberParam = new FixedValueParameter<IntValue>(nameof(Number), new IntValue()));
|
---|
24 | Parameters.Add(demandParam = new FixedValueParameter<IntValue>(nameof(Demand), new IntValue()));
|
---|
25 | }
|
---|
26 |
|
---|
27 | public override string ToString() => $"{Name} (Resource {Number})";
|
---|
28 |
|
---|
29 | [StorableConstructor]
|
---|
30 | private ResourceDemand(bool deserializing)
|
---|
31 | : base(deserializing) { }
|
---|
32 |
|
---|
33 | private ResourceDemand(ResourceDemand original, Cloner cloner)
|
---|
34 | : base(original, cloner) {
|
---|
35 | numberParam = cloner.Clone(original.numberParam);
|
---|
36 | demandParam = cloner.Clone(original.demandParam);
|
---|
37 | }
|
---|
38 |
|
---|
39 | public int Demand {
|
---|
40 | get => demandParam.Value.Value;
|
---|
41 | set => demandParam.Value.Value = value;
|
---|
42 | }
|
---|
43 |
|
---|
44 | public int Number {
|
---|
45 | get => numberParam.Value.Value;
|
---|
46 | set => numberParam.Value.Value = value;
|
---|
47 | }
|
---|
48 |
|
---|
49 | public override IDeepCloneable Clone(Cloner cloner) => new ResourceDemand(this, cloner);
|
---|
50 | }
|
---|
51 | }
|
---|