Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/26/14 22:57:18 (10 years ago)
Author:
abeham
Message:

#2174: enabled possibility to set different problem definitions than just scripted ones

File:
1 edited

Legend:

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

    r10850 r11393  
    4343    }
    4444
    45     public ILookupParameter<SingleObjectiveScript> ScriptParameter {
    46       get { return (ILookupParameter<SingleObjectiveScript>)Parameters["Script"]; }
     45    public ILookupParameter<ISingleObjectiveProblemDefinitionHost> ProblemDefinitionParameter {
     46      get { return (ILookupParameter<ISingleObjectiveProblemDefinitionHost>)Parameters["ProblemDefinition"]; }
    4747    }
    4848
     
    6060    public SingleObjectiveEvaluator() {
    6161      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));
    62       Parameters.Add(new LookupParameter<SingleObjectiveScript>("Script", "The script that will execute the evaluation function and define the parameter vector."));
     62      Parameters.Add(new LookupParameter<ISingleObjectiveProblemDefinitionHost>("ProblemDefinition", "The host that holds the problem definition."));
    6363      Parameters.Add(new LookupParameter<Configuration>("Configuration", "An item that holds the problem's configuration."));
    6464      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the parameter vector."));
     
    7171    public override IOperation Apply() {
    7272      var random = RandomParameter.ActualValue;
    73       var runner = ScriptParameter.ActualValue;
    74       if (runner.Instance == null) throw new InvalidOperationException("Script instance is null, maybe the code doesn't compile.");
     73      var host = ProblemDefinitionParameter.ActualValue;
     74      if (host.Instance == null) throw new InvalidOperationException("Script instance is null, maybe the code doesn't compile.");
    7575      var config = ConfigurationParameter.ActualValue;
    7676      var binDict = new Dictionary<string, BinaryVector>();
     
    106106        realVectors: realDict.Count > 0 ? realDict : null,
    107107        permutations: permDict.Count > 0 ? permDict : null);
    108       QualityParameter.ActualValue = new DoubleValue(runner.Instance.Evaluate(random, vector));
     108      QualityParameter.ActualValue = new DoubleValue(host.Instance.Evaluate(random, vector));
    109109      return base.Apply();
    110110    }
Note: See TracChangeset for help on using the changeset viewer.