Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8506


Ignore:
Timestamp:
08/20/12 13:00:30 (12 years ago)
Author:
fschoepp
Message:

#1888:

  • Web project now creates custom html for each type we want to enter / display
  • Added endpointConfigurationName to HiveServiceLocator (because Web Project contains more than one endpoint configuration)
  • Removed logging statement from ConfigurationService to prevent exception during failure of loading ConfigurationSettings
  • ApplicationManager: Changed default implementation to WebApplicationManager (instead of LightWeight) for testing purposes within Web Project
  • WebApplicationManager: The application manager which returns plugin descriptors from the currently loaded assemblies (instead of LightweightAppManager)
  • HiveService: Fixed a transaction bug
  • IControllerService: Created a method to dispatch Scenarios to certain IScenarioManager (in this case HiveScenarioManager)
  • Added more mappable types to ControllerModel
  • PlaceholderControllerService dispatches all Scenarios to the HiveScenarioManager
  • Web project now dispatches the scenario to the controller after pressing "Run Job"
Location:
branches/OaaS
Files:
21 added
19 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS/HeuristicLab 3.3 Services.sln

    r8384 r8506  
    3939    Release.AspNetCompiler.FixedNames = "false"
    4040    Release.AspNetCompiler.Debug = "False"
    41     VWDPort = "4591"
     41    VWDPort = "1512"
    4242    VWDVirtualPath = "/Hive-3.3"
    4343    DefaultWebSiteLanguage = "Visual C#"
  • branches/OaaS/HeuristicLab.Clients.Hive/3.3/HiveServiceLocator.cs

    r8251 r8506  
    4949    }
    5050
     51    private string endpointConfigurationName;
     52
     53    public string EndpointConfigurationName
     54    {
     55      get { return endpointConfigurationName; }
     56      set { endpointConfigurationName = value; }
     57    }
     58
     59
    5160    private string remoteAddress;
    5261    public string RemoteAddress {
     
    5968      get { return identityCertificate; }
    6069      set { identityCertificate = value; }
    61     }
     70    }   
    6271
    6372    private HiveServiceClient NewServiceClient() {
     
    6675        cl = ClientFactory.CreateClient<HiveServiceClient, IHiveService>();
    6776      else {
    68         cl = ClientFactory.CreateClient<HiveServiceClient, IHiveService>(null, null, username, password);
     77        cl = ClientFactory.CreateClient<HiveServiceClient, IHiveService>(endpointConfigurationName, null, username, password);
    6978      }
    7079
  • branches/OaaS/HeuristicLab.Clients.Hive/3.3/IHiveServiceLocator.cs

    r8251 r8506  
    2727    string Password { get; set; }
    2828    string RemoteAddress { get; set; }
     29    string EndpointConfigurationName { get; set; }
    2930    string IdentityCertificate { get; set; }
    3031    void CallHiveService(Action<IHiveService> call);
  • branches/OaaS/HeuristicLab.Persistence/3.3/Core/ConfigurationService.cs

    r7259 r8506  
    101101          throw new PersistenceException("Could not load persistence settings.", e);
    102102        } else {
    103           Logger.Warn("Could not load settings.", e);
     103          //Logger.Warn("Could not load settings.", e);
    104104        }
    105105      }
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/ApplicationManager.cs

    r7259 r8506  
    3737      get {
    3838        if (appManager == null)
    39           appManager = new LightweightApplicationManager();
     39          appManager = new WebApplicationManager();
    4040        return appManager;
    4141      }
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/HeuristicLab.PluginInfrastructure-3.3.csproj

    r7649 r8506  
    231231    <Compile Include="BaseClasses\ApplicationBase.cs" />
    232232    <Compile Include="BaseClasses\PluginBase.cs" />
     233    <Compile Include="WebApplicationManager.cs" />
    233234    <Compile Include="SandboxApplicationManager.cs" />
    234235    <Compile Include="DefaultApplicationManager.cs" />
  • branches/OaaS/HeuristicLab.Services.Hive.WebRole/HeuristicLab.Services.Hive.WebRole.csproj

    r8235 r8506  
    129129  </ItemGroup>
    130130  <ItemGroup>
    131     <Content Include="Web.config" />
     131    <Content Include="Web.config">
     132      <SubType>Designer</SubType>
     133    </Content>
    132134    <Content Include="Web.Debug.config">
    133135      <DependentUpon>Web.config</DependentUpon>
  • branches/OaaS/HeuristicLab.Services.Hive/3.3/HiveService.cs

    r8326 r8506  
    8080    public Guid AddChildTask(Guid parentTaskId, Task task, TaskData taskData) {
    8181      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    82       return trans.UseTransaction(() => {
    83         task.ParentTaskId = parentTaskId;
    84         return AddTask(task, taskData, dao.GetAssignedResources(parentTaskId).Select(x => x.Id));
    85       }, false, true);
     82      var assignedResources = dao.GetAssignedResources(parentTaskId).Select(x => x.Id);
     83      task.ParentTaskId = parentTaskId;
     84      return AddTask(task, taskData, assignedResources);     
    8685    }
    8786
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/HeuristicLab.Services.Optimization.ControllerService.csproj

    r8384 r8506  
    3232  </PropertyGroup>
    3333  <ItemGroup>
     34    <Reference Include="ALGLIB-3.5.0, Version=3.5.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     35      <SpecificVersion>False</SpecificVersion>
     36      <HintPath>..\bin\ALGLIB-3.5.0.dll</HintPath>
     37    </Reference>
     38    <Reference Include="HeuristicLab.Algorithms.GeneticAlgorithm-3.3">
     39      <HintPath>..\bin\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.dll</HintPath>
     40    </Reference>
     41    <Reference Include="HeuristicLab.Clients.Hive-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     42      <SpecificVersion>False</SpecificVersion>
     43      <HintPath>..\bin\HeuristicLab.Clients.Hive-3.3.dll</HintPath>
     44    </Reference>
     45    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     46      <SpecificVersion>False</SpecificVersion>
     47      <HintPath>..\bin\HeuristicLab.Collections-3.3.dll</HintPath>
     48    </Reference>
     49    <Reference Include="HeuristicLab.Common-3.3">
     50      <HintPath>..\bin\HeuristicLab.Common-3.3.dll</HintPath>
     51    </Reference>
     52    <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     53      <SpecificVersion>False</SpecificVersion>
     54      <HintPath>..\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
     55    </Reference>
     56    <Reference Include="HeuristicLab.Core-3.3">
     57      <HintPath>..\bin\HeuristicLab.Core-3.3.dll</HintPath>
     58    </Reference>
     59    <Reference Include="HeuristicLab.Data-3.3">
     60      <HintPath>..\bin\HeuristicLab.Data-3.3.dll</HintPath>
     61    </Reference>
     62    <Reference Include="HeuristicLab.Encodings.BinaryVectorEncoding-3.3">
     63      <HintPath>..\bin\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.dll</HintPath>
     64    </Reference>
     65    <Reference Include="HeuristicLab.Encodings.IntegerVectorEncoding-3.3">
     66      <HintPath>..\bin\HeuristicLab.Encodings.IntegerVectorEncoding-3.3.dll</HintPath>
     67    </Reference>
     68    <Reference Include="HeuristicLab.Encodings.PermutationEncoding-3.3">
     69      <HintPath>..\bin\HeuristicLab.Encodings.PermutationEncoding-3.3.dll</HintPath>
     70    </Reference>
     71    <Reference Include="HeuristicLab.Encodings.PermutationEncoding.Views-3.3">
     72      <HintPath>..\bin\HeuristicLab.Encodings.PermutationEncoding.Views-3.3.dll</HintPath>
     73    </Reference>
     74    <Reference Include="HeuristicLab.Encodings.RealVectorEncoding-3.3">
     75      <HintPath>..\bin\HeuristicLab.Encodings.RealVectorEncoding-3.3.dll</HintPath>
     76    </Reference>
     77    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4">
     78      <HintPath>..\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
     79    </Reference>
     80    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4">
     81      <HintPath>..\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4.dll</HintPath>
     82    </Reference>
     83    <Reference Include="HeuristicLab.Hive-3.3">
     84      <HintPath>..\bin\HeuristicLab.Hive-3.3.dll</HintPath>
     85    </Reference>
     86    <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     87      <SpecificVersion>False</SpecificVersion>
     88      <HintPath>..\bin\HeuristicLab.Operators-3.3.dll</HintPath>
     89    </Reference>
     90    <Reference Include="HeuristicLab.Optimization-3.3">
     91      <HintPath>..\HeuristicLab.Optimization\3.3\obj\Debug\HeuristicLab.Optimization-3.3.dll</HintPath>
     92    </Reference>
     93    <Reference Include="HeuristicLab.Optimization.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     94      <SpecificVersion>False</SpecificVersion>
     95      <HintPath>..\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath>
     96    </Reference>
     97    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     98      <SpecificVersion>False</SpecificVersion>
     99      <HintPath>..\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
     100    </Reference>
     101    <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     102      <SpecificVersion>False</SpecificVersion>
     103      <HintPath>..\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
     104    </Reference>
     105    <Reference Include="HeuristicLab.Problems.Instances-3.3">
     106      <HintPath>..\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
     107    </Reference>
     108    <Reference Include="HeuristicLab.Problems.TravelingSalesman-3.3">
     109      <HintPath>..\bin\HeuristicLab.Problems.TravelingSalesman-3.3.dll</HintPath>
     110    </Reference>
     111    <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     112      <SpecificVersion>False</SpecificVersion>
     113      <HintPath>..\bin\HeuristicLab.Random-3.3.dll</HintPath>
     114    </Reference>
     115    <Reference Include="HeuristicLab.Selection-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     116      <SpecificVersion>False</SpecificVersion>
     117      <HintPath>..\bin\HeuristicLab.Selection-3.3.dll</HintPath>
     118    </Reference>
     119    <Reference Include="HeuristicLab.Tracing-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     120      <SpecificVersion>False</SpecificVersion>
     121      <HintPath>..\bin\HeuristicLab.Tracing-3.3.dll</HintPath>
     122    </Reference>
    34123    <Reference Include="System" />
    35124    <Reference Include="System.Core" />
     
    43132  </ItemGroup>
    44133  <ItemGroup>
     134    <Compile Include="HiveScenarioManager.cs" />
    45135    <Compile Include="Interfaces\IControllerService.cs" />
     136    <Compile Include="Interfaces\IScenarioManager.cs" />
    46137    <Compile Include="Model\ControllerModel.cs" />
    47138    <Compile Include="PlaceholderControllerService.cs" />
    48139    <Compile Include="Properties\AssemblyInfo.cs" />
     140    <Compile Include="Utility.cs" />
     141  </ItemGroup>
     142  <ItemGroup>
     143    <WCFMetadata Include="Service References\" />
    49144  </ItemGroup>
    50145  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IControllerService.cs

    r8384 r8506  
    1515    [OperationContract]
    1616    OptimizationScenario GetOptimizationScenarioByName(string name);
     17
     18    [OperationContract]
     19    void ScheduleOptimizationScenario(OptimizationScenario scenario);
    1720  }
    1821}
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Model/ControllerModel.cs

    r8384 r8506  
    44using System.Text;
    55using System.Runtime.Serialization;
     6using System.Globalization;
     7using System.Xml;
    68
    79namespace HeuristicLab.Services.Optimization.ControllerService.Model {
     
    2527
    2628  [DataContract]
    27   public abstract class Value {   
     29  public abstract class Value {
     30    [DataMember]
     31    public string Name { get; set; }
     32
     33    public abstract bool TrySetFromString(string input);
     34  }
     35
     36
     37  [DataContract]
     38  public class DecimalMatrix : Value {
     39    [DataMember]
     40    public double[][] Value { get; set; }
     41
     42    public override bool TrySetFromString(string input) {
     43      var splitted = input.Split(':');
     44      int i, j;
     45      if (splitted.Length != 3)
     46        return false;
     47
     48      if (!int.TryParse(splitted[0], out i))
     49        return false;
     50
     51      if (!int.TryParse(splitted[1], out j))
     52        return false;
     53
     54      double value;
     55      if (!double.TryParse(splitted[2], out value))
     56        return false;
     57      // very, very buggy
     58      if (i >= Value.Length || j >= Value[0].Length ) {
     59        double[][] valueArr = new double[i >= Value.GetLength(0) ? i : Value.GetLength(0)][];       
     60        for (int k = 0; k < Value.Length; k++) {
     61          valueArr[k] = new double[j >= Value.GetLength(1) ? j : Value.GetLength(1)];
     62          for (int l = 0; l < Value[k].Length; l++) {
     63            valueArr[k][l] = Value[k][l];
     64          }
     65        }
     66        Value = valueArr;
     67      }
     68
     69      Value[i][j] = value;
     70      return true;
     71    }
     72  }
     73
     74  [DataContract]
     75  public class DecimalVector : Value {
     76    [DataMember]
     77    public double[] Value { get; set; }
     78
     79    public override bool TrySetFromString(string input) {
     80      var splitted = input.Split(':');
     81      int index;
     82      if (splitted.Length != 2)
     83        return false;
     84
     85      if (!int.TryParse(splitted[0], out index))
     86        return false;
     87
     88      double value;
     89      if (!double.TryParse(splitted[1], out value))
     90        return false;
     91
     92      if (index >= Value.Length) {
     93        double[] valueArr = new double[index + 1];
     94        Array.Copy(Value, valueArr, Value.Length);
     95        Value = valueArr;
     96      }
     97
     98      Value[index] = value;
     99      return true;
     100    }
     101  }
     102
     103  [DataContract]
     104  public class TypeValue : Value {
     105    [DataMember]
     106    public string Value { get; set; }
     107
     108    [DataMember]
     109    public string[] Options { get; set; }
     110
     111    public override bool TrySetFromString(string input) {
     112      if (Options.Contains(input)) {
     113        Value = input;
     114        return true;
     115      }
     116      return false;
     117    }
    28118  }
    29119
     
    32122    [DataMember]
    33123    public double Value { get; set; }
     124
     125    public override bool TrySetFromString(string input) {
     126      double result;
     127      if (double.TryParse(input, out result)) {
     128        Value = result;
     129        return true;
     130      }
     131      return false;
     132    }
    34133  }
    35134
     
    38137    [DataMember]
    39138    public bool Value { get; set; }
     139
     140    public override bool TrySetFromString(string input) {
     141      bool result;
     142      if (input.Contains(","))
     143        input = input.Split(',')[0].Trim();
     144      if (bool.TryParse(input, out result)) {
     145        Value = result;
     146        return true;
     147      }
     148      return false;
     149    }
    40150  }
    41151
     
    43153  [KnownType(typeof(BoolValue))]
    44154  [KnownType(typeof(DecimalValue))]
    45   public class Parameter {
    46     [DataMember]
    47     public string Name { get; set; }
    48    
     155  [KnownType(typeof(TypeValue))]
     156  [KnownType(typeof(DecimalVector))]
     157  [KnownType(typeof(DecimalMatrix))]
     158  public class Parameter {       
    49159    // some kind of value type
    50160    [DataMember]
     
    52162   
    53163    [DataMember]
    54     public Value Value { get; set; }
    55 
     164    public Value Value { get; set; }   
    56165    /*
    57166    //[DataMember]
     
    60169
    61170  [DataContract]
     171  public class InputParameters {
     172    private IList<Parameter> items = new List<Parameter>();
     173
     174    [DataMember]
     175    public IList<Parameter> Items {
     176      get { return items; }
     177      set { items = value; }
     178    }
     179  }
     180
     181  [DataContract]
     182  public class AlgorithmParameters {
     183    private IList<Parameter> items = new List<Parameter>();
     184
     185    [DataMember]
     186    public IList<Parameter> Items {
     187      get { return items; }
     188      set { items = value; }
     189    }
     190  }
     191
     192  [DataContract]
    62193  public class OptimizationScenario {
    63194    [DataMember]
    64195    public string Name { get; set; }
    65196
    66     private IList<Parameter> inputParameters = new List<Parameter>();
    67 
    68     [DataMember]
    69     public IList<Parameter> InputParameters {
    70       get { return inputParameters; }
    71       set { inputParameters = value; }
    72     }
    73 
    74     private IList<Parameter> algorithmParameters = new List<Parameter>();
    75 
    76     [DataMember]
    77     public IList<Parameter> AlgorithmParameters {
     197    private InputParameters inputParams = new InputParameters();
     198
     199    [DataMember]
     200    public InputParameters InputParameters {
     201      get { return inputParams; }
     202      set { inputParams = value; }
     203    }
     204
     205
     206    private AlgorithmParameters algorithmParameters = new AlgorithmParameters();
     207
     208    [DataMember]
     209    public AlgorithmParameters AlgorithmParameters {
    78210      get { return algorithmParameters; }
    79211      set { algorithmParameters = value; }
    80212    }
     213
    81214  }
    82215}
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/PlaceholderControllerService.cs

    r8384 r8506  
    44using System.Text;
    55using System.ServiceModel;
     6using HeuristicLab.Services.Optimization.ControllerService.Interfaces;
    67
    78namespace HeuristicLab.Services.Optimization.ControllerService {
     
    1112    private IList<Model.OptimizationScenario> scenarios;
    1213
     14    private IScenarioManager hiveManager;
     15
    1316    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" } });
     17      var tsp = new Model.OptimizationScenario() { Name = "Traveling Salesman Problem" };
     18      hiveManager = new HiveScenarioManager();
     19      tsp.InputParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Decimal, Value = new Model.DecimalValue() { Name = "BestKnownQuality", Value = 6110.0d } });
     20      tsp.InputParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.DecimalVector
     21      ,Value =
     22        new Model.DecimalVector() {
     23          Name = "BestKnownSolution",
     24          Value = new double[]{
     25            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
     26      }}});
     27      tsp.InputParameters.Items.Add(new Model.Parameter() {       
     28        Type = Model.ParameterType.DecimalMatrix,
     29        Value =
     30          new Model.DecimalMatrix() {
     31            Name = "Coordinates",
     32            Value = Utility.ToJagged(new double[,] { { 334.5909245845, 161.7809319139 }, { 334.5909245845, 161.7809319139 }, { 503.8741827107, 172.8741151168 } })
     33          }
     34      });
     35      tsp.InputParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Type, Value = new Model.TypeValue() { Name = "EvaluatorParameter", Value = "HeuristicLab.Problems.TravelingSalesman.TSPRoundedEuclideanPathEvaluator", Options = new string[] { "HeuristicLab.Problems.TravelingSalesman.TSPRoundedEuclideanPathEvaluator", "HeuristicLab.Problems.TravelingSalesman.TSPGeoPathEvaluator", "HeuristicLab.Problems.TravelingSalesman.TSPEuclideanPathEvaluator" } } });
    2136      //tsp.InputParameters.Add(new Model.Parameter() { Name = "SolutionCreator" });
    22       tsp.InputParameters.Add(new Model.Parameter() { Name = "UseDistanceMatrix", Type = Model.ParameterType.Boolean});//, Value = true });
     37      tsp.InputParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Boolean, Value = new Model.BoolValue() { Name = "UseDistanceMatrix", Value = true } });
    2338
    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 });
     39      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Type, Value = new Model.TypeValue() { Name = "CrossoverParameter", Value = "OrderCrossover2", Options = new string[] { "OrderCrossover2", "CosaCrossover" } } });
     40      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Integer, Value = new Model.DecimalValue() { Name = "Elites", Value = 1 } });
     41      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Integer, Value = new Model.DecimalValue() { Name = "MaximumGenerations", Value = 1000 } });//, Value = 1000});
     42      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Percent, Value = new Model.DecimalValue() { Name = "MutationProbability", Value = 5 } });//, Value = 5});
     43      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Type, Value = new Model.TypeValue() { Name = "Mutator", Value = "InversionManipulator", Options = new string[] { "InversionManipulator", "ScrambleManipulator" } } });
     44      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Integer, Value = new Model.DecimalValue() { Name = "PopulationSize", Value = 100 } });//, Value = 100 });
     45      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Integer, Value = new Model.DecimalValue() { Name = "Seed", Value = 100 } });//, Value = 100 });
     46      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Type, Value = new Model.TypeValue() { Name = "Selector", Value = "ProportionalSelector", Options = new string[] { "ProportionalSelector", "BestSelector" } } });
     47      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Boolean, Value = new Model.BoolValue() { Name = "SetSeedRandomly", Value = true } });//, Value = true });
    3348      this.scenarios = new List<Model.OptimizationScenario>() { tsp };
     49      //hiveManager.DispatchScenario(tsp);
    3450    }
    3551
     
    4460      return null;
    4561    }
     62
     63    public void ScheduleOptimizationScenario(Model.OptimizationScenario scenario) {
     64      hiveManager.DispatchScenario(scenario);
     65    }
     66
     67   
    4668  }
    4769}
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/OptimizationController.cs

    r8384 r8506  
    3333
    3434        public ActionResult ProblemParameters(string scenario) {
    35           OptimizationScenario optScenario;
     35          OptimizationScenario optScenario;         
    3636          using (var cf = new ChannelFactory<IControllerService>(OptimizationController.DEFAULT_CONTROLLER_ENDPOINT)) {
    3737            var credentialBehaviour = cf.Endpoint.Behaviors.Find<ClientCredentials>();
     
    4040            var controllerProxy = cf.CreateChannel();
    4141            optScenario = controllerProxy.GetOptimizationScenarioByName(scenario);
     42            Session["scenario"] = optScenario;
    4243          }
    43           return View(optScenario);
     44          return View(optScenario.InputParameters);
    4445        }
    4546
    4647        [HttpPost]
    47         public ActionResult ProblemParameters(OptimizationScenario scenario) {
     48        public ActionResult ProblemParameters(InputParameters parameters) {
    4849          if (ModelState.IsValid) {
    49             // store it... maybe
    50           }
    51           return View(scenario);
     50            return RedirectToAction("AlgorithmParameters", parameters);
     51          } 
     52          return View(parameters);       
    5253        }
    5354
     55        public ActionResult AlgorithmParameters() {
     56          return View((Session["scenario"] as OptimizationScenario).AlgorithmParameters);
     57        }
     58
     59        [HttpPost]
     60        public ActionResult AlgorithmParameters(AlgorithmParameters parameters) {
     61          if (ModelState.IsValid) {
     62            return RedirectToAction("ScheduleJob");
     63          }
     64          return View(parameters);
     65        }
     66
     67        public ActionResult ScheduleJob() {
     68          return View(Session["scenario"]);
     69        }
     70
     71        [HttpPost]
     72        public ActionResult ScheduleJob(OptimizationScenario scenario) {
     73          using (var cf = new ChannelFactory<IControllerService>(OptimizationController.DEFAULT_CONTROLLER_ENDPOINT)) {
     74            var credentialBehaviour = cf.Endpoint.Behaviors.Find<ClientCredentials>();
     75            credentialBehaviour.UserName.UserName = Membership.GetUser().UserName;
     76            credentialBehaviour.UserName.Password = Session["pw"] as string;
     77            var controllerProxy = cf.CreateChannel();
     78            controllerProxy.ScheduleOptimizationScenario(Session["scenario"] as OptimizationScenario);
     79          }
     80          return RedirectToAction("Index");
     81        }
    5482    }
    5583}
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Global.asax.cs

    r8384 r8506  
    3232      RegisterGlobalFilters(GlobalFilters.Filters);
    3333      RegisterRoutes(RouteTable.Routes);
    34       ModelBinders.Binders.Add(typeof(Optimization.ControllerService.Model.OptimizationScenario), new OptimizationModelBinder());
     34      ModelBinders.Binders.Add(typeof(Optimization.ControllerService.Model.InputParameters), new ProblemParametersModelBinder());
     35      ModelBinders.Binders.Add(typeof(Optimization.ControllerService.Model.AlgorithmParameters), new AlgorithmParametersModelBinder());
    3536    }
    3637  }
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/HeuristicLab.Services.Optimization.Web.csproj

    r8384 r8506  
    194194    <Content Include="Views\Optimization\ProblemParameters.cshtml" />
    195195  </ItemGroup>
     196  <ItemGroup>
     197    <Content Include="Views\Optimization\AlgorithmParameters.cshtml" />
     198  </ItemGroup>
     199  <ItemGroup>
     200    <Content Include="Views\Optimization\ScheduleJob.cshtml" />
     201  </ItemGroup>
     202  <ItemGroup>
     203    <Content Include="Views\Shared\EditorTemplates\InputParameters.cshtml" />
     204  </ItemGroup>
     205  <ItemGroup>
     206    <Content Include="Views\Shared\EditorTemplates\DecimalValue.cshtml" />
     207  </ItemGroup>
     208  <ItemGroup>
     209    <Content Include="Views\Shared\EditorTemplates\BoolValue.cshtml" />
     210  </ItemGroup>
     211  <ItemGroup>
     212    <Content Include="Views\Shared\EditorTemplates\TypeValue.cshtml" />
     213  </ItemGroup>
     214  <ItemGroup>
     215    <Content Include="Views\Shared\EditorTemplates\DecimalMatrix.cshtml" />
     216  </ItemGroup>
     217  <ItemGroup>
     218    <Content Include="Views\Shared\EditorTemplates\DecimalVector.cshtml" />
     219  </ItemGroup>
     220  <ItemGroup>
     221    <Content Include="Views\Shared\EditorTemplates\AlgorithmParameters.cshtml" />
     222  </ItemGroup>
     223  <ItemGroup>
     224    <Content Include="Views\Shared\DisplayTemplates\AlgorithmParameters.cshtml" />
     225  </ItemGroup>
     226  <ItemGroup>
     227    <Content Include="Views\Shared\DisplayTemplates\TypeValue.cshtml" />
     228  </ItemGroup>
     229  <ItemGroup>
     230    <Content Include="Views\Shared\DisplayTemplates\BoolValue.cshtml" />
     231  </ItemGroup>
     232  <ItemGroup>
     233    <Content Include="Views\Shared\DisplayTemplates\DecimalMatrix.cshtml" />
     234  </ItemGroup>
     235  <ItemGroup>
     236    <Content Include="Views\Shared\DisplayTemplates\DecimalValue.cshtml" />
     237  </ItemGroup>
     238  <ItemGroup>
     239    <Content Include="Views\Shared\DisplayTemplates\DecimalVector.cshtml" />
     240  </ItemGroup>
     241  <ItemGroup>
     242    <Content Include="Views\Shared\DisplayTemplates\InputParameters.cshtml" />
     243  </ItemGroup>
     244  <ItemGroup>
     245    <Content Include="HeuristicLab 3.3.exe.config" />
     246  </ItemGroup>
    196247  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
    197248  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Models/OptimizationModels.cs

    r8384 r8506  
    77
    88namespace HeuristicLab.Services.Optimization.Web.Models {
    9   public class OptimizationModelBinder : IModelBinder {
     9
     10  public class ProblemParametersModelBinder : IModelBinder {
    1011    public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) {
    11       var scenario = new Optimization.ControllerService.Model.OptimizationScenario();
     12      var scenario = controllerContext.HttpContext.Session["scenario"] as OptimizationScenario;
    1213      foreach (var key in controllerContext.RequestContext.HttpContext.Request.Form.AllKeys) {
    13         var value = bindingContext.ValueProvider.GetValue(key);       
    14         scenario.InputParameters.Add(new HeuristicLab.Services.Optimization.ControllerService.Model.Parameter() { });
     14        var value = bindingContext.ValueProvider.GetValue(key);
     15        string realKey = key;
     16        string realValue = value.AttemptedValue;
     17
     18        if (key.Contains("_")) {
     19          var tableEntry = key.Split('_');
     20          realKey = tableEntry[0];
     21          //var param2 = (from par in scenario.InputParameters.Items where par.Name == tableEntry[0] select par).FirstOrDefault();
     22          realValue = "";
     23          for (int i = 1; i < tableEntry.Length; i++) {
     24            realValue += tableEntry[i] + ":";
     25          }
     26          realValue += value.AttemptedValue;
     27        }
     28        var param = (from par in scenario.InputParameters.Items where par.Value.Name == realKey select par).FirstOrDefault();
     29        if (!param.Value.TrySetFromString(realValue)) {
     30          bindingContext.ModelState.AddModelError(bindingContext.ModelName, new Exception(string.Format("Unable to parse {0} into destination type {1}", value, param.Type)));
     31        }
    1532      }
    16       return new Optimization.ControllerService.Model.OptimizationScenario();
     33      return scenario.InputParameters;
     34    }
     35  }
     36
     37  public class AlgorithmParametersModelBinder : IModelBinder {
     38    public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) {
     39      var scenario = controllerContext.HttpContext.Session["scenario"] as OptimizationScenario;
     40      foreach (var key in controllerContext.RequestContext.HttpContext.Request.Form.AllKeys) {
     41        var value = bindingContext.ValueProvider.GetValue(key);
     42        var param = (from par in scenario.AlgorithmParameters.Items where par.Value.Name == key select par).FirstOrDefault();
     43        if (!param.Value.TrySetFromString(value.AttemptedValue)) {
     44          bindingContext.ModelState.AddModelError(bindingContext.ModelName, new Exception(string.Format("Unable to parse {0} into destination type {1}", value, param.Type)));
     45        }
     46      }
     47      return scenario.AlgorithmParameters;
    1748    }
    1849  }
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Optimization/Index.cshtml

    r8384 r8506  
    1212}
    1313</ul>
    14 
    15 <p>TSP</p>
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Optimization/ProblemParameters.cshtml

    r8384 r8506  
    1 @model HeuristicLab.Services.Optimization.ControllerService.Model.OptimizationScenario
     1@model HeuristicLab.Services.Optimization.ControllerService.Model.InputParameters
    22
    33@{
     
    1010    @Html.ValidationSummary(true)
    1111    <fieldset>
    12     @foreach (var itm in Model.InputParameters) {
    13         <div class="editor-label">
    14             @Html.Label(itm.Name, itm.Name)
    15         </div>
    16         <div class="editor-field">
    17           @switch(itm.Type) {
    18             case HeuristicLab.Services.Optimization.ControllerService.Model.ParameterType.Decimal:
    19             case HeuristicLab.Services.Optimization.ControllerService.Model.ParameterType.Integer:
    20               @Html.Raw(Html.TextBoxFor(model => ((HeuristicLab.Services.Optimization.ControllerService.Model.DecimalValue)itm.Value).Value).ToString().Replace("Value", itm.Name));
    21               break;
    22             case HeuristicLab.Services.Optimization.ControllerService.Model.ParameterType.Boolean:
    23               //@Html.CheckBoxFor(model => itm.Value);
    24               break;
    25             default:               
    26               @Html.EditorFor(model => itm.Value, new { id = itm.Name });
    27               break;
    28           }
    29         </div>
    30     }
     12    @Html.EditorFor(model => Model)
    3113    <p>
    3214        <input type="submit" value="Proceed to algorithm parameters" />
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Web.config

    r8384 r8506  
    1313      </listeners>
    1414    </trace>
     15    <sources>
     16      <source name="System.ServiceModel"
     17              switchValue="Information, ActivityTracing"
     18              propagateActivity="true" >
     19        <listeners>
     20          <add name="xml"/>
     21        </listeners>
     22      </source>
     23      <source name="System.ServiceModel.MessageLogging">
     24        <listeners>
     25          <add name="xml"/>
     26        </listeners>
     27      </source>
     28      <source name="myUserTraceSource"
     29              switchValue="Information, ActivityTracing">
     30        <listeners>
     31          <add name="xml"/>
     32        </listeners>
     33      </source>
     34    </sources>
     35    <sharedListeners>
     36      <add name="xml"
     37           type="System.Diagnostics.XmlWriterTraceListener"
     38                 initializeData="C:\logs\Traces.svclog" />
     39    </sharedListeners>
    1540  </system.diagnostics>
     41 
     42 
    1643  <connectionStrings>
    1744    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
     
    107134        <binding name="WSHttpBinding_IControllerService" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
    108135          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
     136          <security mode="Message">
     137            <transport clientCredentialType="Certificate"/>
     138            <message clientCredentialType="UserName"/>
     139          </security>
     140        </binding>
     141        <binding name="WSHttpBinding_IHiveService" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
     142          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    109143          <security mode="Message">
    110144            <transport clientCredentialType="Certificate"/>
     
    150184    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    151185    <client>
    152       <endpoint address="http://localhost:2092/ControllerService.svc" behaviorConfiguration="LocalCertValidation"
     186      <endpoint address="http://localhost:8080/ControllerService.svc" behaviorConfiguration="LocalCertValidation"
    153187          binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IControllerService"
    154188          contract="HeuristicLab.Services.Optimization.ControllerService.IControllerService" name="WSHttpBinding_IControllerService">
     
    157191        </identity>
    158192      </endpoint>
     193      <endpoint address="http://127.0.0.1:81/HiveService.svc" behaviorConfiguration="LocalCertValidation"
     194         binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IHiveService" contract="HeuristicLab.Clients.Hive.IHiveService" name="WSHttpBinding_IHiveService">
     195        <identity>
     196          <certificate encodedValue="ADJUST_ME" />
     197        </identity>
     198      </endpoint>
     199      <!--
     200      <endpoint address="http://optimization.cloudapp.net/HiveService.svc" behaviorConfiguration="LocalCertValidation"
     201         binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IHiveService" contract="HeuristicLab.Clients.Hive.IHiveService" name="WSHttpBinding_IHiveService">
     202        <identity>
     203          <certificate encodedValue="ADJUST_ME" />
     204        </identity>
     205      </endpoint>
     206      -->
    159207    </client>
    160208  </system.serviceModel>
Note: See TracChangeset for help on using the changeset viewer.