Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2457_ExpertSystem/HeuristicLab.Algorithms.MemPR/3.3/Interfaces/Interfaces.cs @ 17975

Last change on this file since 17975 was 14776, checked in by abeham, 8 years ago

#2457: working on MemPR integration

File size: 5.1 KB
Line 
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
21 
22using System.Collections.Generic;
23using System.Threading;
24using HeuristicLab.Algorithms.MemPR.Binary;
25using HeuristicLab.Algorithms.MemPR.Grouping;
26using HeuristicLab.Algorithms.MemPR.Permutation;
27using HeuristicLab.Analysis.FitnessLandscape;
28using HeuristicLab.Core;
29using HeuristicLab.Encodings.BinaryVectorEncoding;
30using HeuristicLab.Optimization;
31
32namespace HeuristicLab.Algorithms.MemPR.Interfaces {
33
34  /*************************************************
35   * ********************************************* *
36   *                    DATA                       *
37   * ********************************************* *
38   *************************************************/
39
40  public interface ISolutionSubspace<TSolution> : IItem { }
41
42  /*************************************************
43   * ********************************************* *
44   *                  OPERATORS                    *
45   * ********************************************* *
46   *************************************************/
47   
48  public interface ISolutionModelTrainer<TContext> : IItem {
49    bool Bias { get; }
50    void TrainModel(TContext context);
51  }
52
53  public interface ILocalSearch<TContext> : IItem {
54    void Optimize(TContext context);
55  }
56 
57  /*************************************************
58   * ********************************************* *
59   *                  CONTEXTS                     *
60   * ********************************************* *
61   *************************************************/
62
63  public interface IHeuristicAlgorithmContext<TProblem, TSolution> : IExecutionContext
64      where TProblem : class, ISingleObjectiveHeuristicOptimizationProblem {
65    TProblem Problem { get; }
66    bool Maximization { get; }
67    IRandom Random { get; }
68    int Iterations { get; set; }
69    int EvaluatedSolutions { get; }
70    void IncrementEvaluatedSolutions(int byEvaluations);
71    double BestQuality { get; set; }
72    TSolution BestSolution { get; set; }
73  }
74
75  public interface ILocalSearchPathContext<TSolution> : IExecutionContext where TSolution : class, IItem {
76    DirectedPath<TSolution> LocalSearchPaths { get; }
77  }
78
79  public interface IEvaluationServiceContext<TSolution> : IExecutionContext {
80    double Evaluate(TSolution solution, CancellationToken token);
81    void Evaluate(ISingleObjectiveSolutionScope<TSolution> scope, CancellationToken token);
82  }
83
84  public interface IPopulationBasedHeuristicAlgorithmContext<TProblem, TSolution> : IHeuristicAlgorithmContext<TProblem, TSolution>
85      where TProblem : class, ISingleObjectiveHeuristicOptimizationProblem {
86    IEnumerable<ISingleObjectiveSolutionScope<TSolution>> Population { get; }
87    int PopulationCount { get; }
88  }
89
90  public interface ISingleSolutionHeuristicAlgorithmContext<TProblem, TSolution> : IHeuristicAlgorithmContext<TProblem, TSolution>
91      where TProblem : class, ISingleObjectiveHeuristicOptimizationProblem {
92    ISingleObjectiveSolutionScope<TSolution> Solution { get; }
93  }
94
95  public interface ISolutionModelContext<TSolution> : IExecutionContext {
96    ISolutionModel<TSolution> Model { get; set; }
97  }
98
99  public interface ISolutionSubspaceContext<TSolution> : IExecutionContext {
100    ISolutionSubspace<TSolution> Subspace { get; }
101  }
102  public interface IBinaryVectorSubspaceContext : ISolutionSubspaceContext<BinaryVector> {
103    new BinarySolutionSubspace Subspace { get; }
104  }
105  public interface IPermutationSubspaceContext : ISolutionSubspaceContext<Encodings.PermutationEncoding.Permutation> {
106    new PermutationSolutionSubspace Subspace { get; }
107  }
108  public interface ILinearLinkageSubspaceContext : ISolutionSubspaceContext<Encodings.LinearLinkageEncoding.LinearLinkage> {
109    new LinearLinkageSolutionSubspace Subspace { get; }
110  }
111
112
113  /*************************************************
114   * ********************************************* *
115   *                   SCOPES                      *
116   * ********************************************* *
117   *************************************************/
118
119  public interface ISingleObjectiveSolutionScope<TSolution> : IScope {
120    TSolution Solution { get; set; }
121    double Fitness { get; set; }
122
123    void Adopt(ISingleObjectiveSolutionScope<TSolution> orphan);
124  }
125}
Note: See TracBrowser for help on using the repository browser.