- Timestamp:
- 12/03/16 00:32:09 (8 years ago)
- 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 19 19 */ 20 20 #endregion 21 22 using System; 21 23 22 using System.Collections.Generic; 24 23 using HeuristicLab.Algorithms.MemPR.Binary; 24 using HeuristicLab.Algorithms.MemPR.Permutation; 25 25 using HeuristicLab.Core; 26 26 using HeuristicLab.Encodings.BinaryVectorEncoding; 27 using HeuristicLab.Optimization; 27 28 28 /************************************************* 29 * ********************************************* * 30 * DATA * 31 * ********************************************* * 32 *************************************************/ 29 namespace HeuristicLab.Algorithms.MemPR.Interfaces { 33 30 34 namespace HeuristicLab.Optimization.SolutionModel { 31 /************************************************* 32 * ********************************************* * 33 * DATA * 34 * ********************************************* * 35 *************************************************/ 35 36 36 37 public interface ISolutionModel<TSolution> : IItem { 37 38 TSolution Sample(); 38 39 } 39 }40 40 41 namespace HeuristicLab.Optimization { 41 public interface ISolutionSubspace<TSolution> : IItem { } 42 42 43 public interface ISolutionSubspace : IItem { } 44 } 45 46 /************************************************* 43 /************************************************* 47 44 * ********************************************* * 48 45 * OPERATORS * 49 46 * ********************************************* * 50 47 *************************************************/ 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 { 64 50 void TrainModel(TContext context); 65 51 } 66 52 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 { 83 54 void Optimize(TContext context); 84 55 } 85 86 public interface IBinaryLocalSearch<TContext> : ILocalSearch<BinaryVector, TContext> { 87 88 } 89 90 } 91 92 /************************************************* 56 57 /************************************************* 93 58 * ********************************************* * 94 59 * CONTEXTS * … … 96 61 *************************************************/ 97 62 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; } 101 66 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); 113 70 double BestQuality { get; set; } 114 }115 116 public interface IBestSolutionContext<TSolution> : IExecutionContext {117 71 TSolution BestSolution { get; set; } 118 72 } 119 73 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; } 122 77 } 123 78 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; } 126 82 } 127 83 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() also153 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 {175 84 public interface ISolutionModelContext<TSolution> : IExecutionContext { 176 85 ISolutionModel<TSolution> Model { get; set; } 177 86 } 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 } 179 97 180 98 181 /*************************************************99 /************************************************* 182 100 * ********************************************* * 183 101 * SCOPES * 184 102 * ********************************************* * 185 103 *************************************************/ 186 187 namespace HeuristicLab.Core { 188 public interface ISolutionScope<TSolution> : IScope { 104 105 public interface ISingleObjectiveSolutionScope<TSolution> : IScope { 189 106 TSolution Solution { get; set; } 190 191 void Adopt(ISolutionScope<TSolution> orphan);192 }193 194 public interface ISingleObjectiveSolutionScope<TSolution> : ISolutionScope<TSolution> {195 107 double Fitness { get; set; } 196 108
Note: See TracChangeset
for help on using the changeset viewer.