- Timestamp:
- 02/05/15 10:19:37 (10 years ago)
- Location:
- branches/ProgrammableProblem/HeuristicLab.Problems.ExternalEvaluation/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProgrammableProblem/HeuristicLab.Problems.ExternalEvaluation/3.4/ExternalEvaluationProblem.cs
r11899 r11900 79 79 [StorableConstructor] 80 80 private ExternalEvaluationProblem(bool deserializing) : base(deserializing) { } 81 private ExternalEvaluationProblem(ExternalEvaluationProblem original, Cloner cloner) 82 : base(original, cloner) { 83 CompileSupportScript(); 84 } 81 private ExternalEvaluationProblem(ExternalEvaluationProblem original, Cloner cloner) : base(original, cloner) { } 85 82 public override IDeepCloneable Clone(Cloner cloner) { 86 83 return new ExternalEvaluationProblem(this, cloner); … … 92 89 Parameters.Add(new ValueParameter<SolutionMessageBuilder>("MessageBuilder", "The message builder that converts from HeuristicLab objects to SolutionMessage representation.", new SolutionMessageBuilder())); 93 90 Parameters.Add(new FixedValueParameter<SingleObjectiveOptimizationSupportScript>("SupportScript", "A script that can provide neighborhood and analyze the results of the optimization.", new SingleObjectiveOptimizationSupportScript())); 94 CompileSupportScript();95 }96 97 [StorableHook(HookType.AfterDeserialization)]98 private void AfterDeserialization() {99 CompileSupportScript();100 }101 102 private void CompileSupportScript() {103 try {104 OptimizationSupportScript.Compile();105 } catch (SingleObjectiveOptimizationSupportException ex) {106 PluginInfrastructure.ErrorHandling.ShowErrorDialog("Support script doesn't compile.", ex);107 }108 91 } 109 92 -
branches/ProgrammableProblem/HeuristicLab.Problems.ExternalEvaluation/3.4/Programmable/SingleObjectiveOptimizationSupportScript.cs
r11893 r11900 62 62 } 63 63 64 private readonly object compileLock = new object(); 64 65 private volatile ISingleObjectiveOptimizationSupport compiledInstance; 65 66 private ISingleObjectiveOptimizationSupport CompiledInstance { 66 67 get { 67 if (compiledInstance == null) throw new InvalidOperationException("The problem definition script is not compiled and cannot be used."); 68 if (compiledInstance == null) { 69 lock (compileLock) { 70 if (compiledInstance == null) { 71 Compile(); 72 } 73 } 74 } 68 75 return compiledInstance; 69 76 }
Note: See TracChangeset
for help on using the changeset viewer.