Last change
on this file since 13401 was
9350,
checked in by fschoepp, 12 years ago
|
#1888:
- Added input parameters to the run class. They will be populated by the back-end and returned to the web pages which renders them.
- Added a ParameterMapper class which converts HL specific model classes to OaaS independent classes. The conversion gets delegated to IParameterHandler which have to be implemented manually and registered for a certain Type before. All parameters which can be converted to IStringConvertible, IStringConvertibleMatrix, IString* will be converted into a OaaS-StringValue instance.
- Added IParameterHandlers for PathTSPTour and PermutationType (required for TSP).
- AlgorithmConverter now makes sure that the id of a run is unique. (All runs of a RunList will be shown now.)
- Web pages are capable of rendering both the results of a run and their input parameters (added a accordion to wrap their content).
- Renamed "Traveling Salesman Problem" to "Genetic Algorithm - TSP".
- Changed js-files to render both input and result parameters of a Run.
|
File size:
1.1 KB
|
Rev | Line | |
---|
[9350] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using HeuristicLab.Core;
|
---|
| 6 | using HeuristicLab.Problems.TravelingSalesman;
|
---|
| 7 |
|
---|
| 8 | namespace HeuristicLab.Services.Optimization.ControllerService.Parameters.HL {
|
---|
| 9 | public class PathTSPParameterHandler : IParameterHandler<IItem> {
|
---|
| 10 | public Type HandledType {
|
---|
| 11 | get {
|
---|
| 12 | return typeof(PathTSPTour);
|
---|
| 13 | }
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | public Model.Parameter Map(IItem item) {
|
---|
| 17 | var tour = item as PathTSPTour;
|
---|
| 18 | var parameter = new Model.Parameter();
|
---|
| 19 | var resultMatrix = new Model.DecimalMatrix();
|
---|
| 20 | // simply create a matrix which contains all the coordinates in correct order
|
---|
| 21 | // the client may now display them as table
|
---|
| 22 | double[][] matrix = new double[tour.Permutation.Length][];
|
---|
| 23 |
|
---|
| 24 | for (var i=0; i < tour.Permutation.Length; i++) {
|
---|
| 25 | matrix[i] = new double[2];
|
---|
| 26 | matrix[i][0] = tour.Coordinates[tour.Permutation[i], 0];
|
---|
| 27 | matrix[i][1] = tour.Coordinates[tour.Permutation[i], 1];
|
---|
| 28 | }
|
---|
| 29 | parameter.Value = new Model.DecimalMatrix() { Value = matrix };
|
---|
| 30 | return parameter;
|
---|
| 31 | }
|
---|
| 32 | }
|
---|
| 33 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.