[14420] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
| 3 | * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
| 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
[14450] | 21 |
|
---|
[14420] | 22 | using System.Collections.Generic;
|
---|
[14552] | 23 | using System.Threading;
|
---|
[14420] | 24 | using HeuristicLab.Algorithms.MemPR.Binary;
|
---|
[14544] | 25 | using HeuristicLab.Algorithms.MemPR.Grouping;
|
---|
[14450] | 26 | using HeuristicLab.Algorithms.MemPR.Permutation;
|
---|
[14420] | 27 | using HeuristicLab.Core;
|
---|
| 28 | using HeuristicLab.Encodings.BinaryVectorEncoding;
|
---|
[14450] | 29 | using HeuristicLab.Optimization;
|
---|
[14420] | 30 |
|
---|
[14450] | 31 | namespace HeuristicLab.Algorithms.MemPR.Interfaces {
|
---|
[14420] | 32 |
|
---|
[14450] | 33 | /*************************************************
|
---|
| 34 | * ********************************************* *
|
---|
| 35 | * DATA *
|
---|
| 36 | * ********************************************* *
|
---|
| 37 | *************************************************/
|
---|
[14420] | 38 |
|
---|
| 39 | public interface ISolutionModel<TSolution> : IItem {
|
---|
| 40 | TSolution Sample();
|
---|
| 41 | }
|
---|
| 42 |
|
---|
[14450] | 43 | public interface ISolutionSubspace<TSolution> : IItem { }
|
---|
[14420] | 44 |
|
---|
[14450] | 45 | /*************************************************
|
---|
[14420] | 46 | * ********************************************* *
|
---|
| 47 | * OPERATORS *
|
---|
| 48 | * ********************************************* *
|
---|
| 49 | *************************************************/
|
---|
[14450] | 50 |
|
---|
| 51 | public interface ISolutionModelTrainer<TContext> : IItem {
|
---|
[14563] | 52 | bool Bias { get; }
|
---|
[14420] | 53 | void TrainModel(TContext context);
|
---|
| 54 | }
|
---|
| 55 |
|
---|
[14450] | 56 | public interface ILocalSearch<TContext> : IItem {
|
---|
[14420] | 57 | void Optimize(TContext context);
|
---|
| 58 | }
|
---|
[14450] | 59 |
|
---|
| 60 | /*************************************************
|
---|
[14420] | 61 | * ********************************************* *
|
---|
| 62 | * CONTEXTS *
|
---|
| 63 | * ********************************************* *
|
---|
| 64 | *************************************************/
|
---|
| 65 |
|
---|
[14450] | 66 | public interface IHeuristicAlgorithmContext<TProblem, TSolution> : IExecutionContext
|
---|
[14552] | 67 | where TProblem : class, ISingleObjectiveHeuristicOptimizationProblem {
|
---|
[14450] | 68 | TProblem Problem { get; }
|
---|
[14552] | 69 | bool Maximization { get; }
|
---|
[14420] | 70 | IRandom Random { get; }
|
---|
[14450] | 71 | int Iterations { get; set; }
|
---|
| 72 | int EvaluatedSolutions { get; }
|
---|
| 73 | void IncrementEvaluatedSolutions(int byEvaluations);
|
---|
[14429] | 74 | double BestQuality { get; set; }
|
---|
| 75 | TSolution BestSolution { get; set; }
|
---|
| 76 | }
|
---|
| 77 |
|
---|
[14552] | 78 | public interface IEvaluationServiceContext<TSolution> : IExecutionContext {
|
---|
| 79 | double Evaluate(TSolution solution, CancellationToken token);
|
---|
| 80 | void Evaluate(ISingleObjectiveSolutionScope<TSolution> scope, CancellationToken token);
|
---|
| 81 | }
|
---|
| 82 |
|
---|
[14450] | 83 | public interface IPopulationBasedHeuristicAlgorithmContext<TProblem, TSolution> : IHeuristicAlgorithmContext<TProblem, TSolution>
|
---|
[14552] | 84 | where TProblem : class, ISingleObjectiveHeuristicOptimizationProblem {
|
---|
[14450] | 85 | IEnumerable<ISingleObjectiveSolutionScope<TSolution>> Population { get; }
|
---|
[14420] | 86 | }
|
---|
| 87 |
|
---|
[14450] | 88 | public interface ISingleSolutionHeuristicAlgorithmContext<TProblem, TSolution> : IHeuristicAlgorithmContext<TProblem, TSolution>
|
---|
[14552] | 89 | where TProblem : class, ISingleObjectiveHeuristicOptimizationProblem {
|
---|
[14450] | 90 | ISingleObjectiveSolutionScope<TSolution> Solution { get; }
|
---|
[14420] | 91 | }
|
---|
| 92 |
|
---|
[14450] | 93 | public interface ISolutionModelContext<TSolution> : IExecutionContext {
|
---|
| 94 | ISolutionModel<TSolution> Model { get; set; }
|
---|
[14420] | 95 | }
|
---|
| 96 |
|
---|
[14450] | 97 | public interface ISolutionSubspaceContext<TSolution> : IExecutionContext {
|
---|
| 98 | ISolutionSubspace<TSolution> Subspace { get; }
|
---|
[14420] | 99 | }
|
---|
[14450] | 100 | public interface IBinaryVectorSubspaceContext : ISolutionSubspaceContext<BinaryVector> {
|
---|
[14420] | 101 | new BinarySolutionSubspace Subspace { get; }
|
---|
| 102 | }
|
---|
[14450] | 103 | public interface IPermutationSubspaceContext : ISolutionSubspaceContext<Encodings.PermutationEncoding.Permutation> {
|
---|
| 104 | new PermutationSolutionSubspace Subspace { get; }
|
---|
[14420] | 105 | }
|
---|
[14466] | 106 | public interface ILinearLinkageSubspaceContext : ISolutionSubspaceContext<Encodings.LinearLinkageEncoding.LinearLinkage> {
|
---|
| 107 | new LinearLinkageSolutionSubspace Subspace { get; }
|
---|
| 108 | }
|
---|
[14420] | 109 |
|
---|
| 110 |
|
---|
[14450] | 111 | /*************************************************
|
---|
[14420] | 112 | * ********************************************* *
|
---|
| 113 | * SCOPES *
|
---|
| 114 | * ********************************************* *
|
---|
| 115 | *************************************************/
|
---|
[14450] | 116 |
|
---|
| 117 | public interface ISingleObjectiveSolutionScope<TSolution> : IScope {
|
---|
[14420] | 118 | TSolution Solution { get; set; }
|
---|
| 119 | double Fitness { get; set; }
|
---|
| 120 |
|
---|
| 121 | void Adopt(ISingleObjectiveSolutionScope<TSolution> orphan);
|
---|
| 122 | }
|
---|
| 123 | }
|
---|