Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/08/14 20:02:59 (10 years ago)
Author:
mkommend
Message:

#2171: Merged r10601:r10607, r10653, r11075, r11076, r11077, r11080, r11081 into stable.

Location:
stable
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable

    • Property svn:ignore
      •  

        old new  
        88FxCopResults.txt
        99Google.ProtocolBuffers-0.9.1.dll
         10Google.ProtocolBuffers-2.4.1.473.dll
        1011HeuristicLab 3.3.5.1.ReSharper.user
        1112HeuristicLab 3.3.6.0.ReSharper.user
        1213HeuristicLab.4.5.resharper.user
        1314HeuristicLab.ExtLibs.6.0.ReSharper.user
         15HeuristicLab.Scripting.Development
        1416HeuristicLab.resharper.user
        1517ProtoGen.exe
         
        1719_ReSharper.HeuristicLab
        1820_ReSharper.HeuristicLab 3.3
         21_ReSharper.HeuristicLab 3.3 Tests
        1922_ReSharper.HeuristicLab.ExtLibs
        2023bin
        2124protoc.exe
        22 _ReSharper.HeuristicLab 3.3 Tests
        23 Google.ProtocolBuffers-2.4.1.473.dll
    • Property svn:mergeinfo changed
      /trunk/sourcesmerged: 10601-10607,​10653,​11075-11077,​11080-11081
  • stable/HeuristicLab.Problems.ExternalEvaluation.Scilab/3.3/ScilabParameterVectorEvaluator.cs

    r10605 r11151  
    3535  [StorableClass]
    3636  public sealed class ScilabParameterVectorEvaluator : ParameterVectorEvaluator {
     37    private const string MaximizationParameterName = "Maximization";
    3738    private const string QualityVariableParameterName = "QualityVariableName";
    3839    private const string ScilabEvaluationScriptParameterName = "ScilabEvaluationScript";
     
    4041
    4142    #region parameters
     43    public ILookupParameter<BoolValue> MaximizationParameter {
     44      get { return (ILookupParameter<BoolValue>)Parameters[MaximizationParameterName]; }
     45    }
    4246    public ILookupParameter<StringValue> QualityVariableParameter {
    4347      get { return (ILookupParameter<StringValue>)Parameters[QualityVariableParameterName]; }
     
    6266    public ScilabParameterVectorEvaluator()
    6367      : base() {
     68      Parameters.Add(new LookupParameter<BoolValue>(MaximizationParameterName, "The flag which determines if this is a maximization problem."));
    6469      Parameters.Add(new LookupParameter<StringValue>(QualityVariableParameterName, "The name of the quality variable of the Scilab script."));
    6570      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 the should be execute before the evaluation starts."));
     71      Parameters.Add(new LookupParameter<TextFileValue>(ScilabInitializationScriptParameterName, "The path to a Scilab script that should be executed once when the algorithm starts."));
    6772    }
    6873
    69     private readonly object locker = new object();
     74    private static readonly object locker = new object();
    7075    private static ScilabConnector scilab = null;
    7176    private bool startedScilab = false;
     
    8085
    8186      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.
    8389      lock (locker) {
    8490        //initialize scilab and execute initialization script
     
    96102        var parameterVector = ParameterVectorParameter.ActualValue;
    97103        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.");
    99107
    100108        for (int i = 0; i < ProblemSizeParameter.ActualValue.Value; i++) {
     
    112120        double quality = values[0];
    113121
    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;
    116125
    117126        QualityParameter.ActualValue = new DoubleValue(quality);
Note: See TracChangeset for help on using the changeset viewer.