Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/20/09 17:38:19 (15 years ago)
Author:
gkronber
Message:

Worked on different dispatching of deterministic and non-deterministic modeling algorithms. #635

Location:
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/AlgorithmBase.cs

    r1857 r1873  
    136136      IOperator initialization = CreateInitialization();
    137137      IOperator funLibInjector = CreateFunctionLibraryInjector();
     138      IOperator treeEvaluatorInjector = new HL2TreeEvaluatorInjector();
     139
    138140      IOperator mainLoop = CreateMainLoop();
    139141      mainLoop.Name = "Main loop";
     
    157159      seq.AddSubOperator(globalInjector);
    158160      seq.AddSubOperator(funLibInjector);
     161      seq.AddSubOperator(treeEvaluatorInjector);
    159162      seq.AddSubOperator(initialization);
    160163      seq.AddSubOperator(mainLoop);
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/ConfigurableFunctionLibraryInjector.cs

    r1540 r1873  
    2828using HeuristicLab.DataAnalysis;
    2929using HeuristicLab.Constraints;
    30 using StructId = HeuristicLab.GP.StructureIdentification;
    3130
    3231namespace HeuristicLab.GP.StructureIdentification {
     
    6665      AddVariableInfo(new Core.VariableInfo(VARIABLES_ALLOWED, VARIABLES_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    6766      GetVariableInfo(VARIABLES_ALLOWED).Local = true;
    68       AddVariable(new Core.Variable(VARIABLES_ALLOWED,  new BoolData(true)));
     67      AddVariable(new Core.Variable(VARIABLES_ALLOWED, new BoolData(true)));
    6968
    7069      AddVariableInfo(new Core.VariableInfo(CONSTANTS_ALLOWED, CONSTANTS_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    7170      GetVariableInfo(CONSTANTS_ALLOWED).Local = true;
    72       AddVariable(new Core.Variable(CONSTANTS_ALLOWED,  new BoolData(true)));
     71      AddVariable(new Core.Variable(CONSTANTS_ALLOWED, new BoolData(true)));
    7372
    7473      AddVariableInfo(new Core.VariableInfo(ADDITION_ALLOWED, ADDITION_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    7574      GetVariableInfo(ADDITION_ALLOWED).Local = true;
    76       AddVariable(new Core.Variable(ADDITION_ALLOWED,  new BoolData(true)));
     75      AddVariable(new Core.Variable(ADDITION_ALLOWED, new BoolData(true)));
    7776
    7877      AddVariableInfo(new Core.VariableInfo(AVERAGE_ALLOWED, AVERAGE_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    7978      GetVariableInfo(AVERAGE_ALLOWED).Local = true;
    80       AddVariable(new Core.Variable(AVERAGE_ALLOWED,  new BoolData(true)));
     79      AddVariable(new Core.Variable(AVERAGE_ALLOWED, new BoolData(true)));
    8180
    8281      AddVariableInfo(new Core.VariableInfo(AND_ALLOWED, AND_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    8382      GetVariableInfo(AND_ALLOWED).Local = true;
    84       AddVariable(new Core.Variable(AND_ALLOWED,  new BoolData(true)));
     83      AddVariable(new Core.Variable(AND_ALLOWED, new BoolData(true)));
    8584
    8685      AddVariableInfo(new Core.VariableInfo(COSINUS_ALLOWED, COSINUS_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    8786      GetVariableInfo(COSINUS_ALLOWED).Local = true;
    88       AddVariable(new Core.Variable(COSINUS_ALLOWED,  new BoolData(true)));
     87      AddVariable(new Core.Variable(COSINUS_ALLOWED, new BoolData(true)));
    8988
    9089      AddVariableInfo(new Core.VariableInfo(DIVISION_ALLOWED, DIVISION_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    9190      GetVariableInfo(DIVISION_ALLOWED).Local = true;
    92       AddVariable(new Core.Variable(DIVISION_ALLOWED,  new BoolData(true)));
     91      AddVariable(new Core.Variable(DIVISION_ALLOWED, new BoolData(true)));
    9392
    9493      AddVariableInfo(new Core.VariableInfo(EQUAL_ALLOWED, EQUAL_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    9594      GetVariableInfo(EQUAL_ALLOWED).Local = true;
    96       AddVariable(new Core.Variable(EQUAL_ALLOWED,  new BoolData(true)));
     95      AddVariable(new Core.Variable(EQUAL_ALLOWED, new BoolData(true)));
    9796
    9897      AddVariableInfo(new Core.VariableInfo(EXPONENTIAL_ALLOWED, EXPONENTIAL_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    9998      GetVariableInfo(EXPONENTIAL_ALLOWED).Local = true;
    100       AddVariable(new Core.Variable(EXPONENTIAL_ALLOWED,  new BoolData(true)));
     99      AddVariable(new Core.Variable(EXPONENTIAL_ALLOWED, new BoolData(true)));
    101100
    102101      AddVariableInfo(new Core.VariableInfo(GREATERTHAN_ALLOWED, GREATERTHAN_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    103102      GetVariableInfo(GREATERTHAN_ALLOWED).Local = true;
    104       AddVariable(new Core.Variable(GREATERTHAN_ALLOWED,  new BoolData(true)));
     103      AddVariable(new Core.Variable(GREATERTHAN_ALLOWED, new BoolData(true)));
    105104
    106105      AddVariableInfo(new Core.VariableInfo(IFTHENELSE_ALLOWED, IFTHENELSE_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    107106      GetVariableInfo(IFTHENELSE_ALLOWED).Local = true;
    108       AddVariable(new Core.Variable(IFTHENELSE_ALLOWED,  new BoolData(true)));
     107      AddVariable(new Core.Variable(IFTHENELSE_ALLOWED, new BoolData(true)));
    109108
    110109      AddVariableInfo(new Core.VariableInfo(LESSTHAN_ALLOWED, LESSTHAN_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    111110      GetVariableInfo(LESSTHAN_ALLOWED).Local = true;
    112       AddVariable(new Core.Variable(LESSTHAN_ALLOWED,  new BoolData(true)));
     111      AddVariable(new Core.Variable(LESSTHAN_ALLOWED, new BoolData(true)));
    113112
    114113      AddVariableInfo(new Core.VariableInfo(LOGARTIHM_ALLOWED, LOGARTIHM_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    115114      GetVariableInfo(LOGARTIHM_ALLOWED).Local = true;
    116       AddVariable(new Core.Variable(LOGARTIHM_ALLOWED,  new BoolData(true)));
     115      AddVariable(new Core.Variable(LOGARTIHM_ALLOWED, new BoolData(true)));
    117116
    118117      AddVariableInfo(new Core.VariableInfo(MULTIPLICATION_ALLOWED, MULTIPLICATION_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    119118      GetVariableInfo(MULTIPLICATION_ALLOWED).Local = true;
    120       AddVariable(new Core.Variable(MULTIPLICATION_ALLOWED,  new BoolData(true)));
     119      AddVariable(new Core.Variable(MULTIPLICATION_ALLOWED, new BoolData(true)));
    121120
    122121      AddVariableInfo(new Core.VariableInfo(NOT_ALLOWED, NOT_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    123122      GetVariableInfo(NOT_ALLOWED).Local = true;
    124       AddVariable(new Core.Variable(NOT_ALLOWED,  new BoolData(true)));
     123      AddVariable(new Core.Variable(NOT_ALLOWED, new BoolData(true)));
    125124
    126125      AddVariableInfo(new Core.VariableInfo(POWER_ALLOWED, POWER_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    127126      GetVariableInfo(POWER_ALLOWED).Local = true;
    128       AddVariable(new Core.Variable(POWER_ALLOWED,  new BoolData(true)));
     127      AddVariable(new Core.Variable(POWER_ALLOWED, new BoolData(true)));
    129128
    130129      AddVariableInfo(new Core.VariableInfo(OR_ALLOWED, OR_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    131130      GetVariableInfo(OR_ALLOWED).Local = true;
    132       AddVariable(new Core.Variable(OR_ALLOWED,  new BoolData(true)));
     131      AddVariable(new Core.Variable(OR_ALLOWED, new BoolData(true)));
    133132
    134133      AddVariableInfo(new Core.VariableInfo(SIGNUM_ALLOWED, SIGNUM_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    135134      GetVariableInfo(SIGNUM_ALLOWED).Local = true;
    136       AddVariable(new Core.Variable(SIGNUM_ALLOWED,  new BoolData(true)));
     135      AddVariable(new Core.Variable(SIGNUM_ALLOWED, new BoolData(true)));
    137136
    138137      AddVariableInfo(new Core.VariableInfo(SINUS_ALLOWED, SINUS_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    139138      GetVariableInfo(SINUS_ALLOWED).Local = true;
    140       AddVariable(new Core.Variable(SINUS_ALLOWED,  new BoolData(true)));
     139      AddVariable(new Core.Variable(SINUS_ALLOWED, new BoolData(true)));
    141140
    142141      AddVariableInfo(new Core.VariableInfo(SQRT_ALLOWED, SQRT_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
     
    146145      AddVariableInfo(new Core.VariableInfo(SUBTRACTION_ALLOWED, SUBTRACTION_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    147146      GetVariableInfo(SUBTRACTION_ALLOWED).Local = true;
    148       AddVariable(new Core.Variable(SUBTRACTION_ALLOWED,  new BoolData(true)));
     147      AddVariable(new Core.Variable(SUBTRACTION_ALLOWED, new BoolData(true)));
    149148
    150149      AddVariableInfo(new Core.VariableInfo(TANGENS_ALLOWED, TANGENS_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
     
    154153      AddVariableInfo(new Core.VariableInfo(XOR_ALLOWED, XOR_ALLOWED + " allowed", typeof(BoolData), Core.VariableKind.New));
    155154      GetVariableInfo(XOR_ALLOWED).Local = true;
    156       AddVariable(new Core.Variable(XOR_ALLOWED,  new BoolData(true)));
    157     }
    158 
    159     //public override IView CreateView() {
    160     //  return new ConfigurableFunctionLibraryInjectorView(this);
    161     //}
     155      AddVariable(new Core.Variable(XOR_ALLOWED, new BoolData(true)));
     156    }
    162157
    163158    public override IOperation Apply(IScope scope) {
     
    180175      if (!((BoolData)GetVariable(DIVISION_ALLOWED).Value).Data)
    181176        functionLibrary.GPOperatorGroup.RemoveOperator(FindOperator(functionLibrary.GPOperatorGroup, typeof(Division)));
    182       if (!((BoolData)GetVariable(EQUAL_ALLOWED).Value).Data)                                                       
     177      if (!((BoolData)GetVariable(EQUAL_ALLOWED).Value).Data)
    183178        functionLibrary.GPOperatorGroup.RemoveOperator(FindOperator(functionLibrary.GPOperatorGroup, typeof(Equal)));
    184179      if (!((BoolData)GetVariable(EXPONENTIAL_ALLOWED).Value).Data)
     
    212207      if (!((BoolData)GetVariable(XOR_ALLOWED).Value).Data)
    213208        functionLibrary.GPOperatorGroup.RemoveOperator(FindOperator(functionLibrary.GPOperatorGroup, typeof(Xor)));
    214 
    215 
    216209      return null;
    217210    }
    218211
    219     private IFunction FindOperator(GPOperatorGroup g, Type t)  {
     212    private IFunction FindOperator(GPOperatorGroup g, Type t) {
    220213      foreach (IFunction func in g.Operators)
    221214        if (func.GetType() == t)
    222215          return func;
    223216      return null;
    224   }
    225 
    226 
     217    }
    227218  }
    228219}
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/OffSpringSelectionGpEditor.cs

    r1529 r1873  
    7474    protected virtual void SetDataBinding() {
    7575      setRandomSeedRandomlyCheckBox.DataBindings.Add("Checked", OffspringSelectionGP, "SetSeedRandomly");
    76       randomSeedTextBox.DataBindings.Add("Text", OffspringSelectionGP, "Seed");
     76      randomSeedTextBox.DataBindings.Add("Text", OffspringSelectionGP, "RandomSeed");
    7777      populationSizeTextBox.DataBindings.Add("Text", OffspringSelectionGP, "PopulationSize");
    7878      maximumEvaluatedSolutionsTextBox.DataBindings.Add("Text", OffspringSelectionGP, "MaxEvaluatedSolutions");
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/StandardGP.cs

    r1857 r1873  
    142142
    143143    protected internal override IOperator CreateFunctionLibraryInjector() {
    144       return new FunctionLibraryInjector();
     144      ConfigurableFunctionLibraryInjector funLibInjector = new ConfigurableFunctionLibraryInjector();
     145      funLibInjector.GetVariableValue<BoolData>("Xor", null, false).Data = false;
     146      funLibInjector.GetVariableValue<BoolData>("Average", null, false).Data = false;
     147      return funLibInjector;
    145148    }
    146149
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/StandardGpEditor.cs

    r1529 r1873  
    7373    protected virtual void SetDataBinding() {
    7474      setRandomSeedRandomlyCheckBox.DataBindings.Add("Checked", StandardGP, "SetSeedRandomly");
    75       randomSeedTextBox.DataBindings.Add("Text", StandardGP, "Seed");
     75      randomSeedTextBox.DataBindings.Add("Text", StandardGP, "RandomSeed");
    7676      populationSizeTextBox.DataBindings.Add("Text", StandardGP, "PopulationSize");
    7777      maximumGenerationsTextBox.DataBindings.Add("Text", StandardGP, "MaxGenerations");
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/TreeEvaluatorBase.cs

    r1836 r1873  
    124124    public override object Clone(IDictionary<Guid, object> clonedObjects) {
    125125      TreeEvaluatorBase clone = (TreeEvaluatorBase)base.Clone(clonedObjects);
    126       clone.dataset = (Dataset)dataset.Clone(clonedObjects);
     126      if (!clonedObjects.ContainsKey(dataset.Guid)) {
     127        clone.dataset = (Dataset)dataset.Clone(clonedObjects);
     128      } else {
     129        clone.dataset = (Dataset)clonedObjects[dataset.Guid];
     130      }
    127131      clone.estimatedValueMax = estimatedValueMax;
    128132      clone.estimatedValueMin = estimatedValueMin;
Note: See TracChangeset for help on using the changeset viewer.