#region License Information /* HeuristicLab * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using System.Collections.Generic; using System.Threading; using HeuristicLab.Core; using HeuristicLab.Optimization; /************************************************* * ********************************************* * * DATA * * ********************************************* * *************************************************/ /************************************************* * ********************************************* * * OPERATORS * * ********************************************* * *************************************************/ namespace HeuristicLab.Optimization.LocalSearch { public interface ILocalSearch : IItem { void Optimize(TContext context); } } namespace HeuristicLab.Optimization.Crossover { public interface ICrossover : IItem { void Cross(TContext context); } } namespace HeuristicLab.Optimization.Manipulation { public interface IManipulator : IItem { void Manipulate(TContext context); } } namespace HeuristicLab.Optimization.Selection { public interface ISelector : IItem { void Select(TContext context, int n, bool withRepetition); } } /************************************************* * ********************************************* * * CONTEXTS * * ********************************************* * *************************************************/ namespace HeuristicLab.Optimization { public interface ILongRunningOperationContext : IExecutionContext { CancellationToken CancellationToken { get; set; } } public interface IStochasticContext : IExecutionContext { IRandom Random { get; } } public interface IEvaluatedSolutionsContext : IExecutionContext { int EvaluatedSolutions { get; } void IncEvaluatedSolutions(int inc); } public interface IBestQualityContext : IExecutionContext { double BestQuality { get; set; } } public interface IBestSolutionContext : IExecutionContext { TSolution BestSolution { get; set; } } public interface IIterationsContext : IExecutionContext { int Iterations { get; } } public interface IImprovementStepsContext : IExecutionContext { int ImprovementSteps { get; set; } } public interface IProblemContext : IExecutionContext where TProblem : class, ISingleObjectiveProblem where TEncoding : class, IEncoding where TSolution : class, ISolution { TProblem Problem { get; } } public interface IPopulationContext : IExecutionContext { IEnumerable Population { get; } } public interface IPopulationContext : IPopulationContext { new IEnumerable> Population { get; } } public interface ISingleObjectivePopulationContext : IPopulationContext { new IEnumerable> Population { get; } } public interface ISolutionContext : IExecutionContext { IScope Solution { get; } } public interface ISolutionContext : ISolutionContext { new ISolutionScope Solution { get; } } public interface ISingleObjectiveSolutionContext : ISolutionContext { new ISingleObjectiveSolutionScope Solution { get; } } public interface IMatingContext : IExecutionContext { Tuple, ISolutionScope> Parents { get; } ISolutionScope Child { get; } } public interface ISingleObjectiveMatingContext : IMatingContext { new Tuple, ISingleObjectiveSolutionScope> Parents { get; } new ISingleObjectiveSolutionScope Child { get; } } public interface IMatingpoolContext : IExecutionContext where TSolution : class, ISolution { IEnumerable> MatingPool { get; set; } } public interface ISingleObjectiveMatingpoolContext : IMatingpoolContext where TSolution : class, ISolution { new IEnumerable> MatingPool { get; set; } } } /************************************************* * ********************************************* * * SCOPES * * ********************************************* * *************************************************/ namespace HeuristicLab.Core { public interface ISolutionScope : IScope { TSolution Solution { get; set; } void Adopt(ISolutionScope orphan); } public interface ISingleObjectiveSolutionScope : ISolutionScope { double Fitness { get; set; } void Adopt(ISingleObjectiveSolutionScope orphan); } }