Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OaaS/HeuristicLab.Services.Optimization.Controller/PlaceholderControllerService.cs @ 8418

Last change on this file since 8418 was 8384, checked in by fschoepp, 12 years ago

#1888:

  • Created a project which contains the back-end controller for the Optimization WebSite
  • Added a WCF-back-end-controller which generates all available optimization problems (currently in-memory solution: PlaceholderControllerService.cs)
  • Created a WebRole using ASP.NET MVC 3 for the Optimization Web Site
  • WebSite authenticates users with the HeuristicLab.Authentication membership provider and database
  • WebSite crawls and displays all available optimization scenarios by using the WCF-back-end controller (test with: http://localhost:.../optimization)
File size: 3.9 KB
RevLine 
[8384]1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.ServiceModel;
6
7namespace HeuristicLab.Services.Optimization.ControllerService {
8  [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, IgnoreExtensionDataObject = true)]
9  public class PlaceholderControllerService : IControllerService {
10   
11    private IList<Model.OptimizationScenario> scenarios;
12
13    public PlaceholderControllerService() {
14      var tsp = new Model.OptimizationScenario() { Name = "Travelling Salesman Problem" };
15      tsp.InputParameters.Add(new Model.Parameter() { Name = "BestKnownQuality", Type = Model.ParameterType.Decimal, Value = new Model.DecimalValue() { Value = 6110.0d } });
16      tsp.InputParameters.Add(new Model.Parameter() { Name = "BestKnownSolution", Type = Model.ParameterType.DecimalMatrix }); //, Value =
17        //new double[]{0,40,38,116,111,114,27,61,104,127,15,44,4,10,75,108,60,128,123,63,68,85,87,25,6,96,69,106,126,103,42,33,16,30,26,18,99,14,28,23,115,94,78,86,11,80,102,76,93,88,109,97,67,62,47,24,112,31,35,83,118,110,122,100,81,56,8,55,64,51,74,73,98,72,91,37,105,52,119,57,48,71,90,5,101,9,13,66,12,95,121,54,59,50,41,43,92,36,21,46,39,22,32,20,125,120,77,65,84,124,89,58,29,82,2,113,107,7,17,45,79,117,19,3,34,53,1,49,129,70}});
18      tsp.InputParameters.Add(new Model.Parameter() { Name = "Coordinates", Type = Model.ParameterType.DecimalMatrix }); //, Value =
19        //new double[,]{{334.5909245845, 161.7809319139},{334.5909245845, 161.7809319139},{503.8741827107,172.8741151168}}});
20      tsp.InputParameters.Add(new Model.Parameter() { Name = "Evaluator", Type = Model.ParameterType.Type });//, Value = "TSPRoundedEuclideanPathEvaluator", Choices = new string[]{ "TSPRoundedEuclideanPathEvaluator", "TSPGeoPathEvaluator", "TSPEuclideanPathEvaluator" } });
21      //tsp.InputParameters.Add(new Model.Parameter() { Name = "SolutionCreator" });
22      tsp.InputParameters.Add(new Model.Parameter() { Name = "UseDistanceMatrix", Type = Model.ParameterType.Boolean});//, Value = true });
23
24      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "Crossover", Type = Model.ParameterType.Type});//, Value = "OrderCrossover2", Choices = new string[] { "OrderCrossover2", "CosaCrossover" } });
25      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "Elites", Type = Model.ParameterType.Integer});//, Value = 1});
26      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "MaximumGenerations", Type = Model.ParameterType.Integer });//, Value = 1000});
27      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "MutationProbability", Type = Model.ParameterType.Percent });//, Value = 5});
28      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "Mutator", Type = Model.ParameterType.Type});//, Value = "InversionManipulator", Choices = new string[]{"InversionManipulator", "ScrambleManipulator"} });
29      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "PopulationSize", Type = Model.ParameterType.Integer});//, Value = 100 });
30      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "Seed", Type = Model.ParameterType.Integer});//, Value = 100 });
31      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "Selector", Type = Model.ParameterType.Type });//,  Value = "ProportionalSelector", Choices = new string[]{"ProportionalSelector", "BestSelector"} });
32      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "SetSeedRandomly", Type = Model.ParameterType.Boolean });//, Value = true });
33      this.scenarios = new List<Model.OptimizationScenario>() { tsp };
34    }
35
36    public IEnumerable<Model.OptimizationScenario> GetOptimizationScenarios() {
37      return scenarios; 
38    }
39
40
41    public Model.OptimizationScenario GetOptimizationScenarioByName(string name) {
42      if (scenarios[0].Name == name)
43        return scenarios[0];
44      return null;
45    }
46  }
47}
Note: See TracBrowser for help on using the repository browser.