Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/03/16 00:32:09 (8 years ago)
Author:
abeham
Message:

#2701: working on MemPR implementation

Location:
branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/Interfaces
Files:
1 added
1 copied

Legend:

Unmodified
Added
Removed
  • branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/Interfaces/Interfaces.cs

    r14449 r14450  
    1919 */
    2020#endregion
    21 
    22 using System;
     21 
    2322using System.Collections.Generic;
    2423using HeuristicLab.Algorithms.MemPR.Binary;
     24using HeuristicLab.Algorithms.MemPR.Permutation;
    2525using HeuristicLab.Core;
    2626using HeuristicLab.Encodings.BinaryVectorEncoding;
     27using HeuristicLab.Optimization;
    2728
    28 /*************************************************
    29  * ********************************************* *
    30  *                    DATA                       *
    31  * ********************************************* *
    32  *************************************************/
     29namespace HeuristicLab.Algorithms.MemPR.Interfaces {
    3330
    34 namespace HeuristicLab.Optimization.SolutionModel {
     31  /*************************************************
     32   * ********************************************* *
     33   *                    DATA                       *
     34   * ********************************************* *
     35   *************************************************/
    3536
    3637  public interface ISolutionModel<TSolution> : IItem {
    3738    TSolution Sample();
    3839  }
    39 }
    4040
    41 namespace HeuristicLab.Optimization {
     41  public interface ISolutionSubspace<TSolution> : IItem { }
    4242
    43   public interface ISolutionSubspace : IItem { }
    44 }
    45 
    46 /*************************************************
     43  /*************************************************
    4744   * ********************************************* *
    4845   *                  OPERATORS                    *
    4946   * ********************************************* *
    5047   *************************************************/
    51 
    52 namespace HeuristicLab.Optimization.SolutionModel {
    53 
    54   public interface ISolutionModelTrainer<TSolution> : IOperator
    55       where TSolution : class, IItem {
    56     IScopeTreeLookupParameter<TSolution> SolutionParameter { get; }
    57     ILookupParameter<ISolutionModel<TSolution>> SamplingModelParameter { get; }
    58   }
    59 
    60   public interface ISolutionModelTrainer<TSolution, TContext> : ISolutionModelTrainer<TSolution>
    61       where TSolution : class, IItem
    62       where TContext : ISolutionModelContext<TSolution> {
    63 
     48   
     49  public interface ISolutionModelTrainer<TContext> : IItem {
    6450    void TrainModel(TContext context);
    6551  }
    6652
    67   public interface IBinarySolutionModelTrainer<TContext> : ISolutionModelTrainer<BinaryVector, TContext>
    68       where TContext : ISolutionModelContext<BinaryVector> { }
    69 }
    70 
    71 namespace HeuristicLab.Optimization.LocalSearch {
    72 
    73   public interface ILocalSearch<TSolution> : IOperator
    74       where TSolution : class, IItem {
    75     ILookupParameter<TSolution> SolutionParameter { get; }
    76 
    77     Func<TSolution, double> EvaluateFunc { get; set; }
    78   }
    79 
    80   public interface ILocalSearch<TSolution, TContext> : ILocalSearch<TSolution>
    81       where TSolution : class, IItem {
    82 
     53  public interface ILocalSearch<TContext> : IItem {
    8354    void Optimize(TContext context);
    8455  }
    85 
    86   public interface IBinaryLocalSearch<TContext> : ILocalSearch<BinaryVector, TContext> {
    87    
    88   }
    89 
    90 }
    91 
    92 /*************************************************
     56 
     57  /*************************************************
    9358   * ********************************************* *
    9459   *                  CONTEXTS                     *
     
    9661   *************************************************/
    9762
    98 namespace HeuristicLab.Optimization {
    99  
    100   public interface IStochasticContext : IExecutionContext {
     63  public interface IHeuristicAlgorithmContext<TProblem, TSolution> : IExecutionContext
     64      where TProblem : class, ISingleObjectiveProblemDefinition {
     65    TProblem Problem { get; }
    10166    IRandom Random { get; }
    102   }
    103 
    104   public interface IMaximizationContext : IExecutionContext {
    105     bool Maximization { get; }
    106   }
    107 
    108   public interface IEvaluatedSolutionsContext : IExecutionContext {
    109     int EvaluatedSolutions { get; set; }
    110   }
    111 
    112   public interface IBestQualityContext : IExecutionContext {
     67    int Iterations { get; set; }
     68    int EvaluatedSolutions { get; }
     69    void IncrementEvaluatedSolutions(int byEvaluations);
    11370    double BestQuality { get; set; }
    114   }
    115 
    116   public interface IBestSolutionContext<TSolution> : IExecutionContext {
    11771    TSolution BestSolution { get; set; }
    11872  }
    11973
    120   public interface IIterationsContext : IExecutionContext {
    121     int Iterations { get; }
     74  public interface IPopulationBasedHeuristicAlgorithmContext<TProblem, TSolution> : IHeuristicAlgorithmContext<TProblem, TSolution>
     75      where TProblem : class, ISingleObjectiveProblemDefinition {
     76    IEnumerable<ISingleObjectiveSolutionScope<TSolution>> Population { get; }
    12277  }
    12378
    124   public interface IIterationsManipulationContext : IIterationsContext {
    125     new int Iterations { get; set; }
     79  public interface ISingleSolutionHeuristicAlgorithmContext<TProblem, TSolution> : IHeuristicAlgorithmContext<TProblem, TSolution>
     80      where TProblem : class, ISingleObjectiveProblemDefinition {
     81    ISingleObjectiveSolutionScope<TSolution> Solution { get; }
    12682  }
    12783
    128   public interface IPopulationContext : IExecutionContext {
    129     IEnumerable<IScope> Population { get; }
    130   }
    131 
    132   public interface IPopulationContext<TSolution> : IPopulationContext {
    133     new IEnumerable<ISolutionScope<TSolution>> Population { get; }
    134   }
    135 
    136   public interface ISingleObjectivePopulationContext<TSolution> : IPopulationContext<TSolution> {
    137     new IEnumerable<ISingleObjectiveSolutionScope<TSolution>> Population { get; }
    138   }
    139 
    140   public interface ISolutionContext : IExecutionContext {
    141     IScope Solution { get; }
    142   }
    143 
    144   public interface ISolutionContext<TSolution> : ISolutionContext {
    145     new ISolutionScope<TSolution> Solution { get; }
    146   }
    147 
    148   public interface ISingleObjectiveSolutionContext<TSolution> : ISolutionContext<TSolution> {
    149     new ISingleObjectiveSolutionScope<TSolution> Solution { get; }
    150   }
    151 
    152   /* Probably a setter is not needed anyway, since there is Adopt() also
    153   public interface ISolutionManipulationContext : ISolutionContext {
    154     new IScope Solution { get; set; }
    155   }
    156 
    157   public interface ISolutionManipulationContext<TSolution> : ISolutionManipulationContext, ISolutionContext<TSolution> {
    158     new ISolutionScope<TSolution> Solution { get; set; }
    159   }
    160 
    161   public interface ISingleObjectiveSolutionManipulationContext<TSolution> : ISolutionManipulationContext<TSolution>, ISingleObjectiveSolutionContext<TSolution> {
    162     new ISingleObjectiveSolutionScope<TSolution> Solution { get; set; }
    163   }
    164   */
    165 
    166   public interface ISolutionSubspaceContext : IExecutionContext {
    167     ISolutionSubspace Subspace { get; }
    168   }
    169   public interface IBinarySolutionSubspaceContext : ISolutionSubspaceContext {
    170     new BinarySolutionSubspace Subspace { get; }
    171   }
    172 }
    173 
    174 namespace HeuristicLab.Optimization.SolutionModel {
    17584  public interface ISolutionModelContext<TSolution> : IExecutionContext {
    17685    ISolutionModel<TSolution> Model { get; set; }
    17786  }
    178 }
     87
     88  public interface ISolutionSubspaceContext<TSolution> : IExecutionContext {
     89    ISolutionSubspace<TSolution> Subspace { get; }
     90  }
     91  public interface IBinaryVectorSubspaceContext : ISolutionSubspaceContext<BinaryVector> {
     92    new BinarySolutionSubspace Subspace { get; }
     93  }
     94  public interface IPermutationSubspaceContext : ISolutionSubspaceContext<Encodings.PermutationEncoding.Permutation> {
     95    new PermutationSolutionSubspace Subspace { get; }
     96  }
    17997
    18098
    181 /*************************************************
     99  /*************************************************
    182100   * ********************************************* *
    183101   *                   SCOPES                      *
    184102   * ********************************************* *
    185103   *************************************************/
    186  
    187 namespace HeuristicLab.Core {
    188   public interface ISolutionScope<TSolution> : IScope {
     104
     105  public interface ISingleObjectiveSolutionScope<TSolution> : IScope {
    189106    TSolution Solution { get; set; }
    190 
    191     void Adopt(ISolutionScope<TSolution> orphan);
    192   }
    193 
    194   public interface ISingleObjectiveSolutionScope<TSolution> : ISolutionScope<TSolution> {
    195107    double Fitness { get; set; }
    196108
Note: See TracChangeset for help on using the changeset viewer.