- Timestamp:
- 09/26/14 22:57:18 (10 years ago)
- Location:
- branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators/ParameterVectorMoveEvaluator.cs
r11363 r11393 43 43 } 44 44 45 public ILookupParameter< SingleObjectiveScript> ScriptParameter {46 get { return (ILookupParameter< SingleObjectiveScript>)Parameters["Script"]; }45 public ILookupParameter<ISingleObjectiveProblemDefinitionHost> ProblemDefinitionParameter { 46 get { return (ILookupParameter<ISingleObjectiveProblemDefinitionHost>)Parameters["ProblemDefinition"]; } 47 47 } 48 48 … … 64 64 public ParameterVectorMoveEvaluator() { 65 65 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use.")); 66 Parameters.Add(new LookupParameter< SingleObjectiveScript>("Script", "The script that will execute the evaluation function and define the parameter vector."));66 Parameters.Add(new LookupParameter<ISingleObjectiveProblemDefinitionHost>("ProblemDefinition", "The host that holds the problem definition.")); 67 67 Parameters.Add(new LookupParameter<Configuration>("Configuration", "An item that holds the problem's configuration.")); 68 68 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the parameter vector.")); … … 76 76 public override IOperation InstrumentedApply() { 77 77 var random = RandomParameter.ActualValue; 78 var runner = ScriptParameter.ActualValue;79 if ( runner.Instance == null) throw new InvalidOperationException("Script instance is null, maybe the code doesn't compile.");78 var host = ProblemDefinitionParameter.ActualValue; 79 if (host.Instance == null) throw new InvalidOperationException("Problem definition instance is null."); 80 80 var config = ConfigurationParameter.ActualValue; 81 81 var binDict = new Dictionary<string, BinaryVector>(); … … 111 111 realVectors: realDict.Count > 0 ? realDict : null, 112 112 permutations: permDict.Count > 0 ? permDict : null); 113 MoveQualityParameter.ActualValue = new DoubleValue( runner.Instance.Evaluate(random, vector));113 MoveQualityParameter.ActualValue = new DoubleValue(host.Instance.Evaluate(random, vector)); 114 114 return base.InstrumentedApply(); 115 115 } -
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators/ParameterVectorMoveGenerator.cs
r11363 r11393 48 48 } 49 49 50 public ILookupParameter< SingleObjectiveScript> ScriptParameter {51 get { return (ILookupParameter< SingleObjectiveScript>)Parameters["Script"]; }50 public ILookupParameter<ISingleObjectiveProblemDefinitionHost> ProblemDefinitionParameter { 51 get { return (ILookupParameter<ISingleObjectiveProblemDefinitionHost>)Parameters["ProblemDefinition"]; } 52 52 } 53 53 … … 63 63 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use.")); 64 64 Parameters.Add(new ValueLookupParameter<IntValue>("SampleSize", "The number of moves to sample.")); 65 Parameters.Add(new LookupParameter< SingleObjectiveScript>("Script", "The script that will execute the evaluation function and define the parameter vector."));65 Parameters.Add(new LookupParameter<ISingleObjectiveProblemDefinitionHost>("ProblemDefinition", "The host that holds the problem definition.")); 66 66 Parameters.Add(new LookupParameter<Configuration>("Configuration", "An item that holds the problem's configuration.")); 67 67 } … … 73 73 public override IOperation InstrumentedApply() { 74 74 var random = RandomParameter.ActualValue; 75 var runner = ScriptParameter.ActualValue;76 if ( runner.Instance == null) throw new InvalidOperationException("Script instance is null, maybe the code doesn't compile.");75 var host = ProblemDefinitionParameter.ActualValue; 76 if (host.Instance == null) throw new InvalidOperationException("Problem definition instance is null."); 77 77 var sampleSize = SampleSizeParameter.ActualValue.Value; 78 78 var config = ConfigurationParameter.ActualValue; … … 109 109 realVectors: realDict.Count > 0 ? realDict : null, 110 110 permutations: permDict.Count > 0 ? permDict : null); 111 var nbhood = runner.Instance.GetNeighbors(random, vector).Take(sampleSize).ToList();111 var nbhood = host.Instance.GetNeighbors(random, vector).Take(sampleSize).ToList(); 112 112 113 113 var moveScopes = new Scope[nbhood.Count]; -
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators/ParameterVectorMoveMaker.cs
r11363 r11393 50 50 protected ParameterVectorMoveMaker(ParameterVectorMoveMaker original, Cloner cloner) : base(original, cloner) { } 51 51 public ParameterVectorMoveMaker() { 52 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));53 Parameters.Add(new LookupParameter<SingleObjectiveScript>("Script", "The script that will execute the evaluation function and define the parameter vector."));54 52 Parameters.Add(new LookupParameter<Configuration>("Configuration", "An item that holds the problem's configuration.")); 55 53 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the parameter vector.")); -
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators/SingleObjectiveEvaluator.cs
r10850 r11393 43 43 } 44 44 45 public ILookupParameter< SingleObjectiveScript> ScriptParameter {46 get { return (ILookupParameter< SingleObjectiveScript>)Parameters["Script"]; }45 public ILookupParameter<ISingleObjectiveProblemDefinitionHost> ProblemDefinitionParameter { 46 get { return (ILookupParameter<ISingleObjectiveProblemDefinitionHost>)Parameters["ProblemDefinition"]; } 47 47 } 48 48 … … 60 60 public SingleObjectiveEvaluator() { 61 61 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use.")); 62 Parameters.Add(new LookupParameter< SingleObjectiveScript>("Script", "The script that will execute the evaluation function and define the parameter vector."));62 Parameters.Add(new LookupParameter<ISingleObjectiveProblemDefinitionHost>("ProblemDefinition", "The host that holds the problem definition.")); 63 63 Parameters.Add(new LookupParameter<Configuration>("Configuration", "An item that holds the problem's configuration.")); 64 64 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the parameter vector.")); … … 71 71 public override IOperation Apply() { 72 72 var random = RandomParameter.ActualValue; 73 var runner = ScriptParameter.ActualValue;74 if ( runner.Instance == null) throw new InvalidOperationException("Script instance is null, maybe the code doesn't compile.");73 var host = ProblemDefinitionParameter.ActualValue; 74 if (host.Instance == null) throw new InvalidOperationException("Script instance is null, maybe the code doesn't compile."); 75 75 var config = ConfigurationParameter.ActualValue; 76 76 var binDict = new Dictionary<string, BinaryVector>(); … … 106 106 realVectors: realDict.Count > 0 ? realDict : null, 107 107 permutations: permDict.Count > 0 ? permDict : null); 108 QualityParameter.ActualValue = new DoubleValue( runner.Instance.Evaluate(random, vector));108 QualityParameter.ActualValue = new DoubleValue(host.Instance.Evaluate(random, vector)); 109 109 return base.Apply(); 110 110 }
Note: See TracChangeset
for help on using the changeset viewer.