Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/25/10 02:51:45 (14 years ago)
Author:
swagner
Message:

Worked on OKB (#1174)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/OKBClient.cs

    r4918 r4929  
    323323
    324324    #region Run Methods
    325     public bool AddRun(long algorithmId, long problemId, HeuristicLab.Optimization.Run run) {
    326       try {
    327         IAlgorithm algorithm = run.Algorithm;
     325    public bool AddRun(long algorithmId, long problemId, IAlgorithm algorithm) {
     326      try {
    328327        IProblem problem = algorithm.Problem;
    329328
     
    346345        r.ClientId = Guid.NewGuid();
    347346        r.FinishedDate = DateTime.Now;
    348         r.RandomSeed = ((IntValue)((IValueParameter)run.Parameters["Seed"]).Value).Value;
     347        r.RandomSeed = ((IntValue)((IValueParameter)algorithm.Parameters["Seed"]).Value).Value;
    349348        r.ResultValues = resultValues.ToArray();
    350349        r.Store();
     
    361360      List<AlgorithmParameterValue> values = new List<AlgorithmParameterValue>();
    362361      foreach (IValueParameter param in item.Parameters.OfType<IValueParameter>()) {
    363         if (param.GetsCollected && (param.Value != null)) {
     362        if (param.GetsCollected && (param.Value != null) && (param.Name != "Seed")) {
    364363          AlgorithmParameter p = parameters.FirstOrDefault(x => x.Name == prefix + param.Name);
    365364          if (p == null) {
     
    376375          value.AlgorithmParameterId = p.Id;
    377376          value.DataTypeId = ConvertToDataType(param.Value.GetType()).Id;
     377          values.Add(value);
    378378        }
    379379
     
    424424          value.ProblemParameterId = p.Id;
    425425          value.DataTypeId = ConvertToDataType(param.Value.GetType()).Id;
     426          values.Add(value);
    426427        }
    427428
     
    457458      List<ResultValue> values = new List<ResultValue>();
    458459      foreach (IResult result in algorithm.Results) {
    459         if ((result.Value != null) && (results.FirstOrDefault(x => x.Name == result.Name) == null)) {
    460           Result r = new Result();
    461           r.Name = result.Name;
    462           r.Alias = result.Name;
    463           r.Description = result.Description;
    464           r.AlgorithmId = algorithmId;
    465           r.DataTypeId = ConvertToDataType(result.DataType).Id;
    466           r.Store();
    467           results.Add(r);
     460        if (result.Value != null) {
     461          Result r = results.FirstOrDefault(x => x.Name == result.Name);
     462          if (r == null) {
     463            r = new Result();
     464            r.Name = result.Name;
     465            r.Alias = result.Name;
     466            r.Description = result.Description;
     467            r.AlgorithmId = algorithmId;
     468            r.DataTypeId = ConvertToDataType(result.DataType).Id;
     469            r.Store();
     470            results.Add(r);
     471          }
     472          ResultValue value = CreateResultValue(result.Value);
     473          value.ResultId = r.Id;
     474          value.DataTypeId = ConvertToDataType(result.Value.GetType()).Id;
     475          values.Add(value);
    468476        }
    469477      }
    470478      return values;
    471479    }
    472     private ResultValue CreateRestValue(IItem item) {
     480    private ResultValue CreateResultValue(IItem item) {
    473481      if (item is BoolValue) {
    474482        ResultBoolValue value = new ResultBoolValue();
Note: See TracChangeset for help on using the changeset viewer.