Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/29/14 17:39:19 (10 years ago)
Author:
abeham
Message:

#2174: Made single-objective programmable problem compatible with scatter search

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Helper.cs

    r11396 r11405  
    6464        permutations: permDict.Count > 0 ? permDict : null);
    6565    }
     66
     67    internal static void Write(IScope scope, ParameterVector vector) {
     68      foreach (var param in vector.BinaryNames) {
     69        if (scope.Variables.ContainsKey(param))
     70          scope.Variables[param].Value = vector.BinaryVector(param);
     71        else scope.Variables.Add(new Variable(param, vector.BinaryVector(param)));
     72      }
     73      foreach (var param in vector.IntegerNames) {
     74        if (scope.Variables.ContainsKey(param))
     75          scope.Variables[param].Value = vector.IntegerVector(param);
     76        else scope.Variables.Add(new Variable(param, vector.IntegerVector(param)));
     77      }
     78      foreach (var param in vector.RealNames) {
     79        if (scope.Variables.ContainsKey(param))
     80          scope.Variables[param].Value = vector.RealVector(param);
     81        else scope.Variables.Add(new Variable(param, vector.RealVector(param)));
     82      }
     83      foreach (var param in vector.PermutationNames) {
     84        if (scope.Variables.ContainsKey(param))
     85          scope.Variables[param].Value = vector.Permutation(param);
     86        else scope.Variables.Add(new Variable(param, vector.Permutation(param)));
     87      }
     88    }
    6689  }
    6790}
Note: See TracChangeset for help on using the changeset viewer.