Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/27/14 18:30:43 (10 years ago)
Author:
abeham
Message:

#2174:

  • Added analyzer operator that will call into the analyze function
  • Added helper class for creating a parameter vector
  • Added parameters to the interfaces and improved wiring
File:
1 edited

Legend:

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

    r11393 r11396  
    2121
    2222using System;
    23 using System.Collections.Generic;
    2423using HeuristicLab.Common;
    2524using HeuristicLab.Core;
    2625using HeuristicLab.Data;
    27 using HeuristicLab.Encodings.BinaryVectorEncoding;
    28 using HeuristicLab.Encodings.IntegerVectorEncoding;
    29 using HeuristicLab.Encodings.PermutationEncoding;
    30 using HeuristicLab.Encodings.RealVectorEncoding;
    3126using HeuristicLab.Operators;
    3227using HeuristicLab.Optimization;
     
    7974      if (host.Instance == null) throw new InvalidOperationException("Problem definition instance is null.");
    8075      var config = ConfigurationParameter.ActualValue;
    81       var binDict = new Dictionary<string, BinaryVector>();
    82       var intDict = new Dictionary<string, IntegerVector>();
    83       var realDict = new Dictionary<string, RealVector>();
    84       var permDict = new Dictionary<string, Permutation>();
    85       foreach (var param in config.Parameters) {
    86         var binConfig = param.Value as BinaryParameterConfiguration;
    87         if (binConfig != null) {
    88           binDict.Add(param.Key, (BinaryVector)ExecutionContext.Scope.Variables[param.Key].Value);
    89           continue;
    90         }
    91         var intConfig = param.Value as IntegerParameterConfiguration;
    92         if (intConfig != null) {
    93           intDict.Add(param.Key, (IntegerVector)ExecutionContext.Scope.Variables[param.Key].Value);
    94           continue;
    95         }
    96         var realConfig = param.Value as RealParameterConfiguration;
    97         if (realConfig != null) {
    98           realDict.Add(param.Key, (RealVector)ExecutionContext.Scope.Variables[param.Key].Value);
    99           continue;
    100         }
    101         var permConfig = param.Value as PermutationParameterConfiguration;
    102         if (permConfig != null) {
    103           permDict.Add(param.Key, (Permutation)ExecutionContext.Scope.Variables[param.Key].Value);
    104           continue;
    105         }
    106         throw new InvalidOperationException("Parameter " + param.Key + " not found.");
    107       }
    108       var vector = new ParameterVector(
    109         binaryVectors: binDict.Count > 0 ? binDict : null,
    110         integerVectors: intDict.Count > 0 ? intDict : null,
    111         realVectors: realDict.Count > 0 ? realDict : null,
    112         permutations: permDict.Count > 0 ? permDict : null);
     76      var vector = Helper.Extract(ExecutionContext.Scope, config);
    11377      MoveQualityParameter.ActualValue = new DoubleValue(host.Instance.Evaluate(random, vector));
    11478      return base.InstrumentedApply();
Note: See TracChangeset for help on using the changeset viewer.