Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/10/13 15:15:13 (12 years ago)
Author:
sforsten
Message:

#1980:

  • added DecisionListView
  • added event handlers in *ProblemData
  • renamed project Problems.XCS.Views to Problems.lCS.Views and Problems.Instances.ConditionActionClassification to Problems.Instances.LCS
  • integrated niching in GAssist and added NichingTournamentSelector
  • minor code improvements and property changes
Location:
branches/LearningClassifierSystems
Files:
9 added
4 deleted
47 edited
2 copied
2 moved

Legend:

Unmodified
Added
Removed
  • branches/LearningClassifierSystems/HeuristicLab.Algorithms.GAssist/3.3/GAssist.cs

    r9342 r9352  
    4747    #region Problem Properties
    4848    public override Type ProblemType {
    49       get { return typeof(ISingleObjectiveHeuristicOptimizationProblem); }
    50     }
    51     public new ISingleObjectiveHeuristicOptimizationProblem Problem {
    52       get { return (ISingleObjectiveHeuristicOptimizationProblem)base.Problem; }
     49      get { return typeof(IGAssistProblem); }
     50    }
     51    public new IGAssistProblem Problem {
     52      get { return (IGAssistProblem)base.Problem; }
    5353      set { base.Problem = value; }
    5454    }
     
    6565      get { return (ValueParameter<IntValue>)Parameters["PopulationSize"]; }
    6666    }
    67     public IConstrainedValueParameter<ISelector> SelectorParameter {
    68       get { return (IConstrainedValueParameter<ISelector>)Parameters["Selector"]; }
     67    public IConstrainedValueParameter<IDefaultRuleOperator> DefaultRuleParameter {
     68      get { return (IConstrainedValueParameter<IDefaultRuleOperator>)Parameters["DefaultRule"]; }
     69    }
     70    public IConstrainedValueParameter<INichingSingleObjectiveSelector> SelectorParameter {
     71      get { return (IConstrainedValueParameter<INichingSingleObjectiveSelector>)Parameters["Selector"]; }
    6972    }
    7073    private ValueParameter<PercentValue> CrossoverProbabilityParameter {
     
    134137      set { PopulationSizeParameter.Value = value; }
    135138    }
    136     public ISelector Selector {
     139    public INichingSingleObjectiveSelector Selector {
    137140      get { return SelectorParameter.Value; }
    138141      set { SelectorParameter.Value = value; }
     
    192195      Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
    193196      Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The size of the population of solutions.", new IntValue(100)));
    194       Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
     197      Parameters.Add(new ConstrainedValueParameter<INichingSingleObjectiveSelector>("Selector", "The operator used to select solutions for reproduction."));
    195198      Parameters.Add(new ValueParameter<PercentValue>("CrossoverProbability", "The probability that the Crossover operator is applied on a solution.", new PercentValue(0.9)));
    196199      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
     
    208211      Parameters.Add(new FixedValueParameter<IntValue>("MaximumNumberOfIntervals", "", new IntValue(5)));
    209212      Parameters.Add(new FixedValueParameter<IntValue>("InitialNumberOfRules", "", new IntValue(20)));
     213      Parameters.Add(new ConstrainedValueParameter<IDefaultRuleOperator>("DefaultRule", ""));
    210214      Parameters.Add(new ConstrainedValueParameter<IDiscreteDoubleValueModifier>("ReinitializeCurveOperator", ""));
    211215      Parameters.Add(new ValueParameter<ItemCollection<IDiscretizer>>("Discretizers", "", new ItemCollection<IDiscretizer>()));
     
    236240      resultsCollector.Successor = mainLoop;
    237241
     242      mainLoop.DefaultRuleParameter.ActualName = DefaultRuleParameter.Name;
    238243      mainLoop.SelectorParameter.ActualName = SelectorParameter.Name;
    239244      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
     
    251256      mainLoop.ReinitializationProbabilityOperatorParameter.ActualName = ReinitializeCurveOperatorParameter.Name;
    252257
    253       foreach (ISelector selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name))
     258      foreach (INichingSingleObjectiveSelector selector in ApplicationManager.Manager.GetInstances<INichingSingleObjectiveSelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name))
    254259        SelectorParameter.ValidValues.Add(selector);
    255       ISelector proportionalSelector = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType().Name.Equals("ProportionalSelector"));
    256       if (proportionalSelector != null) SelectorParameter.Value = proportionalSelector;
     260      //INichingSingleObjectiveSelector proportionalSelector = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType().Name.Equals("ProportionalSelector"));
     261      //if (proportionalSelector != null) SelectorParameter.Value = proportionalSelector;
    257262      ParameterizeSelectors();
    258263
     
    349354      ParameterizeAnalyzers();
    350355      ParameterizeIterationBasedOperators();
     356      UpdateDefaultRuleOperators();
    351357      UpdateCrossovers();
    352358      UpdateMutators();
     
    430436    }
    431437    private void ParameterizeSelectors() {
    432       foreach (ISelector selector in SelectorParameter.ValidValues) {
     438      foreach (INichingSingleObjectiveSelector selector in SelectorParameter.ValidValues) {
    433439        selector.CopySelected = new BoolValue(true);
    434440        selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(2 * (PopulationSizeParameter.Value.Value - ElitesParameter.Value.Value));
    435441        selector.NumberOfSelectedSubScopesParameter.Hidden = true;
     442        selector.ParentsPerChildParameter.Value = new IntValue(2);
    436443        ParameterizeStochasticOperator(selector);
    437444      }
    438445      if (Problem != null) {
    439         foreach (ISingleObjectiveSelector selector in SelectorParameter.ValidValues.OfType<ISingleObjectiveSelector>()) {
     446        foreach (INichingSingleObjectiveSelector selector in SelectorParameter.ValidValues.OfType<INichingSingleObjectiveSelector>()) {
    440447          selector.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
    441448          selector.MaximizationParameter.Hidden = true;
    442449          selector.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
    443450          selector.QualityParameter.Hidden = true;
     451          selector.NichingParameter.ActualName = Problem.NichingParameterName;
     452          selector.GAssistNichesProblemDataParameter.ActualName = Problem.ProblemDataParameter.Name;
     453          //change
     454          selector.IndividualParameter.ActualName = "DecisionList";
    444455        }
    445456      }
     
    468479      }
    469480    }
     481    private void UpdateDefaultRuleOperators() {
     482      IDefaultRuleOperator oldDefaultRule = DefaultRuleParameter.Value;
     483      DefaultRuleParameter.ValidValues.Clear();
     484      IDefaultRuleOperator defaultdefaultRule = Problem.Operators.OfType<IDefaultRuleOperator>().FirstOrDefault();
     485
     486      foreach (IDefaultRuleOperator defaultRule in Problem.Operators.OfType<IDefaultRuleOperator>().OrderBy(x => x.Name))
     487        DefaultRuleParameter.ValidValues.Add(defaultRule);
     488
     489      if (oldDefaultRule != null) {
     490        IDefaultRuleOperator defaultRule = DefaultRuleParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldDefaultRule.GetType());
     491        if (defaultRule != null) DefaultRuleParameter.Value = defaultRule;
     492        else oldDefaultRule = null;
     493      }
     494      if (oldDefaultRule == null && defaultdefaultRule != null)
     495        DefaultRuleParameter.Value = defaultdefaultRule;
     496    }
    470497    private void UpdateCrossovers() {
    471498      ICrossover oldCrossover = CrossoverParameter.Value;
  • branches/LearningClassifierSystems/HeuristicLab.Algorithms.GAssist/3.3/GAssistMainLoop.cs

    r9342 r9352  
    6161    public ValueLookupParameter<IOperator> MutatorParameter {
    6262      get { return (ValueLookupParameter<IOperator>)Parameters["Mutator"]; }
     63    }
     64    public ValueLookupParameter<IOperator> DefaultRuleParameter {
     65      get { return (ValueLookupParameter<IOperator>)Parameters["DefaultRule"]; }
    6366    }
    6467    public ValueLookupParameter<IOperator> SpecialStagesParameter {
     
    130133      Parameters.Add(new ValueLookupParameter<IntValue>("PopulationSize", "The size of the population."));
    131134      Parameters.Add(new ValueLookupParameter<IOperator>("ReinitializationProbabilityOperator", ""));
     135      Parameters.Add(new ValueLookupParameter<IOperator>("DefaultRule", ""));
    132136      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the genetic algorithm should be applied."));
    133137      #endregion
     
    138142      Placeholder analyzer1 = new Placeholder();
    139143      Placeholder reinitializationProbabilityOperator = new Placeholder();
     144      Placeholder defaultRuleOperator = new Placeholder();
    140145      Placeholder selector = new Placeholder();
    141146      SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor();
     
    170175      analyzer1.OperatorParameter.ActualName = "Analyzer";
    171176
     177      defaultRuleOperator.Name = "Default Rule Operator";
     178      defaultRuleOperator.OperatorParameter.ActualName = DefaultRuleParameter.Name;
     179
    172180      reinitializationProbabilityOperator.Name = "Reinitialization Probability operator (placeholder)";
    173181      reinitializationProbabilityOperator.OperatorParameter.ActualName = ReinitializationProbabilityOperatorParameter.Name;
     
    229237      variableCreator.Successor = resultsCollector1;
    230238      resultsCollector1.Successor = analyzer1;
    231       analyzer1.Successor = reinitializationProbabilityOperator;
     239      analyzer1.Successor = defaultRuleOperator;
     240      defaultRuleOperator.Successor = reinitializationProbabilityOperator;
    232241      reinitializationProbabilityOperator.Successor = selector;
    233242      selector.Successor = subScopesProcessor1;
     
    263272      comparator.Successor = analyzer2;
    264273      analyzer2.Successor = conditionalBranch;
    265       conditionalBranch.FalseBranch = reinitializationProbabilityOperator;
     274      conditionalBranch.FalseBranch = defaultRuleOperator;
    266275      conditionalBranch.TrueBranch = null;
    267276      conditionalBranch.Successor = null;
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3/Interfaces/ICombinedIntegerVectorClassificationProblemData.cs

    r9242 r9352  
    2828    IFixedValueParameter<IntValue> LengthParameter { get; }
    2929    IFixedValueParameter<IntValue> ActionLengthParameter { get; }
    30     IFixedValueParameter<IntMatrix> BoundsParameter { get; }
     30    IValueParameter<IntMatrix> BoundsParameter { get; }
    3131  }
    3232}
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Action/IAction.cs

    r9334 r9352  
    2222using System.Collections.Generic;
    2323using HeuristicLab.Core;
     24using HeuristicLab.Optimization.Operators.LCS;
    2425
    2526namespace HeuristicLab.Encodings.DecisionList {
    26   public interface IAction : IItem {
     27  public interface IAction : IGAssistNiche {
    2728    string VariableName { get; }
    2829
    2930    int Possibilities { get; }
    3031    void Randomize(IRandom random);
     32    void Randomize(IRandom random, IEnumerable<IAction> except);
    3133
    3234    bool Match(IAction action);
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Action/IntAction.cs

    r9334 r9352  
    2525using HeuristicLab.Common;
    2626using HeuristicLab.Core;
     27using HeuristicLab.Optimization.Operators.LCS;
    2728using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2829
     
    3132  [Item("IntAction", "")]
    3233  public class IntAction : Item, IAction<int> {
     34
     35    public static IEqualityComparer<IGAssistNiche> Comparer {
     36      get { return new DecisionListNicheComparer(); }
     37    }
     38    IEqualityComparer<IGAssistNiche> IGAssistNiche.Comparer {
     39      get { return Comparer; }
     40    }
    3341
    3442    [Storable]
     
    8896    }
    8997
     98    public void Randomize(IRandom random, IEnumerable<IAction> except) {
     99      if (except.Count() == 0) {
     100        Randomize(random);
     101        return;
     102      }
     103      try {
     104        var exceptInt = except.Cast<IntAction>().Select(x => x.currentAction);
     105        var newPossibleFeatures = possibleFeatures.Except(exceptInt);
     106        currentAction = newPossibleFeatures.ElementAt(random.Next(0, newPossibleFeatures.Count()));
     107      }
     108      catch (InvalidCastException) {
     109        throw new InvalidCastException("Actions have to be of type IntAction");
     110      }
     111    }
     112
    90113    public bool Match(IAction action) {
    91114      var targetCast = action as IntAction;
     
    103126
    104127    public override string ToString() {
    105       return currentAction.ToString();
     128      return variableName + ": " + currentAction.ToString();
     129    }
     130
     131    public bool SameNiche(IGAssistNiche niche) {
     132      return Match(niche as IAction);
     133    }
     134
     135    public int GetNicheHashCode() {
     136      int result = 1;
     137      result = 37 * result + currentAction;
     138      result = 37 * result + variableName.GetHashCode();
     139      foreach (var feature in possibleFeatures) {
     140        result = 37 * result + feature;
     141      }
     142      return result;
    106143    }
    107144  }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Action/StringAction.cs

    r9334 r9352  
    2525using HeuristicLab.Common;
    2626using HeuristicLab.Core;
     27using HeuristicLab.Optimization.Operators.LCS;
    2728using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2829
     
    3132  [Item("StringAction", "")]
    3233  public class StringAction : Item, IAction<string> {
     34
     35    public static IEqualityComparer<IGAssistNiche> Comparer {
     36      get { return new DecisionListNicheComparer(); }
     37    }
     38
     39    IEqualityComparer<IGAssistNiche> IGAssistNiche.Comparer {
     40      get { return Comparer; }
     41    }
    3342
    3443    [Storable]
     
    92101    }
    93102
     103    public void Randomize(IRandom random, IEnumerable<IAction> except) {
     104      if (except.Count() == 0) {
     105        Randomize(random);
     106        return;
     107      }
     108      try {
     109        var exceptInt = except.Cast<StringAction>().Select(x => x.CurrentActionIndex);
     110        var newPossibleFeatures = Enumerable.Range(0, possibleFeatures.Count()).Except(exceptInt);
     111        currentActionIndex = newPossibleFeatures.ElementAt(random.Next(0, newPossibleFeatures.Count()));
     112      }
     113      catch (InvalidCastException) {
     114        throw new InvalidCastException("Actions have to be of type IntAction");
     115      }
     116    }
     117
    94118    public bool Match(IAction action) {
    95119      var targetCast = action as StringAction;
     
    107131
    108132    public override string ToString() {
    109       return CurrentAction;
     133      return variableName + ": " + CurrentAction;
     134    }
     135
     136    public bool SameNiche(IGAssistNiche niche) {
     137      return Match(niche as IAction);
     138    }
     139
     140    public int GetNicheHashCode() {
     141      int result = 1;
     142      result = 37 * result + currentActionIndex;
     143      result = 37 * result + variableName.GetHashCode();
     144      foreach (var feature in possibleFeatures) {
     145        result = 37 * result + feature.GetHashCode();
     146      }
     147      return result;
    110148    }
    111149  }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Creators/UniformRandomDecisionListCreator.cs

    r9342 r9352  
    5151      }
    5252
    53       return new DecisionList(rules); //, DefaultActionParameter.ActualValue);
     53      return new DecisionList(rules);
    5454    }
    5555  }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Crossover/SinglePointCrossover.cs

    r9342 r9352  
    4848
    4949    public static DecisionList Apply(IRandom random, DecisionList parent1, DecisionList parent2) {
     50      if (!parent1.DefaultAction.Match(parent2.DefaultAction)) { throw new ArgumentException("Default action of parents have to match!"); }
     51
    5052      int rulesP1 = random.Next(0, parent1.Rules.Count());
    5153      int rulesP2 = random.Next(0, parent2.Rules.Count());
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/DecisionList.cs

    r9342 r9352  
    109109    #region IGAssistIndividual Members
    110110
     111    public IGAssistNiche Niche {
     112      get { return defaultAction; }
     113    }
     114
     115    public void SetNiche(IRandom random, IGAssistNiche niche) {
     116      var action = niche as IAction;
     117      if (action == null) {
     118        throw new ArgumentException("Niche has to be an action");
     119      }
     120      if (Niche != null) {
     121        throw new ArgumentException("Niche has already been set. It cannot be set again.");
     122      }
     123      defaultAction = action;
     124      var except = new List<IAction>() { action };
     125      foreach (var rule in rules.Where(x => x.Action.SameNiche(niche))) {
     126        rule.Action.Randomize(random, except);
     127      }
     128    }
     129
    111130    public void ApplySplit(IRandom random, double probability) {
    112131      foreach (var rule in rules) {
     
    126145      }
    127146    }
    128 
    129147    #endregion
    130148  }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/DecisionListCreator.cs

    r9342 r9352  
    5252      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
    5353    }
    54     public IValueLookupParameter<IAction> DefaultActionParameter {
    55       get { return (IValueLookupParameter<IAction>)Parameters["DefaultAction"]; }
    56     }
    5754    #endregion
    5855
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/HeuristicLab.Encodings.DecisionList-3.3.csproj

    r9342 r9352  
    9292    <Compile Include="Action\IAction.cs" />
    9393    <Compile Include="Action\IntAction.cs" />
     94    <Compile Include="Analyzer\BestTrainingDecisionListAnalyzer.cs" />
    9495    <Compile Include="Creators\UniformRandomDecisionListCreator.cs" />
    9596    <Compile Include="Crossover\SinglePointCrossover.cs" />
     
    9798    <Compile Include="DecisionListCrossover.cs" />
    9899    <Compile Include="DecisionListManipulator.cs" />
     100    <Compile Include="DecisionListNicheComparer.cs" />
    99101    <Compile Include="DecisionListSolution.cs" />
    100102    <Compile Include="Evaluator\DecisionListEvaluator.cs" />
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Interfaces/IDecisionListClassificationProblemData.cs

    r9342 r9352  
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Data;
     26using HeuristicLab.Optimization.Operators.LCS;
    2627using HeuristicLab.Problems.DataAnalysis;
    2728
    2829namespace HeuristicLab.Encodings.DecisionList {
    29   public interface IDecisionListClassificationProblemData : INamedItem {
     30  public interface IDecisionListClassificationProblemData : IGAssistNichesProblemData {
    3031    Dataset Dataset { get; }
    3132    ICheckedItemList<StringValue> ConditionVariables { get; }
     
    4546    int Classes { get; }
    4647
    47     IFixedValueParameter<Rule> SampleRuleParameter { get; }
     48    IValueParameter<Rule> SampleRuleParameter { get; }
    4849
    4950    DecisionListInput FetchInput(int row);
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Interfaces/IDecisionListCreator.cs

    r9342 r9352  
    3131    IValueLookupParameter<IntValue> InitialNumberOfRulesParameter { get; }
    3232    IValueLookupParameter<PercentValue> OneProbabilityParameter { get; }
    33     IValueLookupParameter<IAction> DefaultActionParameter { get; }
    3433  }
    3534}
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Properties/AssemblyInfo.cs

    r9334 r9352  
    2121
    2222using System.Reflection;
     23using System.Runtime.CompilerServices;
    2324using System.Runtime.InteropServices;
    2425
     
    5455// [assembly: AssemblyVersion("1.0.*")]
    5556[assembly: AssemblyVersion("3.3.0.0")]
    56 [assembly: AssemblyFileVersion("3.3.7.9204")]
     57[assembly: AssemblyFileVersion("3.3.7.9342")]
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Rule.cs

    r9342 r9352  
    7373        sb.Append(variable.Value + "|");
    7474      }
    75       sb.Append(Action);
     75      sb.Append("|" + Action);
    7676      return sb.ToString();
    7777    }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Variable/Variable.cs

    r9342 r9352  
    7676    public override string ToString() {
    7777      StringBuilder sb = new StringBuilder();
     78      sb.Append(variableName + ": ");
    7879      foreach (var attr in attributes) {
    7980        if (attr) {
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Interfaces/IVariableVectorClassificationProblemData.cs

    r9242 r9352  
    2626namespace HeuristicLab.Encodings.VariableVector {
    2727  public interface IVariableVectorClassificationProblemData : IConditionActionProblemData {
    28     IFixedValueParameter<VariableVector> SampleVariableVectorParameter { get; }
     28    IValueParameter<VariableVector> SampleVariableVectorParameter { get; }
    2929    IFixedValueParameter<PercentValue> SpreadPercentageParameter { get; }
    3030  }
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3

    • Property svn:ignore set to
      obj
      Plugin.cs
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/DefaultRule/AutoDefaultRule.cs

    r9342 r9352  
    4444      get { return (ILookupParameter<ItemArray<DoubleValue>>)Parameters["Quality"]; }
    4545    }
    46     public ILookupParameter<ItemArray<IGAssistIndividual>> IndividualParameter {
    47       get { return (ILookupParameter<ItemArray<IGAssistIndividual>>)Parameters["Individual"]; }
    48     }
    4946    public IValueLookupParameter<IntValue> AccuraciesCountParameter {
    5047      get { return (IValueLookupParameter<IntValue>)Parameters["AccuraciesCount"]; }
     
    7067      Parameters.Add(new ValueLookupParameter<ItemDictionary<IGAssistNiche, ItemList<DoubleValue>>>("AverageAccuracies"));
    7168      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality"));
    72       Parameters.Add(new ScopeTreeLookupParameter<IGAssistIndividual>("Individual"));
    7369      Parameters.Add(new LookupParameter<IRandom>("Random"));
    74       Parameters.Add(new ValueLookupParameter<IntValue>("AccuraciesCount"));
     70      Parameters.Add(new ValueLookupParameter<IntValue>("AccuraciesCount", new IntValue(15)));
    7571      Parameters.Add(new ValueLookupParameter<IGAssistNicheEqualityComparer>("NicheComparer"));
    76       Parameters.Add(new ValueLookupParameter<DoubleValue>("NicheStandardDeviation"));
     72      Parameters.Add(new ValueLookupParameter<DoubleValue>("NicheStandardDeviation", new DoubleValue(0.005)));
    7773    }
    7874    public override IDeepCloneable Clone(Cloner cloner) {
     
    8278    public override IOperation Apply() {
    8379      if (NichingParameter.ActualValue == null) {
     80        IList<IGAssistNiche> niches = GAssistNichesProblemDataParameter.ActualValue.GetPossibleNiches().ToList();
    8481        NichingParameter.ActualValue = new BoolValue(true);
    85         NichesParameter.ActualValue = new IntValue(PossibleDefaultClassesParameter.ActualValue.Count);
    86         AverageAccuraciesParameter.ActualValue = new ItemDictionary<IGAssistNiche, ItemList<DoubleValue>>(NicheComparerParameter.ActualValue);
    87         foreach (var niche in PossibleDefaultClassesParameter.ActualValue) {
     82        NichesParameter.ActualValue = new IntValue(niches.Count);
     83        AverageAccuraciesParameter.ActualValue = new ItemDictionary<IGAssistNiche, ItemList<DoubleValue>>(NicheComparerParameter.ActualValue as IEqualityComparer<IGAssistNiche>);
     84        foreach (var niche in GAssistNichesProblemDataParameter.ActualValue.GetPossibleNiches()) {
    8885          AverageAccuracies.Add(niche, new ItemList<DoubleValue>(AccuraciesCount));
    8986        }
     87
     88        int i = 0;
     89        foreach (var individual in IndividualParameter.ActualValue) {
     90          individual.SetNiche(RandomParameter.ActualValue, niches[i]);
     91          i++;
     92          i %= niches.Count;
     93        }
     94
     95        OperationCollection next = new OperationCollection();
     96        next.Add(EvaluateSubScopes());
     97        next.Add(base.Apply());
     98        return next;
    9099      } else {
    91100        var nicheFitness = new Dictionary<IGAssistNiche, double>(NicheComparerParameter.ActualValue);
    92         foreach (var niche in PossibleDefaultClassesParameter.ActualValue) {
     101        foreach (var niche in GAssistNichesProblemDataParameter.ActualValue.GetPossibleNiches()) {
    93102          nicheFitness[niche] = 0.0;
    94103          while (AverageAccuracies[niche].Count >= AccuraciesCount) {
     
    105114        }
    106115
    107         foreach (var niche in PossibleDefaultClassesParameter.ActualValue) {
     116        foreach (var niche in GAssistNichesProblemDataParameter.ActualValue.GetPossibleNiches()) {
    108117          AverageAccuracies[niche].Insert(0, new DoubleValue(nicheFitness[niche]));
    109118        }
    110119
    111         var averages = new List<double>(PossibleDefaultClassesParameter.ActualValue.Count);
     120        var averages = new List<double>(GAssistNichesProblemDataParameter.ActualValue.GetPossibleNiches().Count());
    112121        if (AverageAccuracies.Values.First().Count >= AccuraciesCount) {
    113122          foreach (var averageAccuracy in AverageAccuracies.Values) {
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/DefaultRule/DefaultRuleOperator.cs

    r9342 r9352  
    4242      get { return (IValueLookupParameter<IGAssistNiche>)Parameters["DefaultClass"]; }
    4343    }
    44     public ILookupParameter<ItemCollection<IGAssistNiche>> PossibleDefaultClassesParameter {
    45       get { return (ILookupParameter<ItemCollection<IGAssistNiche>>)Parameters["PossibleDefaultClasses"]; }
     44    public ILookupParameter<IGAssistNichesProblemData> GAssistNichesProblemDataParameter {
     45      get { return (ILookupParameter<IGAssistNichesProblemData>)Parameters["GAssistNichesProblemData"]; }
     46    }
     47    public ILookupParameter<ItemArray<IGAssistIndividual>> IndividualParameter {
     48      get { return (ILookupParameter<ItemArray<IGAssistIndividual>>)Parameters["Individual"]; }
     49    }
     50    public IValueLookupParameter<IOperator> EvaluatorParameter {
     51      get { return (IValueLookupParameter<IOperator>)Parameters["Evaluator"]; }
    4652    }
    4753    #endregion
     
    5763      Parameters.Add(new ValueLookupParameter<IntValue>("Niches"));
    5864      Parameters.Add(new ValueLookupParameter<IGAssistNiche>("DefaultClass"));
    59       Parameters.Add(new LookupParameter<ItemCollection<IGAssistNiche>>("PossibleDefaultClasses"));
     65      Parameters.Add(new LookupParameter<IGAssistNichesProblemData>("GAssistNichesProblemData"));
     66      Parameters.Add(new ScopeTreeLookupParameter<IGAssistIndividual>("Individual"));
     67      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator"));
     68    }
     69
     70    protected OperationCollection EvaluateSubScopes() {
     71      IOperator evaluator = EvaluatorParameter.ActualValue;
     72      OperationCollection evaluation = new OperationCollection();
     73      if (evaluator != null) {
     74        foreach (var subScope in ExecutionContext.Scope.SubScopes) {
     75          evaluation.Add(ExecutionContext.CreateOperation(evaluator, subScope));
     76        }
     77      }
     78      return evaluation;
    6079    }
    6180  }
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/DefaultRule/IDefaultRuleOperator.cs

    r9342 r9352  
    2626  public interface IDefaultRuleOperator : IOperator {
    2727    IValueLookupParameter<BoolValue> NichingParameter { get; }
    28     ILookupParameter<IntValue> NichesParameter { get; }
    29     IValueLookupParameter<Item> DefaultClassParameter { get; }
    30     ILookupParameter<ItemCollection<IGAssistNiche>> PossibleDefaultClassesParameter { get; }
     28    IValueLookupParameter<IntValue> NichesParameter { get; }
     29    IValueLookupParameter<IGAssistNiche> DefaultClassParameter { get; }
     30    ILookupParameter<IGAssistNichesProblemData> GAssistNichesProblemDataParameter { get; }
     31    ILookupParameter<ItemArray<IGAssistIndividual>> IndividualParameter { get; }
     32    IValueLookupParameter<IOperator> EvaluatorParameter { get; }
    3133  }
    3234}
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/DefaultRule/MajorDefaultRule.cs

    r9342 r9352  
    7777          index = indices[0];
    7878        }
    79         DefaultClassParameter.ActualValue = PossibleDefaultClassesParameter.ActualValue.ElementAt(index);
     79        IGAssistNiche niche = GAssistNichesProblemDataParameter.ActualValue.GetPossibleNiches().ElementAt(index);
     80        DefaultClassParameter.ActualValue = niche;
     81
     82        foreach (var individual in IndividualParameter.ActualValue) {
     83          individual.SetNiche(RandomParameter.ActualValue, niche);
     84        }
     85
     86        OperationCollection next = new OperationCollection();
     87        next.Add(EvaluateSubScopes());
     88        next.Add(base.Apply());
     89        return next;
    8090      }
    8191      return base.Apply();
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/DefaultRule/MinorDefaultRule.cs

    r9342 r9352  
    7777          index = indices[0];
    7878        }
    79         DefaultClassParameter.ActualValue = PossibleDefaultClassesParameter.ActualValue.ElementAt(index);
     79        IGAssistNiche niche = GAssistNichesProblemDataParameter.ActualValue.GetPossibleNiches().ElementAt(index);
     80        DefaultClassParameter.ActualValue = niche;
     81
     82        foreach (var individual in IndividualParameter.ActualValue) {
     83          individual.SetNiche(RandomParameter.ActualValue, niche);
     84        }
     85
     86        OperationCollection next = new OperationCollection();
     87        next.Add(EvaluateSubScopes());
     88        next.Add(base.Apply());
     89        return next;
    8090      }
    8191      return base.Apply();
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/GAssist/Interfaces/IGAssistIndividual.cs

    r9342 r9352  
    2626  public interface IGAssistIndividual : IItem {
    2727    IGAssistNiche Niche { get; }
     28    void SetNiche(IRandom random, IGAssistNiche niche);
    2829    void ApplySplit(IRandom random, double probability);
    2930    void ApplyMerge(IRandom random, double probability);
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/GAssist/Interfaces/IGAssistNiche.cs

    r9342 r9352  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223using HeuristicLab.Core;
    2324
     
    2526  public interface IGAssistNiche : IItem {
    2627    bool SameNiche(IGAssistNiche niche);
     28    int GetNicheHashCode();
     29    IEqualityComparer<IGAssistNiche> Comparer { get; }
    2730  }
    2831}
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/HeuristicLab.Optimization.Operators.LCS-3.3.csproj

    r9342 r9352  
    4646      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
    4747    </Reference>
    48     <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    49       <SpecificVersion>False</SpecificVersion>
    50       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
    51     </Reference>
    5248    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    5349      <SpecificVersion>False</SpecificVersion>
     
    8480    <Reference Include="System" />
    8581    <Reference Include="System.Core" />
     82    <Reference Include="System.Drawing" />
    8683    <Reference Include="System.Xml.Linq" />
    8784    <Reference Include="System.Data.DataSetExtensions" />
     
    9289  <ItemGroup>
    9390    <Compile Include="DefaultRule\AutoDefaultRule.cs" />
     91    <Compile Include="GAssist\IGAssistNichesProblemData.cs" />
    9492    <Compile Include="DefaultRule\MajorDefaultRule.cs" />
    9593    <Compile Include="DefaultRule\DefaultRuleOperator.cs" />
     
    9997    <Compile Include="Discretizer\UniformWidthDiscretizer.cs" />
    10098    <Compile Include="Discretizer\IDiscretizer.cs" />
     99    <Compile Include="GAssist\IGAssistProblem.cs" />
    101100    <Compile Include="GAssist\Interfaces\IGAssistIndividual.cs" />
    102101    <Compile Include="GAssist\Interfaces\IGAssistIndividualCreator.cs" />
     
    110109    <Compile Include="GAssist\SpecialStage\SplitOperator.cs" />
    111110    <Compile Include="Plugin.cs" />
     111    <Compile Include="Selection\INichingSingleObjectiveSelector.cs" />
    112112    <Compile Include="Selection\NichingTournamentSelector.cs" />
    113113    <Compile Include="Selection\PreservingRightReducer.cs" />
     
    119119    <None Include="Plugin.cs.frame" />
    120120  </ItemGroup>
    121   <ItemGroup />
     121  <ItemGroup>
     122    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
     123      <Project>{c36bd924-a541-4a00-afa8-41701378ddc5}</Project>
     124      <Name>HeuristicLab.Core-3.3</Name>
     125    </ProjectReference>
     126  </ItemGroup>
    122127  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    123128  <PropertyGroup>
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/Properties

    • Property svn:ignore set to
      AssemblyInfo.cs
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/Selection/NichingTournamentSelector.cs

    r9342 r9352  
    3030using HeuristicLab.Selection;
    3131
    32 namespace HeuristicLab.Optimization.Operators.LCS.Selection {
     32namespace HeuristicLab.Optimization.Operators.LCS {
    3333  [Item("NichingTournamentSelector", "Description missing")]
    3434  [StorableClass]
    35   public class NichingTournamentSelector : StochasticSingleObjectiveSelector, ISingleObjectiveSelector {
     35  public class NichingTournamentSelector : StochasticSingleObjectiveSelector, INichingSingleObjectiveSelector {
    3636
    3737    #region Parameter Properties
     
    3939      get { return (ValueLookupParameter<IntValue>)Parameters["GroupSize"]; }
    4040    }
    41     public LookupParameter<IntValue> NichesParameter {
    42       get { return (LookupParameter<IntValue>)Parameters["Niches"]; }
     41    public ILookupParameter<IGAssistNichesProblemData> GAssistNichesProblemDataParameter {
     42      get { return (LookupParameter<IGAssistNichesProblemData>)Parameters["GAssistNichesProblemData"]; }
     43    }
     44    public ILookupParameter<BoolValue> NichingParameter {
     45      get { return (LookupParameter<BoolValue>)Parameters["Niching"]; }
     46    }
     47    public IValueLookupParameter<IntValue> ParentsPerChildParameter {
     48      get { return (IValueLookupParameter<IntValue>)Parameters["ParentsPerChild"]; }
     49    }
     50    public ILookupParameter<ItemArray<IGAssistIndividual>> IndividualParameter {
     51      get { return (ILookupParameter<ItemArray<IGAssistIndividual>>)Parameters["Individual"]; }
    4352    }
    4453    #endregion
     
    5261      : base() {
    5362      Parameters.Add(new ValueLookupParameter<IntValue>("GroupSize", "The size of the tournament group.", new IntValue(2)));
    54       Parameters.Add(new LookupParameter<IntValue>("Niches", ""));
     63      Parameters.Add(new LookupParameter<IGAssistNichesProblemData>("GAssistNichesProblemData", ""));
     64      Parameters.Add(new LookupParameter<BoolValue>("Niching", ""));
     65      Parameters.Add(new ValueLookupParameter<IntValue>("ParentsPerChild", ""));
     66      Parameters.Add(new ScopeTreeLookupParameter<IGAssistIndividual>("Individual", ""));
    5567    }
    5668    public override IDeepCloneable Clone(Cloner cloner) {
     
    6476      bool maximization = MaximizationParameter.ActualValue.Value;
    6577      List<double> qualities = QualityParameter.ActualValue.Where(x => IsValidQuality(x.Value)).Select(x => x.Value).ToList();
     78      List<IGAssistIndividual> individuals = IndividualParameter.ActualValue.ToList();
    6679      int groupSize = GroupSizeParameter.ActualValue.Value;
    6780      IScope[] selected = new IScope[count];
     81      bool doNiching = NichingParameter.ActualValue.Value;
    6882
    6983      //check if list with indexes is as long as the original scope list
    7084      //otherwise invalid quality values were filtered
    71       if (qualities.Count != scopes.Count) {
     85      if (qualities.Count != scopes.Count && individuals.Count != scopes.Count) {
    7286        throw new ArgumentException("The scopes contain invalid quality values (either infinity or double.NaN) on which the selector cannot operate.");
    7387      }
    7488
    75       for (int i = 0; i < count; i++) {
    76         int best = random.Next(scopes.Count);
    77         int index;
    78         for (int j = 1; j < groupSize; j++) {
    79           index = random.Next(scopes.Count);
    80           if (((maximization) && (qualities[index] > qualities[best])) ||
    81               ((!maximization) && (qualities[index] < qualities[best]))) {
    82             best = index;
     89      int parentsPerChild = ParentsPerChildParameter.ActualValue.Value;
     90      var possibleNiches = GAssistNichesProblemDataParameter.ActualValue.GetPossibleNiches().ToList();
     91      var selectPerNiche = new Dictionary<IGAssistNiche, int>(possibleNiches.First().Comparer);
     92
     93      var nicheScope = new Dictionary<IGAssistNiche, List<int>>(possibleNiches.First().Comparer);
     94      foreach (var niche in possibleNiches) {
     95        nicheScope.Add(niche, new List<int>());
     96        selectPerNiche.Add(niche, count / possibleNiches.Count);
     97      }
     98
     99      for (int i = 0; i < individuals.Count; i++) {
     100        nicheScope[individuals[i].Niche].Add(i);
     101      }
     102
     103      int curCount = 0;
     104      while (curCount < count) {
     105        IGAssistNiche niche = null;
     106        int best = -1;
     107        if (doNiching) {
     108          niche = GetNiche(random, selectPerNiche, possibleNiches);
     109        } else {
     110          best = random.Next(scopes.Count);
     111        }
     112        for (int i = 0; i < parentsPerChild; i++) {
     113          int index;
     114          if (doNiching) {
     115            best = nicheScope[niche][random.Next(nicheScope[niche].Count)];
    83116          }
    84         }
     117          for (int j = 1; j < groupSize; j++) {
     118            if (niche != null) {
     119              index = nicheScope[niche][random.Next(nicheScope[niche].Count)];
     120            } else {
     121              index = random.Next(scopes.Count);
     122            }
     123            if (((maximization) && (qualities[index] > qualities[best])) ||
     124                ((!maximization) && (qualities[index] < qualities[best]))) {
     125              best = index;
     126            }
     127          }
    85128
    86         if (copy)
    87           selected[i] = (IScope)scopes[best].Clone();
    88         else {
    89           selected[i] = scopes[best];
    90           scopes.RemoveAt(best);
    91           qualities.RemoveAt(best);
     129          niche = individuals[best].Niche;
     130
     131          if (copy)
     132            selected[curCount] = (IScope)scopes[best].Clone();
     133          else {
     134            selected[curCount] = scopes[best];
     135            scopes.RemoveAt(best);
     136            qualities.RemoveAt(best);
     137          }
     138          selectPerNiche[niche]--;
     139          curCount++;
    92140        }
    93141      }
     142
    94143      return selected;
     144    }
     145
     146    private IGAssistNiche GetNiche(IRandom random, Dictionary<IGAssistNiche, int> nicheScope, List<IGAssistNiche> possibleNiches) {
     147      int sum = nicheScope.Values.Sum();
     148      if (sum <= 0) { return possibleNiches[random.Next(possibleNiches.Count)]; }
     149      int pos = random.Next(sum);
     150      int total = 0;
     151      IGAssistNiche niche = nicheScope.Keys.First();
     152      foreach (var item in nicheScope) {
     153        total += item.Value;
     154        niche = item.Key;
     155        if (pos < total) {
     156          return niche;
     157        }
     158      }
     159      throw new ArgumentException("error in code");
    95160    }
    96161  }
  • branches/LearningClassifierSystems/HeuristicLab.Problems.CombinedIntegerVectorClassification/3.3/CombinedIntegerVectorClassificationProblemData.cs

    r9242 r9352  
    4545      get { return (IFixedValueParameter<IntValue>)Parameters["ActionLength"]; }
    4646    }
    47     public IFixedValueParameter<IntMatrix> BoundsParameter {
    48       get { return (IFixedValueParameter<IntMatrix>)Parameters["Bounds"]; }
     47    public IValueParameter<IntMatrix> BoundsParameter {
     48      get { return (IValueParameter<IntMatrix>)Parameters["Bounds"]; }
    4949    }
    5050    #endregion
     
    7777      Parameters.Add(new FixedValueParameter<IntValue>("Length", "", new IntValue(allowedConditionVariables.Count() + allowedActionVariables.Count())));
    7878      Parameters.Add(new FixedValueParameter<IntValue>("ActionLength", "", new IntValue(allowedActionVariables.Count())));
    79       Parameters.Add(new FixedValueParameter<IntMatrix>("Bounds", "", GetBoundsMatrix(dataset, allowedConditionVariables, allowedActionVariables)));
     79      Parameters.Add(new ValueParameter<IntMatrix>("Bounds", "", GetBoundsMatrix(dataset, allowedConditionVariables, allowedActionVariables)));
    8080    }
    8181
     
    126126      return (FetchInput(rowNumber) as IClassifier).Action;
    127127    }
     128
     129    protected override void ActionConditionVariablesChanged() {
     130      ActionLength.Value = AllowedActionVariables.Count();
     131      Length.Value = AllowedConditionVariables.Count() + ActionLength.Value;
     132      BoundsParameter.Value = GetBoundsMatrix(Dataset, AllowedConditionVariables, AllowedActionVariables);
     133    }
    128134  }
    129135}
  • branches/LearningClassifierSystems/HeuristicLab.Problems.CombinedIntegerVectorClassification/3.3/HeuristicLab.Problems.CombinedIntegerVectorClassification-3.3.csproj

    r9334 r9352  
    125125  </ItemGroup>
    126126  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
     127  <PropertyGroup>
     128    <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     129set ProjectDir=$(ProjectDir)
     130set SolutionDir=$(SolutionDir)
     131set Outdir=$(Outdir)
     132
     133call PreBuildEvent.cmd
     134</PreBuildEvent>
     135  </PropertyGroup>
    127136  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
    128137       Other similar extension points exist, see Microsoft.Common.targets.
  • branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/ConditionActionClassificationProblemData.cs

    r9226 r9352  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Collections;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    109110    #endregion
    110111
     112    [StorableHook(HookType.AfterDeserialization)]
     113    private void AfterDeserialization() {
     114      RegisterParameterEvents();
     115    }
    111116    [StorableConstructor]
    112117    protected ConditionActionClassificationProblemData(bool deserializing) : base(deserializing) { }
    113118    protected ConditionActionClassificationProblemData(ConditionActionClassificationProblemData original, Cloner cloner)
    114119      : base(original, cloner) {
     120      RegisterParameterEvents();
    115121    }
    116122
     
    144150
    145151      ((ValueParameter<Dataset>)DatasetParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false;
     152
     153      RegisterParameterEvents();
    146154    }
    147155
     
    167175
    168176    protected IDictionary<int, IInput> fetchInputCache = new Dictionary<int, IInput>();
     177
     178    #region events
     179    private void RegisterParameterEvents() {
     180      ConditionVariablesParameter.ValueChanged += new EventHandler(VariablesChanged);
     181      ConditionVariablesParameter.Value.CheckedItemsChanged += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(VariablesChanged);
     182      ActionVariablesParameter.ValueChanged += new EventHandler(VariablesChanged);
     183      ActionVariablesParameter.Value.CheckedItemsChanged += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(VariablesChanged);
     184    }
     185    private void DeregisterParameterEvents() {
     186      ActionVariablesParameter.Value.CheckedItemsChanged += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(VariablesChanged);
     187      ActionVariablesParameter.ValueChanged += new EventHandler(VariablesChanged);
     188      ConditionVariablesParameter.Value.CheckedItemsChanged += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(VariablesChanged);
     189      ConditionVariablesParameter.ValueChanged += new EventHandler(VariablesChanged);
     190    }
     191    private void Value_CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<StringValue>> e) {
     192      ActionConditionVariablesChanged();
     193    }
     194    private void VariablesChanged(object sender, EventArgs e) {
     195      ActionConditionVariablesChanged();
     196    }
     197
     198    protected abstract void ActionConditionVariablesChanged();
     199    #endregion
    169200  }
    170201}
  • branches/LearningClassifierSystems/HeuristicLab.Problems.DecisionListClassification/3.3

    • Property svn:ignore
      •  

        old new  
        11Plugin.cs
         2obj
  • branches/LearningClassifierSystems/HeuristicLab.Problems.DecisionListClassification/3.3/DecisionListClassificationProblem.cs

    r9342 r9352  
    2727using HeuristicLab.Encodings.DecisionList.Interfaces;
    2828using HeuristicLab.Optimization;
     29using HeuristicLab.Optimization.Operators.LCS;
     30using HeuristicLab.Optimization.Operators.LCS.DefaultRule;
    2931using HeuristicLab.Parameters;
    3032using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3133using HeuristicLab.PluginInfrastructure;
    3234using HeuristicLab.Problems.DataAnalysis;
     35using HeuristicLab.Problems.Instances;
    3336
    3437namespace HeuristicLab.Problems.DecisionListClassification {
     
    3639  [StorableClass]
    3740  [Creatable("Problems")]
    38   public class DecisionListClassificationProblem : HeuristicOptimizationProblem<IDecisionListEvaluator, IDecisionListCreator>, IDecisionListClassificationProblem {
     41  public class DecisionListClassificationProblem : HeuristicOptimizationProblem<IDecisionListEvaluator, IDecisionListCreator>,
     42                                                   IDecisionListClassificationProblem, IGAssistProblem,
     43                                                   IProblemInstanceConsumer<DecisionListClassificationProblemData> {
    3944
    4045    #region parameter properties
     
    105110      : base(decisionlistEvaluator, decisionListCreator) {
    106111      Parameters.Add(new ValueParameter<IDecisionListClassificationProblemData>("ProblemData", "", problemData));
    107       Parameters.Add(new FixedValueParameter<BoolValue>("Maximization", "", new BoolValue(true)));
     112      Parameters.Add(new FixedValueParameter<BoolValue>("Maximization", "", new BoolValue(false)));
    108113      Parameters.Add(new FixedValueParameter<DoubleValue>("BestKnownQuality", "", new DoubleValue(0.5)));
    109114      Parameters.Add(new FixedValueParameter<IntValue>("SizePenaltyMinRules", "", new IntValue(4)));
     
    116121      // do differently
    117122      ((MDLEvaluator)Evaluator).MDLCalculatorParameter.Value = new MDLCalculator(ActivationIterationParameter.Value.Value, InitialTheoryLengthRatioParameter.Value.Value, WeightRelaxFactorParameter.Value.Value);
    118       // do differently
    119       decisionListCreator.DefaultActionParameter.Value = problemData.FetchAction(0);
    120123
    121124      InitializeOperators();
     
    123126
    124127    private void InitializeOperators() {
     128      foreach (var op in ApplicationManager.Manager.GetInstances<IDefaultRuleOperator>())
     129        Operators.Add(op);
    125130      foreach (var op in ApplicationManager.Manager.GetInstances<IDecisionListCrossover>())
    126131        Operators.Add(op);
     
    129134
    130135      ParameterizeOperators();
     136
     137      BestTrainingDecisionListAnalyzer analyzer = new BestTrainingDecisionListAnalyzer();
     138      analyzer.ProblemDataParameter.ActualName = ProblemDataParameter.Name;
     139      analyzer.IndividualParameter.ActualName = SolutionCreator.DecisionListParameter.ActualName;
     140      analyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
     141      analyzer.ResultsParameter.ActualName = "Results";
     142      analyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;
     143      Operators.Add(analyzer);
    131144    }
    132145
    133146    private void ParameterizeOperators() {
     147      var autoDefaultRule = Operators.Where(x => x is AutoDefaultRule).Select(x => x as AutoDefaultRule).First();
     148      autoDefaultRule.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
     149      autoDefaultRule.GAssistNichesProblemDataParameter.ActualName = ProblemDataParameter.Name;
     150      autoDefaultRule.NicheComparerParameter.Value = new DecisionListNicheComparer();
     151      foreach (IDefaultRuleOperator op in Operators.OfType<IDefaultRuleOperator>()) {
     152        op.IndividualParameter.ActualName = SolutionCreator.DecisionListParameter.ActualName;
     153        op.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
     154        op.GAssistNichesProblemDataParameter.ActualName = ProblemDataParameter.Name;
     155        op.GAssistNichesProblemDataParameter.Hidden = true;
     156        op.NichingParameter.ActualName = "Niching";
     157      }
    134158      foreach (IDecisionListCrossover op in Operators.OfType<IDecisionListCrossover>()) {
    135159        op.ParentsParameter.ActualName = SolutionCreator.DecisionListParameter.ActualName;
     
    148172      return new DecisionListClassificationProblem(this, cloner);
    149173    }
     174
     175    IParameter IGAssistProblem.ProblemDataParameter {
     176      get { return ProblemDataParameter; }
     177    }
     178
     179    public string NichingParameterName {
     180      get { return "Niching"; }
     181    }
     182
     183    public void Load(DecisionListClassificationProblemData data) {
     184      Name = data.Name;
     185      Description = data.Description;
     186      ProblemData = data;
     187    }
    150188  }
    151189}
  • branches/LearningClassifierSystems/HeuristicLab.Problems.DecisionListClassification/3.3/DecisionListClassificationProblemData.cs

    r9334 r9352  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Collections;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Data;
    2829using HeuristicLab.Encodings.DecisionList;
     30using HeuristicLab.Optimization.Operators.LCS;
    2931using HeuristicLab.Parameters;
    3032using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    6264      get { return (IFixedValueParameter<IntRange>)Parameters["TestPartition"]; }
    6365    }
    64     public IFixedValueParameter<Rule> SampleRuleParameter {
    65       get { return (IFixedValueParameter<Rule>)Parameters["SampleRule"]; }
     66    public IValueParameter<Rule> SampleRuleParameter {
     67      get { return (IValueParameter<Rule>)Parameters["SampleRule"]; }
    6668    }
    6769    public IFixedValueParameter<IntValue> MaxIntervalsParameter {
     
    118120    #endregion
    119121
     122    [StorableHook(HookType.AfterDeserialization)]
     123    private void AfterDeserialization() {
     124      RegisterParameterEvents();
     125    }
    120126    [StorableConstructor]
    121127    protected DecisionListClassificationProblemData(bool deserializing) : base(deserializing) { }
    122128    protected DecisionListClassificationProblemData(DecisionListClassificationProblemData original, Cloner cloner)
    123129      : base(original, cloner) {
     130      RegisterParameterEvents();
    124131    }
    125132    public DecisionListClassificationProblemData(Dataset dataset, IEnumerable<string> allowedConditionVariables, string targetVariable) {
     
    150157      Parameters.Add(new FixedValueParameter<IntRange>("TestPartition", "", new IntRange(testPartitionStart, testPartitionEnd)));
    151158      Parameters.Add(new FixedValueParameter<IntValue>("MaxIntervals", "", new IntValue(5)));
    152       Parameters.Add(new FixedValueParameter<Rule>("SampleRule", "", CreateSampleRule(dataset, conditionVariables.CheckedItems.Select(x => x.Value.Value), target.Value)));
     159      Parameters.Add(new ValueParameter<Rule>("SampleRule", "", CreateSampleRule(dataset, conditionVariables.CheckedItems.Select(x => x.Value.Value), target.Value)));
    153160
    154161      ((ValueParameter<Dataset>)DatasetParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false;
     162
     163      RegisterParameterEvents();
    155164    }
    156165    public override IDeepCloneable Clone(Cloner cloner) {
     
    240249    }
    241250
     251    protected IList<IGAssistNiche> possibleNiches;
     252    public IEnumerable<IGAssistNiche> GetPossibleNiches() {
     253      if (possibleNiches == null) {
     254        possibleNiches = new List<IGAssistNiche>();
     255        for (int i = 0; i < Dataset.Rows; i++) {
     256          var action = FetchAction(i);
     257          if (!possibleNiches.Any(x => x.SameNiche(action))) {
     258            possibleNiches.Add(action);
     259          }
     260        }
     261      }
     262      return possibleNiches;
     263    }
     264
    242265    public event EventHandler Changed;
     266
     267    #region events
     268    private void RegisterParameterEvents() {
     269      ConditionVariablesParameter.ValueChanged += new EventHandler(VariablesChanged);
     270      ConditionVariablesParameter.Value.CheckedItemsChanged += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(VariablesChanged);
     271      TargetVariableParameter.ValueChanged += new EventHandler(VariablesChanged);
     272    }
     273    private void DeregisterParameterEvents() {
     274      TargetVariableParameter.ValueChanged += new EventHandler(VariablesChanged);
     275      ConditionVariablesParameter.Value.CheckedItemsChanged += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(VariablesChanged);
     276      ConditionVariablesParameter.ValueChanged += new EventHandler(VariablesChanged);
     277    }
     278    private void Value_CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<StringValue>> e) {
     279      VariablesChanged();
     280    }
     281    private void VariablesChanged(object sender, EventArgs e) {
     282      VariablesChanged();
     283    }
     284
     285    private void VariablesChanged() {
     286      SampleRuleParameter.Value = CreateSampleRule(Dataset, AllowedConditionVariables, TargetVariable.Value);
     287    }
     288    #endregion
    243289  }
    244290}
  • branches/LearningClassifierSystems/HeuristicLab.Problems.DecisionListClassification/3.3/HeuristicLab.Problems.DecisionListClassification-3.3.csproj

    r9342 r9352  
    109109      <Private>False</Private>
    110110    </ProjectReference>
     111    <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators.LCS\3.3\HeuristicLab.Optimization.Operators.LCS-3.3.csproj">
     112      <Project>{f2c6d3b0-bd4f-4747-b13e-b18e53a2a09d}</Project>
     113      <Name>HeuristicLab.Optimization.Operators.LCS-3.3</Name>
     114    </ProjectReference>
    111115    <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis\3.4\HeuristicLab.Problems.DataAnalysis-3.4.csproj">
    112116      <Project>{DF87C13E-A889-46FF-8153-66DCAA8C5674}</Project>
  • branches/LearningClassifierSystems/HeuristicLab.Problems.Instances.LCS/3.3/CombinedIntegerVectorCVSInstanceProvider.cs

    r9228 r9352  
    2626using HeuristicLab.Problems.Instances.DataAnalysis;
    2727
    28 namespace HeuristicLab.Problems.Instances.ConditionActionClassification {
     28namespace HeuristicLab.Problems.Instances.LCS {
    2929  public class CombinedIntegerVectorCVSInstanceProvider : ConditionActionInstanceProvider<CombinedIntegerVectorClassificationProblemData> {
    3030    public override CombinedIntegerVectorClassificationProblemData ImportData(string path) {
  • branches/LearningClassifierSystems/HeuristicLab.Problems.Instances.LCS/3.3/ConditionActionInstanceProvider.cs

    r9228 r9352  
    2424using HeuristicLab.Encodings.ConditionActionEncoding;
    2525
    26 namespace HeuristicLab.Problems.Instances.ConditionActionClassification {
     26namespace HeuristicLab.Problems.Instances.LCS {
    2727  public abstract class ConditionActionInstanceProvider<T> : ProblemInstanceProvider<T>
    2828  where T : class, IConditionActionProblemData {
  • branches/LearningClassifierSystems/HeuristicLab.Problems.Instances.LCS/3.3/HeuristicLab.Problems.Instances.LCS-3.3.csproj

    r9345 r9352  
    99    <OutputType>Library</OutputType>
    1010    <AppDesignerFolder>Properties</AppDesignerFolder>
    11     <RootNamespace>HeuristicLab.Problems.Instances.ConditionActionClassification</RootNamespace>
    12     <AssemblyName>HeuristicLab.Problems.Instances.ConditionActionClassification-3.3</AssemblyName>
     11    <RootNamespace>HeuristicLab.Problems.Instances.LCS</RootNamespace>
     12    <AssemblyName>HeuristicLab.Problems.Instances.LCS-3.3</AssemblyName>
    1313    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    1414    <FileAlignment>512</FileAlignment>
     
    6868    <Compile Include="CombinedIntegerVectorCVSInstanceProvider.cs" />
    6969    <Compile Include="ConditionActionInstanceProvider.cs" />
     70    <Compile Include="DecisionListInstanceProvider.cs" />
    7071    <Compile Include="VariableVectorCVSInstanceProvider.cs" />
    7172    <Compile Include="Plugin.cs" />
     
    8889      <Private>False</Private>
    8990    </ProjectReference>
     91    <ProjectReference Include="..\..\HeuristicLab.Encodings.DecisionList\3.3\HeuristicLab.Encodings.DecisionList-3.3.csproj">
     92      <Project>{86912e6b-4ef3-4b37-809b-5a7c4a28d0c9}</Project>
     93      <Name>HeuristicLab.Encodings.DecisionList-3.3</Name>
     94    </ProjectReference>
    9095    <ProjectReference Include="..\..\HeuristicLab.Encodings.VariableVector\3.3\HeuristicLab.Encodings.VariableVector-3.3.csproj">
    9196      <Project>{7C116F48-7218-4105-BD6E-EE868E2D4823}</Project>
    9297      <Name>HeuristicLab.Encodings.VariableVector-3.3</Name>
     98    </ProjectReference>
     99    <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators.LCS\3.3\HeuristicLab.Optimization.Operators.LCS-3.3.csproj">
     100      <Project>{f2c6d3b0-bd4f-4747-b13e-b18e53a2a09d}</Project>
     101      <Name>HeuristicLab.Optimization.Operators.LCS-3.3</Name>
    93102    </ProjectReference>
    94103    <ProjectReference Include="..\..\HeuristicLab.Problems.CombinedIntegerVectorClassification\3.3\HeuristicLab.Problems.CombinedIntegerVectorClassification-3.3.csproj">
     
    106115      <Name>HeuristicLab.Problems.DataAnalysis-3.4</Name>
    107116      <Private>False</Private>
     117    </ProjectReference>
     118    <ProjectReference Include="..\..\HeuristicLab.Problems.DecisionListClassification\3.3\HeuristicLab.Problems.DecisionListClassification-3.3.csproj">
     119      <Project>{ca20ac55-b57d-4078-8cb9-c44e5ff7958b}</Project>
     120      <Name>HeuristicLab.Problems.DecisionListClassification-3.3</Name>
    108121    </ProjectReference>
    109122    <ProjectReference Include="..\..\HeuristicLab.Problems.VariableVectorClassification\3.3\HeuristicLab.Problems.VariableVectorClassification-3.3.csproj">
  • branches/LearningClassifierSystems/HeuristicLab.Problems.Instances.LCS/3.3/Plugin.cs.frame

    r9160 r9352  
    2222using HeuristicLab.PluginInfrastructure;
    2323
    24 namespace HeuristicLab.Problems.ConditionActionClassification {
    25   [Plugin("HeuristicLab.Problems.Instances.ConditionActionClassification", "3.3.7.$WCREV$")]
    26   [PluginFile("HeuristicLab.Problems.Instances.ConditionActionClassification-3.3.dll", PluginFileType.Assembly)]
     24namespace HeuristicLab.Problems.Instances.LCS {
     25  [Plugin("HeuristicLab.Problems.Instances.LCS", "3.3.7.$WCREV$")]
     26  [PluginFile("HeuristicLab.Problems.Instances.LCS-3.3.dll", PluginFileType.Assembly)]
    2727  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
    28   public class HeuristicLabProblemsInstancesConditionActionClassificationPlugin : PluginBase {
     28  public class HeuristicLabProblemsInstancesLCSPlugin : PluginBase {
    2929  }
    3030}
  • branches/LearningClassifierSystems/HeuristicLab.Problems.Instances.LCS/3.3/Properties/AssemblyInfo.cs.frame

    r9160 r9352  
    2626// set of attributes. Change these attribute values to modify the information
    2727// associated with an assembly.
    28 [assembly: AssemblyTitle("HeuristicLab.Problems.Instances.ConditionActionClassification-3.3")]
     28[assembly: AssemblyTitle("HeuristicLab.Problems.Instances.LCS-3.3")]
    2929[assembly: AssemblyDescription("")]
    3030[assembly: AssemblyConfiguration("")]
  • branches/LearningClassifierSystems/HeuristicLab.Problems.Instances.LCS/3.3/VariableVectorCVSInstanceProvider.cs

    r9242 r9352  
    2626using HeuristicLab.Problems.VariableVectorClassification;
    2727
    28 namespace HeuristicLab.Problems.Instances.ConditionActionClassification {
     28namespace HeuristicLab.Problems.Instances.LCS {
    2929  public class VariableVectorCVSInstanceProvider : ConditionActionInstanceProvider<VariableVectorClassificationProblemData> {
    3030    public override VariableVectorClassificationProblemData ImportData(string path) {
  • branches/LearningClassifierSystems/HeuristicLab.Problems.LCS.Views/3.3/HeuristicLab.Problems.LCS.Views-3.3.csproj

    r9345 r9352  
    99    <OutputType>Library</OutputType>
    1010    <AppDesignerFolder>Properties</AppDesignerFolder>
    11     <RootNamespace>HeuristicLab.Problems.XCS.Views</RootNamespace>
    12     <AssemblyName>HeuristicLab.Problems.XCS.Views-3.3</AssemblyName>
     11    <RootNamespace>HeuristicLab.Problems.LCS.Views</RootNamespace>
     12    <AssemblyName>HeuristicLab.Problems.LCS.Views-3.3</AssemblyName>
    1313    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    1414    <FileAlignment>512</FileAlignment>
     
    7373  </ItemGroup>
    7474  <ItemGroup>
     75    <Compile Include="DecisionListView.cs">
     76      <SubType>UserControl</SubType>
     77    </Compile>
     78    <Compile Include="DecisionListView.Designer.cs">
     79      <DependentUpon>DecisionListView.cs</DependentUpon>
     80    </Compile>
    7581    <Compile Include="XCSModelView.cs">
    7682      <SubType>UserControl</SubType>
     
    98104      <Private>False</Private>
    99105    </ProjectReference>
     106    <ProjectReference Include="..\..\HeuristicLab.Encodings.DecisionList\3.3\HeuristicLab.Encodings.DecisionList-3.3.csproj">
     107      <Project>{86912e6b-4ef3-4b37-809b-5a7c4a28d0c9}</Project>
     108      <Name>HeuristicLab.Encodings.DecisionList-3.3</Name>
     109    </ProjectReference>
     110    <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators.LCS\3.3\HeuristicLab.Optimization.Operators.LCS-3.3.csproj">
     111      <Project>{f2c6d3b0-bd4f-4747-b13e-b18e53a2a09d}</Project>
     112      <Name>HeuristicLab.Optimization.Operators.LCS-3.3</Name>
     113    </ProjectReference>
    100114  </ItemGroup>
    101115  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/LearningClassifierSystems/HeuristicLab.Problems.LCS.Views/3.3/Plugin.cs.frame

    r9154 r9352  
    2222using HeuristicLab.PluginInfrastructure;
    2323
    24 namespace HeuristicLab.Problems.ConditionActionClassification {
    25   [Plugin("HeuristicLab.Problems.XCS.Views", "3.3.7.$WCREV$")]
    26   [PluginFile("HeuristicLab.Problems.XCS.Views-3.3.dll", PluginFileType.Assembly)]
     24namespace HeuristicLab.Problems.LCS.Views {
     25  [Plugin("HeuristicLab.Problems.LCS.Views", "3.3.7.$WCREV$")]
     26  [PluginFile("HeuristicLab.Problems.LCS.Views-3.3.dll", PluginFileType.Assembly)]
    2727  [PluginDependency("HeuristicLab.Collections", "3.3")]
    2828  [PluginDependency("HeuristicLab.Common", "3.3")]
     
    3333  [PluginDependency("HeuristicLab.MainForm", "3.3")]
    3434  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
    35   public class HeuristicLabProblemsXCSViewsPlugin : PluginBase {
     35  public class HeuristicLabProblemsLCSViewsPlugin : PluginBase {
    3636  }
    3737}
  • branches/LearningClassifierSystems/HeuristicLab.Problems.LCS.Views/3.3/Properties/AssemblyInfo.cs.frame

    r9154 r9352  
    2626// set of attributes. Change these attribute values to modify the information
    2727// associated with an assembly.
    28 [assembly: AssemblyTitle("HeuristicLab.Problems.XCS.Views-3.3")]
    29 [assembly: AssemblyDescription("Views for XCS problems")]
     28[assembly: AssemblyTitle("HeuristicLab.Problems.LCS.Views-3.3")]
     29[assembly: AssemblyDescription("Views for LCS problems")]
    3030[assembly: AssemblyConfiguration("")]
    3131[assembly: AssemblyCompany("HEAL")]
  • branches/LearningClassifierSystems/HeuristicLab.Problems.LCS.Views/3.3/XCSModelView.Designer.cs

    r9154 r9352  
    1 namespace HeuristicLab.Problems.XCS.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22namespace HeuristicLab.Problems.LCS.Views {
    223  partial class XCSModelView {
    324    /// <summary>
  • branches/LearningClassifierSystems/HeuristicLab.Problems.LCS.Views/3.3/XCSModelView.cs

    r9160 r9352  
    2626using HeuristicLab.MainForm.WindowsForms;
    2727
    28 namespace HeuristicLab.Problems.XCS.Views {
     28namespace HeuristicLab.Problems.LCS.Views {
    2929  [View("XCS Model")]
    3030  [Content(typeof(XCSModel), true)]
  • branches/LearningClassifierSystems/HeuristicLab.Problems.VariableVectorClassification/3.3/Plugin.cs.frame

    r9226 r9352  
    2323
    2424namespace HeuristicLab.Problems.VariableVectorClassification {
    25   [Plugin("HeuristicLab.Problems.ConditionActionClassification", "3.3.7.$WCREV$")]
     25  [Plugin("HeuristicLab.Problems.VariableVectorClassification", "3.3.7.$WCREV$")]
    2626  [PluginFile("HeuristicLab.Problems.VariableVectorClassification-3.3.dll", PluginFileType.Assembly)]
    2727  [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
  • branches/LearningClassifierSystems/HeuristicLab.Problems.VariableVectorClassification/3.3/VariableVectorClassificationProblemData.cs

    r9242 r9352  
    3939
    4040    #region parameter properites
    41     public IFixedValueParameter<VariableVector> SampleVariableVectorParameter {
    42       get { return (IFixedValueParameter<VariableVector>)Parameters["SampleVariableVector"]; }
     41    public IValueParameter<VariableVector> SampleVariableVectorParameter {
     42      get { return (IValueParameter<VariableVector>)Parameters["SampleVariableVector"]; }
    4343    }
    4444    public IFixedValueParameter<PercentValue> SpreadPercentageParameter {
     
    6767    public VariableVectorClassificationProblemData(Dataset dataset, IEnumerable<string> allowedConditionVariables, IEnumerable<string> allowedActionVariables) :
    6868      base(dataset, allowedConditionVariables, allowedActionVariables) {
    69       Parameters.Add(new FixedValueParameter<VariableVector>("SampleVariableVector", "", GenerateSampleVariableVector(dataset, allowedConditionVariables, allowedActionVariables)));
     69      Parameters.Add(new ValueParameter<VariableVector>("SampleVariableVector", "", GenerateSampleVariableVector(dataset, allowedConditionVariables, allowedActionVariables)));
    7070      Parameters.Add(new FixedValueParameter<PercentValue>("SpreadPercentage", "", new PercentValue(0.5)));
    7171    }
     
    126126      return fetchActionCache[rowNumber];
    127127    }
     128
     129    protected override void ActionConditionVariablesChanged() {
     130      SampleVariableVectorParameter.Value = GenerateSampleVariableVector(Dataset, AllowedConditionVariables, AllowedActionVariables);
     131    }
    128132  }
    129133}
  • branches/LearningClassifierSystems/LearningClassifierSystem.sln

    r9342 r9352  
    1515EndProject
    1616Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.ConditionActionClassification-3.3", "HeuristicLab.Problems.ConditionActionClassification\3.3\HeuristicLab.Problems.ConditionActionClassification-3.3.csproj", "{EA51D441-F6A3-41E1-9993-A2488E93C222}"
    17 EndProject
    18 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.XCS.Views-3.3", "HeuristicLab.Problems.XCS.Views\3.3\HeuristicLab.Problems.XCS.Views-3.3.csproj", "{8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}"
    19 EndProject
    20 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.Instances.ConditionActionClassification-3.3", "HeuristicLab.Problems.Instances.ConditionActionClassification\3.3\HeuristicLab.Problems.Instances.ConditionActionClassification-3.3.csproj", "{1CC7585E-DD22-41FA-869B-93DE41EA8936}"
    2117EndProject
    2218Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Core-3.3", "HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj", "{C36BD924-A541-4A00-AFA8-41701378DDC5}"
     
    3733EndProject
    3834Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Optimization.Operators.LCS-3.3", "HeuristicLab.Optimization.Operators.LCS\3.3\HeuristicLab.Optimization.Operators.LCS-3.3.csproj", "{F2C6D3B0-BD4F-4747-B13E-B18E53A2A09D}"
     35EndProject
     36Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.LCS.Views-3.3", "HeuristicLab.Problems.LCS.Views\3.3\HeuristicLab.Problems.LCS.Views-3.3.csproj", "{8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}"
     37EndProject
     38Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.Instances.LCS-3.3", "HeuristicLab.Problems.Instances.LCS\3.3\HeuristicLab.Problems.Instances.LCS-3.3.csproj", "{1CC7585E-DD22-41FA-869B-93DE41EA8936}"
    3939EndProject
    4040Global
     
    8484    {EA51D441-F6A3-41E1-9993-A2488E93C222}.Release|x64.ActiveCfg = Release|Any CPU
    8585    {EA51D441-F6A3-41E1-9993-A2488E93C222}.Release|x86.ActiveCfg = Release|Any CPU
    86     {8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    87     {8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
    88     {8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}.Debug|x64.ActiveCfg = Debug|Any CPU
    89     {8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}.Debug|x86.ActiveCfg = Debug|Any CPU
    90     {8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
    91     {8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}.Release|Any CPU.Build.0 = Release|Any CPU
    92     {8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}.Release|x64.ActiveCfg = Release|Any CPU
    93     {8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}.Release|x86.ActiveCfg = Release|Any CPU
    94     {1CC7585E-DD22-41FA-869B-93DE41EA8936}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    95     {1CC7585E-DD22-41FA-869B-93DE41EA8936}.Debug|Any CPU.Build.0 = Debug|Any CPU
    96     {1CC7585E-DD22-41FA-869B-93DE41EA8936}.Debug|x64.ActiveCfg = Debug|Any CPU
    97     {1CC7585E-DD22-41FA-869B-93DE41EA8936}.Debug|x86.ActiveCfg = Debug|Any CPU
    98     {1CC7585E-DD22-41FA-869B-93DE41EA8936}.Release|Any CPU.ActiveCfg = Release|Any CPU
    99     {1CC7585E-DD22-41FA-869B-93DE41EA8936}.Release|Any CPU.Build.0 = Release|Any CPU
    100     {1CC7585E-DD22-41FA-869B-93DE41EA8936}.Release|x64.ActiveCfg = Release|Any CPU
    101     {1CC7585E-DD22-41FA-869B-93DE41EA8936}.Release|x86.ActiveCfg = Release|Any CPU
    10286    {C36BD924-A541-4A00-AFA8-41701378DDC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    10387    {C36BD924-A541-4A00-AFA8-41701378DDC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
     
    180164    {F2C6D3B0-BD4F-4747-B13E-B18E53A2A09D}.Release|x64.ActiveCfg = Release|Any CPU
    181165    {F2C6D3B0-BD4F-4747-B13E-B18E53A2A09D}.Release|x86.ActiveCfg = Release|Any CPU
     166    {8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     167    {8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
     168    {8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}.Debug|x64.ActiveCfg = Debug|Any CPU
     169    {8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}.Debug|x86.ActiveCfg = Debug|Any CPU
     170    {8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
     171    {8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}.Release|Any CPU.Build.0 = Release|Any CPU
     172    {8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}.Release|x64.ActiveCfg = Release|Any CPU
     173    {8FFB8E0F-BC17-4D72-AF0F-E67A22F8EDE5}.Release|x86.ActiveCfg = Release|Any CPU
     174    {1CC7585E-DD22-41FA-869B-93DE41EA8936}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     175    {1CC7585E-DD22-41FA-869B-93DE41EA8936}.Debug|Any CPU.Build.0 = Debug|Any CPU
     176    {1CC7585E-DD22-41FA-869B-93DE41EA8936}.Debug|x64.ActiveCfg = Debug|Any CPU
     177    {1CC7585E-DD22-41FA-869B-93DE41EA8936}.Debug|x86.ActiveCfg = Debug|Any CPU
     178    {1CC7585E-DD22-41FA-869B-93DE41EA8936}.Release|Any CPU.ActiveCfg = Release|Any CPU
     179    {1CC7585E-DD22-41FA-869B-93DE41EA8936}.Release|Any CPU.Build.0 = Release|Any CPU
     180    {1CC7585E-DD22-41FA-869B-93DE41EA8936}.Release|x64.ActiveCfg = Release|Any CPU
     181    {1CC7585E-DD22-41FA-869B-93DE41EA8936}.Release|x86.ActiveCfg = Release|Any CPU
    182182  EndGlobalSection
    183183  GlobalSection(SolutionProperties) = preSolution
Note: See TracChangeset for help on using the changeset viewer.