Changeset 15338 for branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/EfficientGlobalOptimizationAlgorithm.cs
- Timestamp:
- 08/22/17 15:01:46 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/EfficientGlobalOptimizationAlgorithm.cs
r15064 r15338 45 45 public override bool SupportsPause => true; 46 46 public override Type ProblemType => typeof(SingleObjectiveBasicProblem<IEncoding>); 47 public new SingleObjectiveBasicProblem<IEncoding> Problem 48 { 47 public new SingleObjectiveBasicProblem<IEncoding> Problem { 49 48 get { return (SingleObjectiveBasicProblem<IEncoding>)base.Problem; } 50 49 set { base.Problem = value; } … … 130 129 131 130 #region ResultsProperties 132 private double ResultsBestQuality 133 { 131 private double ResultsBestQuality { 134 132 get { return ((DoubleValue)Results[BestQualityResultName].Value).Value; } 135 133 set { ((DoubleValue)Results[BestQualityResultName].Value).Value = value; } 136 134 } 137 private RealVector ResultsBestSolution 138 { 135 private RealVector ResultsBestSolution { 139 136 get { return (RealVector)Results[BestSolutionResultName].Value; } 140 137 set { Results[BestSolutionResultName].Value = value; } 141 138 } 142 private int ResultsEvaluations 143 { 139 private int ResultsEvaluations { 144 140 get { return ((IntValue)Results[EvaluatedSoultionsResultName].Value).Value; } 145 141 set { ((IntValue)Results[EvaluatedSoultionsResultName].Value).Value = value; } 146 142 } 147 private int ResultsIterations 148 { 143 private int ResultsIterations { 149 144 get { return ((IntValue)Results[IterationsResultName].Value).Value; } 150 145 set { ((IntValue)Results[IterationsResultName].Value).Value = value; } … … 154 149 private DataRow ResultsQualitiesWorst => ResultsQualities.Rows[WorstQualitiesRowResultName]; 155 150 private DataRow ResultsQualitiesIteration => ResultsQualities.Rows[CurrentQualitiesRowResultName]; 156 private IRegressionSolution ResultsModel 157 { 151 private IRegressionSolution ResultsModel { 158 152 get { return (IRegressionSolution)Results[RegressionSolutionResultName].Value; } 159 153 set { Results[RegressionSolutionResultName].Value = value; } … … 252 246 Samples.Add(Evaluate(t)); 253 247 cancellationToken.ThrowIfCancellationRequested(); 254 } 255 finally { 248 } finally { 256 249 Analyze(); 257 250 } … … 271 264 } 272 265 273 } 274 finally { 266 } finally { 275 267 Analyze(); 276 268 } … … 348 340 349 341 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); 351 343 solution = results.Select(x => x.Value).OfType<IRegressionSolution>().SingleOrDefault(); 352 344 cancellationToken.ThrowIfCancellationRequested(); … … 371 363 solution = sol; 372 364 } 373 } 374 catch (ArgumentException) { } 365 } catch (ArgumentException) { } 375 366 } 376 367 … … 405 396 for (var i = 0; i < InfillOptimizationRestarts; i++) { 406 397 //optimize 407 var res = EgoUtilities.SyncRunSubAlgorithm(InfillOptimizationAlgorithm, Random.Next(int.MaxValue) );398 var res = EgoUtilities.SyncRunSubAlgorithm(InfillOptimizationAlgorithm, Random.Next(int.MaxValue), cancellationToken); 408 399 cancellationToken.ThrowIfCancellationRequested(); 409 400 //extract results
Note: See TracChangeset
for help on using the changeset viewer.