Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/17/15 19:23:51 (10 years ago)
Author:
gkronber
Message:

#2205: derived selection problem from BinaryProblem (now PPP can be used as feature selection algorithm)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/OptimizationNetworks/HeuristicLab.Networks/3.3/FeatureSelection Network/SelectionProblem.cs

    r12323 r12326  
    77using HeuristicLab.Parameters;
    88using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     9using HeuristicLab.Problems.Binary;
    910
    1011namespace HeuristicLab.Networks.FeatureSelection_Network {
    11   public class SelectionProblem : SingleObjectiveBasicProblem<BinaryVectorEncoding> {
     12  public class SelectionProblem : BinaryProblem {
    1213    private Func<BinaryVector, double> eval;
    13 
    14     public virtual int Length {
    15       get { return Encoding.Length; }
    16       set { Encoding.Length = value; }
    17     }
    1814
    1915    protected SelectionProblem(SelectionProblem original, Cloner cloner)
     
    3026
    3127      var lengthParam = new ValueParameter<IntValue>("Length");
     28
     29
    3230      lengthParam.ValueChanged += (o, s) => { Length = lengthParam.Value.Value; };
     31      // we cannot use the fixed value parameter from BinaryProblem in the network
     32      Parameters.Remove("Length");
    3333      Parameters.Add(lengthParam);
    3434    }
     
    3838    }
    3939
    40     public override double Evaluate(Individual individual, IRandom random) {
    41       return eval(individual.BinaryVector());
     40    public override double Evaluate(BinaryVector vector, IRandom random) {
     41      return eval(vector);
     42
    4243    }
    4344
Note: See TracChangeset for help on using the changeset viewer.