Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8493


Ignore:
Timestamp:
08/16/12 12:57:09 (12 years ago)
Author:
abeham
Message:

#1910: fixed handling of problem size changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs

    r8334 r8493  
    139139    protected override void OnEvaluatorChanged() {
    140140      base.OnEvaluatorChanged();
    141       ParameterizeEvaluator();
     141      bool problemSizeChange = ProblemSize.Value < Evaluator.MinimumProblemSize
     142        || ProblemSize.Value > Evaluator.MaximumProblemSize;
     143      if (problemSizeChange) {
     144        ProblemSize.Value = Math.Max(Evaluator.MinimumProblemSize, Math.Min(ProblemSize.Value, Evaluator.MaximumProblemSize));
     145      } else {
     146        ParameterizeEvaluator();
     147      }
    142148      UpdateMoveEvaluators();
    143149      ParameterizeAnalyzers();
    144150      Maximization.Value = Evaluator.Maximization;
    145151      BoundsParameter.Value = Evaluator.Bounds;
    146       if (ProblemSize.Value < Evaluator.MinimumProblemSize)
    147         ProblemSize.Value = Evaluator.MinimumProblemSize;
    148       else if (ProblemSize.Value > Evaluator.MaximumProblemSize)
    149         ProblemSize.Value = Evaluator.MaximumProblemSize;
    150152      BestKnownQuality = new DoubleValue(Evaluator.BestKnownQuality);
    151153      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
     
    312314      Evaluator.PointParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
    313315      Evaluator.PointParameter.Hidden = true;
    314       BestKnownSolutionParameter.Value = Evaluator.GetBestKnownSolution(ProblemSize.Value);
     316      try {
     317        BestKnownSolutionParameter.Value = Evaluator.GetBestKnownSolution(ProblemSize.Value);
     318      } catch (ArgumentException e) {
     319        ErrorHandling.ShowErrorDialog(e);
     320        ProblemSize.Value = Evaluator.MinimumProblemSize;
     321      }
    315322    }
    316323    private void ParameterizeOperators() {
Note: See TracChangeset for help on using the changeset viewer.