Esempio n. 1
0
 public IAlgorithm<IList<IVertex>> GetAlgorithm(Parameters parameters)
 {
     var antFactory = new AntFactory();
     var prober = new Prober(parameters.Alpha, parameters.Betta);
     IGraph graph = new Graph.Graph(parameters.Matrix);
     var algorithm = new GreedyAlgorithm(antFactory, prober, parameters.IterationsWithoutChanges,
         parameters.Iterations, parameters.EvaporationRate, parameters.DefaultPheromone, parameters.GreedyRate, graph, parameters.Q);
     return algorithm;
 }
 public IAlgorithm<IGraph, IList<IVertex>> GetAlgorithm(double alpha, double beta, int iteration,
     int iterationWithouChanges)
 {
     var random = new Random(DateTime.Today.Date.Millisecond);
     var antFactory = new AntFactory();
     var selectionRules = new Dictionary<Type, ISelectRule> {{typeof (Ant), new SelectRule(random)}};
     var prober = new Prober(alpha, beta);
     var updateRule = new Dictionary<Type, IIncrimentRule>
     {
         {typeof (Ant), new StandartIncrimentRule(new Pheromone() {Value = 0.5})}
     };
     var algorithm = new StandartAlgorithm(antFactory, selectionRules, prober, updateRule, iterationWithouChanges,
         iteration);
     return algorithm;
 }