Free cookie consent management tool by TermsFeed Policy Generator

source: branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/Interfaces/Interfaces.cs @ 14492

Last change on this file since 14492 was 14466, checked in by abeham, 8 years ago

#2701:

  • Added MemPR for linear linkage (tabu walk still missing)
  • Added graph coloring problem
File size: 4.5 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 HeuristicLab.Algorithms.MemPR.Binary;
24using HeuristicLab.Algorithms.MemPR.LinearLinkage;
25using HeuristicLab.Algorithms.MemPR.Permutation;
26using HeuristicLab.Core;
27using HeuristicLab.Encodings.BinaryVectorEncoding;
28using HeuristicLab.Optimization;
29
30namespace HeuristicLab.Algorithms.MemPR.Interfaces {
31
32  /*************************************************
33   * ********************************************* *
34   *                    DATA                       *
35   * ********************************************* *
36   *************************************************/
37
38  public interface ISolutionModel<TSolution> : IItem {
39    TSolution Sample();
40  }
41
42  public interface ISolutionSubspace<TSolution> : IItem { }
43
44  /*************************************************
45   * ********************************************* *
46   *                  OPERATORS                    *
47   * ********************************************* *
48   *************************************************/
49   
50  public interface ISolutionModelTrainer<TContext> : IItem {
51    void TrainModel(TContext context);
52  }
53
54  public interface ILocalSearch<TContext> : IItem {
55    void Optimize(TContext context);
56  }
57 
58  /*************************************************
59   * ********************************************* *
60   *                  CONTEXTS                     *
61   * ********************************************* *
62   *************************************************/
63
64  public interface IHeuristicAlgorithmContext<TProblem, TSolution> : IExecutionContext
65      where TProblem : class, ISingleObjectiveProblemDefinition {
66    TProblem Problem { 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 IPopulationBasedHeuristicAlgorithmContext<TProblem, TSolution> : IHeuristicAlgorithmContext<TProblem, TSolution>
76      where TProblem : class, ISingleObjectiveProblemDefinition {
77    IEnumerable<ISingleObjectiveSolutionScope<TSolution>> Population { get; }
78  }
79
80  public interface ISingleSolutionHeuristicAlgorithmContext<TProblem, TSolution> : IHeuristicAlgorithmContext<TProblem, TSolution>
81      where TProblem : class, ISingleObjectiveProblemDefinition {
82    ISingleObjectiveSolutionScope<TSolution> Solution { get; }
83  }
84
85  public interface ISolutionModelContext<TSolution> : IExecutionContext {
86    ISolutionModel<TSolution> Model { get; set; }
87  }
88
89  public interface ISolutionSubspaceContext<TSolution> : IExecutionContext {
90    ISolutionSubspace<TSolution> Subspace { get; }
91  }
92  public interface IBinaryVectorSubspaceContext : ISolutionSubspaceContext<BinaryVector> {
93    new BinarySolutionSubspace Subspace { get; }
94  }
95  public interface IPermutationSubspaceContext : ISolutionSubspaceContext<Encodings.PermutationEncoding.Permutation> {
96    new PermutationSolutionSubspace Subspace { get; }
97  }
98  public interface ILinearLinkageSubspaceContext : ISolutionSubspaceContext<Encodings.LinearLinkageEncoding.LinearLinkage> {
99    new LinearLinkageSolutionSubspace Subspace { get; }
100  }
101
102
103  /*************************************************
104   * ********************************************* *
105   *                   SCOPES                      *
106   * ********************************************* *
107   *************************************************/
108
109  public interface ISingleObjectiveSolutionScope<TSolution> : IScope {
110    TSolution Solution { get; set; }
111    double Fitness { get; set; }
112
113    void Adopt(ISingleObjectiveSolutionScope<TSolution> orphan);
114  }
115}
Note: See TracBrowser for help on using the repository browser.