Changeset 11576 for branches/OptimizationNetworks/HeuristicLab.Problems.ExternalEvaluation.Scilab/3.3
- Timestamp:
- 11/25/14 03:26:00 (10 years ago)
- Location:
- branches/OptimizationNetworks
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks
- Property svn:mergeinfo changed
-
branches/OptimizationNetworks/HeuristicLab.Problems.ExternalEvaluation.Scilab/3.3/Plugin.cs.frame
r10605 r11576 28 28 /// Plugin class for HeuristicLab.Problems.ExternalEvaluation.Scilab plugin. 29 29 /// </summary> 30 [Plugin("HeuristicLab.Problems.ExternalEvaluation.Scilab", "3.3. 9.$WCREV$")]30 [Plugin("HeuristicLab.Problems.ExternalEvaluation.Scilab", "3.3.10.$WCREV$")] 31 31 [PluginFile("HeuristicLab.Problems.ExternalEvaluation.Scilab-3.3.dll", PluginFileType.Assembly)] 32 32 [PluginDependency("HeuristicLab.DotNetScilab", "1.0")] -
branches/OptimizationNetworks/HeuristicLab.Problems.ExternalEvaluation.Scilab/3.3/Properties/AssemblyInfo.cs.frame
r10594 r11576 31 31 [assembly: AssemblyCompany("")] 32 32 [assembly: AssemblyProduct("HeuristicLab")] 33 [assembly: AssemblyCopyright("(c) 2002-201 3HEAL")]33 [assembly: AssemblyCopyright("(c) 2002-2014 HEAL")] 34 34 [assembly: AssemblyTrademark("")] 35 35 [assembly: AssemblyCulture("")] … … 53 53 // by using the '*' as shown below: 54 54 [assembly: AssemblyVersion("3.3.0.0")] 55 [assembly: AssemblyFileVersion("3.3. 8.$WCREV$")]55 [assembly: AssemblyFileVersion("3.3.10.$WCREV$")] -
branches/OptimizationNetworks/HeuristicLab.Problems.ExternalEvaluation.Scilab/3.3/ScilabParameterOptimizationProblem.cs
r10595 r11576 75 75 Parameters.Add(new FixedValueParameter<StringValue>(QualityVariableParameterName, "The name of the quality variable of the Scilab script.", new StringValue("quality"))); 76 76 Parameters.Add(new FixedValueParameter<TextFileValue>(ScilabEvaluationScriptParameterName, "The path to the Scilab evaluation script.", new TextFileValue())); 77 Parameters.Add(new FixedValueParameter<TextFileValue>(ScilabInitializationScriptParameterName, "The path to a Scilab script th e should be execute before the evaluationstarts.", new TextFileValue()));77 Parameters.Add(new FixedValueParameter<TextFileValue>(ScilabInitializationScriptParameterName, "The path to a Scilab script that should be executed once when the algorithm starts.", new TextFileValue())); 78 78 79 79 ScilabEvaluationScript.FileDialogFilter = @"Scilab Scripts|*.sce|All files|*.*"; -
branches/OptimizationNetworks/HeuristicLab.Problems.ExternalEvaluation.Scilab/3.3/ScilabParameterVectorEvaluator.cs
r10605 r11576 35 35 [StorableClass] 36 36 public sealed class ScilabParameterVectorEvaluator : ParameterVectorEvaluator { 37 private const string MaximizationParameterName = "Maximization"; 37 38 private const string QualityVariableParameterName = "QualityVariableName"; 38 39 private const string ScilabEvaluationScriptParameterName = "ScilabEvaluationScript"; … … 40 41 41 42 #region parameters 43 public ILookupParameter<BoolValue> MaximizationParameter { 44 get { return (ILookupParameter<BoolValue>)Parameters[MaximizationParameterName]; } 45 } 42 46 public ILookupParameter<StringValue> QualityVariableParameter { 43 47 get { return (ILookupParameter<StringValue>)Parameters[QualityVariableParameterName]; } … … 62 66 public ScilabParameterVectorEvaluator() 63 67 : base() { 68 Parameters.Add(new LookupParameter<BoolValue>(MaximizationParameterName, "The flag which determines if this is a maximization problem.")); 64 69 Parameters.Add(new LookupParameter<StringValue>(QualityVariableParameterName, "The name of the quality variable of the Scilab script.")); 65 70 Parameters.Add(new LookupParameter<TextFileValue>(ScilabEvaluationScriptParameterName, "The path to the Scilab evaluation script.")); 66 Parameters.Add(new LookupParameter<TextFileValue>(ScilabInitializationScriptParameterName, "The path to a Scilab script th e should be execute before the evaluationstarts."));71 Parameters.Add(new LookupParameter<TextFileValue>(ScilabInitializationScriptParameterName, "The path to a Scilab script that should be executed once when the algorithm starts.")); 67 72 } 68 73 69 private readonly object locker = new object();74 private static readonly object locker = new object(); 70 75 private static ScilabConnector scilab = null; 71 76 private bool startedScilab = false; … … 80 85 81 86 int result; 82 //Scilab is used via a c++ wrapper that calls static methods. Hence it is not possible to parallelize the evaluation. 87 // Scilab is used via a c++ wrapper that calls static methods. Hence it is not possible to parallelize the evaluation. 88 // It is also not possible to run multiple algorithms solving separate Scilab optimization problems at the same time. 83 89 lock (locker) { 84 90 //initialize scilab and execute initialization script … … 96 102 var parameterVector = ParameterVectorParameter.ActualValue; 97 103 var parameterNames = ParameterNamesParameter.ActualValue; 98 if (parameterNames.Any(string.IsNullOrEmpty)) throw new ArgumentException("Not all parameter names are provided."); 104 if (parameterNames.Any(string.IsNullOrEmpty)) throw new ArgumentException("Not all parameter names are provided. Change the 'ParameterNames' parameter in the 'Problem' tab."); 105 if (ProblemSizeParameter.ActualValue.Value != parameterVector.Length || ProblemSizeParameter.ActualValue.Value != parameterNames.Length) 106 throw new ArgumentException("The size of the parameter vector or the parameter names vector does not match the problem size."); 99 107 100 108 for (int i = 0; i < ProblemSizeParameter.ActualValue.Value; i++) { … … 112 120 double quality = values[0]; 113 121 114 if (double.IsNaN(quality)) quality = double.MaxValue; 115 if (double.IsInfinity(quality)) quality = double.MaxValue; 122 var worstQualityValue = MaximizationParameter.ActualValue.Value ? double.MinValue : double.MaxValue; 123 if (double.IsNaN(quality)) quality = worstQualityValue; 124 if (double.IsInfinity(quality)) quality = worstQualityValue; 116 125 117 126 QualityParameter.ActualValue = new DoubleValue(quality);
Note: See TracChangeset
for help on using the changeset viewer.