Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 14466 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
RevLine 
[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]22using System.Collections.Generic;
23using HeuristicLab.Algorithms.MemPR.Binary;
[14466]24using HeuristicLab.Algorithms.MemPR.LinearLinkage;
[14450]25using HeuristicLab.Algorithms.MemPR.Permutation;
[14420]26using HeuristicLab.Core;
27using HeuristicLab.Encodings.BinaryVectorEncoding;
[14450]28using HeuristicLab.Optimization;
[14420]29
[14450]30namespace HeuristicLab.Algorithms.MemPR.Interfaces {
[14420]31
[14450]32  /*************************************************
33   * ********************************************* *
34   *                    DATA                       *
35   * ********************************************* *
36   *************************************************/
[14420]37
38  public interface ISolutionModel<TSolution> : IItem {
39    TSolution Sample();
40  }
41
[14450]42  public interface ISolutionSubspace<TSolution> : IItem { }
[14420]43
[14450]44  /*************************************************
[14420]45   * ********************************************* *
46   *                  OPERATORS                    *
47   * ********************************************* *
48   *************************************************/
[14450]49   
50  public interface ISolutionModelTrainer<TContext> : IItem {
[14420]51    void TrainModel(TContext context);
52  }
53
[14450]54  public interface ILocalSearch<TContext> : IItem {
[14420]55    void Optimize(TContext context);
56  }
[14450]57 
58  /*************************************************
[14420]59   * ********************************************* *
60   *                  CONTEXTS                     *
61   * ********************************************* *
62   *************************************************/
63
[14450]64  public interface IHeuristicAlgorithmContext<TProblem, TSolution> : IExecutionContext
65      where TProblem : class, ISingleObjectiveProblemDefinition {
66    TProblem Problem { get; }
[14420]67    IRandom Random { get; }
[14450]68    int Iterations { get; set; }
69    int EvaluatedSolutions { get; }
70    void IncrementEvaluatedSolutions(int byEvaluations);
[14429]71    double BestQuality { get; set; }
72    TSolution BestSolution { get; set; }
73  }
74
[14450]75  public interface IPopulationBasedHeuristicAlgorithmContext<TProblem, TSolution> : IHeuristicAlgorithmContext<TProblem, TSolution>
76      where TProblem : class, ISingleObjectiveProblemDefinition {
77    IEnumerable<ISingleObjectiveSolutionScope<TSolution>> Population { get; }
[14420]78  }
79
[14450]80  public interface ISingleSolutionHeuristicAlgorithmContext<TProblem, TSolution> : IHeuristicAlgorithmContext<TProblem, TSolution>
81      where TProblem : class, ISingleObjectiveProblemDefinition {
82    ISingleObjectiveSolutionScope<TSolution> Solution { get; }
[14420]83  }
84
[14450]85  public interface ISolutionModelContext<TSolution> : IExecutionContext {
86    ISolutionModel<TSolution> Model { get; set; }
[14420]87  }
88
[14450]89  public interface ISolutionSubspaceContext<TSolution> : IExecutionContext {
90    ISolutionSubspace<TSolution> Subspace { get; }
[14420]91  }
[14450]92  public interface IBinaryVectorSubspaceContext : ISolutionSubspaceContext<BinaryVector> {
[14420]93    new BinarySolutionSubspace Subspace { get; }
94  }
[14450]95  public interface IPermutationSubspaceContext : ISolutionSubspaceContext<Encodings.PermutationEncoding.Permutation> {
96    new PermutationSolutionSubspace Subspace { get; }
[14420]97  }
[14466]98  public interface ILinearLinkageSubspaceContext : ISolutionSubspaceContext<Encodings.LinearLinkageEncoding.LinearLinkage> {
99    new LinearLinkageSolutionSubspace Subspace { get; }
100  }
[14420]101
102
[14450]103  /*************************************************
[14420]104   * ********************************************* *
105   *                   SCOPES                      *
106   * ********************************************* *
107   *************************************************/
[14450]108
109  public interface ISingleObjectiveSolutionScope<TSolution> : IScope {
[14420]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.