Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/22/17 15:01:46 (7 years ago)
Author:
bwerth
Message:

#2745 fixed bug concerning new Start and StartAsync methods; passed CancellationToken to sub algorithms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/EfficientGlobalOptimizationAlgorithm.cs

    r15064 r15338  
    4545    public override bool SupportsPause => true;
    4646    public override Type ProblemType => typeof(SingleObjectiveBasicProblem<IEncoding>);
    47     public new SingleObjectiveBasicProblem<IEncoding> Problem
    48     {
     47    public new SingleObjectiveBasicProblem<IEncoding> Problem {
    4948      get { return (SingleObjectiveBasicProblem<IEncoding>)base.Problem; }
    5049      set { base.Problem = value; }
     
    130129
    131130    #region ResultsProperties
    132     private double ResultsBestQuality
    133     {
     131    private double ResultsBestQuality {
    134132      get { return ((DoubleValue)Results[BestQualityResultName].Value).Value; }
    135133      set { ((DoubleValue)Results[BestQualityResultName].Value).Value = value; }
    136134    }
    137     private RealVector ResultsBestSolution
    138     {
     135    private RealVector ResultsBestSolution {
    139136      get { return (RealVector)Results[BestSolutionResultName].Value; }
    140137      set { Results[BestSolutionResultName].Value = value; }
    141138    }
    142     private int ResultsEvaluations
    143     {
     139    private int ResultsEvaluations {
    144140      get { return ((IntValue)Results[EvaluatedSoultionsResultName].Value).Value; }
    145141      set { ((IntValue)Results[EvaluatedSoultionsResultName].Value).Value = value; }
    146142    }
    147     private int ResultsIterations
    148     {
     143    private int ResultsIterations {
    149144      get { return ((IntValue)Results[IterationsResultName].Value).Value; }
    150145      set { ((IntValue)Results[IterationsResultName].Value).Value = value; }
     
    154149    private DataRow ResultsQualitiesWorst => ResultsQualities.Rows[WorstQualitiesRowResultName];
    155150    private DataRow ResultsQualitiesIteration => ResultsQualities.Rows[CurrentQualitiesRowResultName];
    156     private IRegressionSolution ResultsModel
    157     {
     151    private IRegressionSolution ResultsModel {
    158152      get { return (IRegressionSolution)Results[RegressionSolutionResultName].Value; }
    159153      set { Results[RegressionSolutionResultName].Value = value; }
     
    252246            Samples.Add(Evaluate(t));
    253247            cancellationToken.ThrowIfCancellationRequested();
    254           }
    255           finally {
     248          } finally {
    256249            Analyze();
    257250          }
     
    271264          }
    272265
    273         }
    274         finally {
     266        } finally {
    275267          Analyze();
    276268        }
     
    348340
    349341      while (solution == null && i++ < 100) {
    350         var results = EgoUtilities.SyncRunSubAlgorithm(RegressionAlgorithm, Random.Next(int.MaxValue));
     342        var results = EgoUtilities.SyncRunSubAlgorithm(RegressionAlgorithm, Random.Next(int.MaxValue), cancellationToken);
    351343        solution = results.Select(x => x.Value).OfType<IRegressionSolution>().SingleOrDefault();
    352344        cancellationToken.ThrowIfCancellationRequested();
     
    371363            solution = sol;
    372364          }
    373         }
    374         catch (ArgumentException) { }
     365        } catch (ArgumentException) { }
    375366      }
    376367
     
    405396      for (var i = 0; i < InfillOptimizationRestarts; i++) {
    406397        //optimize
    407         var res = EgoUtilities.SyncRunSubAlgorithm(InfillOptimizationAlgorithm, Random.Next(int.MaxValue));
     398        var res = EgoUtilities.SyncRunSubAlgorithm(InfillOptimizationAlgorithm, Random.Next(int.MaxValue), cancellationToken);
    408399        cancellationToken.ThrowIfCancellationRequested();
    409400        //extract results
Note: See TracChangeset for help on using the changeset viewer.