1 | using HeuristicLab.Common;
|
---|
2 | using HeuristicLab.Core;
|
---|
3 | using HeuristicLab.Data;
|
---|
4 | using HeuristicLab.Encodings.BinaryVectorEncoding;
|
---|
5 | using HeuristicLab.Parameters;
|
---|
6 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
7 | using HeuristicLab.Encodings.PermutationEncoding;
|
---|
8 |
|
---|
9 | namespace HeuristicLab.Analysis.FitnessLandscape.MultiTrajectory {
|
---|
10 |
|
---|
11 | [StorableClass]
|
---|
12 | public class PreassignePermutationCreator : PreassignedSolutionCreator, IPermutationCreator {
|
---|
13 |
|
---|
14 | public IValueParameter<PermutationType> PermutationTypeParameter {
|
---|
15 | get { return (IValueParameter<PermutationType>)Parameters["PermutationType"]; }
|
---|
16 | }
|
---|
17 |
|
---|
18 | public ILookupParameter<Permutation> PermutationParameter {
|
---|
19 | get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; }
|
---|
20 | }
|
---|
21 |
|
---|
22 | public IValueLookupParameter<IntValue> LengthParameter {
|
---|
23 | get { return (IValueLookupParameter<IntValue>)Parameters["Length"]; }
|
---|
24 | }
|
---|
25 |
|
---|
26 | [StorableConstructor]
|
---|
27 | protected PreassignePermutationCreator(bool deserializing) : base(deserializing) { }
|
---|
28 | protected PreassignePermutationCreator(PreassignePermutationCreator original, Cloner cloner)
|
---|
29 | : base(original, cloner) {
|
---|
30 | }
|
---|
31 | public PreassignePermutationCreator() {
|
---|
32 | Parameters.Add(new LookupParameter<Permutation>("Permutation", "The created permutation."));
|
---|
33 | Parameters.Add(new ValueLookupParameter<IntValue>("Length", "The length of the permutation."));
|
---|
34 | Parameters.Add(new ValueParameter<PermutationType>("PermutationType", "The type of permutation (absolute, relative (direcected/undirected)."));
|
---|
35 | }
|
---|
36 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
37 | return new PreassignePermutationCreator(this, cloner);
|
---|
38 | }
|
---|
39 |
|
---|
40 | public override void Create(IScope scope) {
|
---|
41 | PermutationParameter.ActualValue = (Permutation)scope.Variables[PermutationParameter.ActualName].Value;
|
---|
42 | }
|
---|
43 |
|
---|
44 | }
|
---|
45 | }
|
---|