Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/11/13 13:32:32 (11 years ago)
Author:
sforsten
Message:

#1980:

  • set plugin dependencies
  • added smart initialization
  • added hierarchical selection
  • fixed major and minor default rule
  • fixed several smaller bugs
  • some refactoring has been done
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Rule.cs

    r9392 r9605  
    4343    public IAction Action { get { return action; } }
    4444
     45    public double Length {
     46      get { return variables.Values.Sum(x => x.Length); }
     47    }
     48
    4549    [StorableConstructor]
    4650    protected Rule(bool deserializing) : base(deserializing) { }
     
    7781    }
    7882
    79     public void Randomize(IRandom random, double onePercentage, IEnumerable<IDiscretizer> discretizer) {
     83    public void Randomize(IRandom random, double oneProbability, IEnumerable<IDiscretizer> discretizers, IEnumerable<IAction> exceptActions = null) {
    8084      foreach (var variable in variables.Values) {
    81         variable.Randomize(random, onePercentage, discretizer);
     85        variable.Randomize(random, oneProbability, discretizers);
    8286      }
    83       action.Randomize(random);
     87      if (exceptActions == null) {
     88        action.Randomize(random);
     89      } else {
     90        action.Randomize(random, exceptActions);
     91      }
     92    }
     93
     94    public void SetToMatchInput(IGAssistInput input) {
     95      foreach (var variable in variables) {
     96        if (!input.VariableNames.Contains(variable.Key)) {
     97          throw new ArgumentException("input does not contain variable name of rule");
     98        }
     99        variable.Value.SetToMatch(input.GetVariableValue(variable.Key));
     100      }
    84101    }
    85102
Note: See TracChangeset for help on using the changeset viewer.