Beispiel #1
0
 public ViewResult Input(ParametersViewModel parametersWeb)
 {
     try
     {
         Parameters parameters = _parser.GetAlgorithmParameters(parametersWeb);
         ViewBag.answer = _mainActions.Calculate(parameters);
         return View("answer");
     }
     catch (Exception)
     {
         return View("Error");
     }
 }
Beispiel #2
0
 public ParametersViewModel GetParametersViewModel(Parameters sourceParameters)
 {
     var parameters = new ParametersViewModel();
     parameters.Alpha = sourceParameters.Alpha;
     parameters.Betta = sourceParameters.Betta;
     parameters.DefaultPheromone = sourceParameters.DefaultPheromone;
     parameters.EvaporationRate = sourceParameters.EvaporationRate;
     parameters.GreedyRate = sourceParameters.EvaporationRate;
     parameters.Iterations = sourceParameters.Iterations;
     parameters.IterationsWithoutChanges = sourceParameters.IterationsWithoutChanges;
     parameters.Q = sourceParameters.Q;
     parameters.MatrixString = MatrixToString(sourceParameters.Matrix);
     return parameters;
 }
Beispiel #3
0
 public Parameters GetAlgorithmParameters(ParametersViewModel sourceParameters)
 {
     var parameters = new Parameters();
     parameters.Alpha = sourceParameters.Alpha;
     parameters.Betta = sourceParameters.Betta;
     parameters.DefaultPheromone = sourceParameters.DefaultPheromone;
     parameters.EvaporationRate = sourceParameters.EvaporationRate;
     parameters.GreedyRate = sourceParameters.EvaporationRate;
     parameters.Iterations = sourceParameters.Iterations;
     parameters.IterationsWithoutChanges = sourceParameters.IterationsWithoutChanges;
     parameters.Q = sourceParameters.Q;
     parameters.Matrix = StringToMatrix(sourceParameters.MatrixString);
     return parameters;
 }