Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/20/09 20:14:47 (15 years ago)
Author:
gkronber
Message:

Implemented #302 (Show variable names instead of var<index> in GP function trees).

  • Added a new operator that chooses a random value from a list of possible values.
  • Changed mutation operator for variables and differentials
  • Changed internal linear representation of function trees to support different types for local data.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Modeling/3.2/ProblemInjector.cs

    r2165 r2174  
    7878      AddVariableInfo(new VariableInfo("MaxNumberOfTrainingSamples", "Maximal number of training samples to use (optional)", typeof(IntData), VariableKind.In));
    7979      AddVariableInfo(new VariableInfo("NumberOfInputVariables", "The number of available input variables", typeof(IntData), VariableKind.New));
     80      AddVariableInfo(new VariableInfo("InputVariables", "List of input variable names", typeof(ItemList), VariableKind.New));
    8081    }
    8182
     
    9798
    9899      Dataset scopeDataset = CreateNewDataset(operatorDataset, targetVariable, operatorAllowedFeatures);
     100      ItemList inputVariables = new ItemList();
     101      for (int i = 1; i < scopeDataset.Columns; i++) {
     102        inputVariables.Add(new StringData(scopeDataset.GetVariableName(i)));
     103      }
    99104
    100       scope.AddVariable(new Variable("Dataset", scopeDataset));
    101       scope.AddVariable(new Variable("TargetVariable", new IntData(0)));
    102       scope.AddVariable(new Variable("NumberOfInputVariables", new IntData(scopeDataset.Columns - 1)));
     105      scope.AddVariable(new Variable(scope.TranslateName("Dataset"), scopeDataset));
     106      scope.AddVariable(new Variable(scope.TranslateName("TargetVariable"), new IntData(0)));
     107      scope.AddVariable(new Variable(scope.TranslateName("NumberOfInputVariables"), new IntData(scopeDataset.Columns - 1)));
     108      scope.AddVariable(new Variable(scope.TranslateName("InputVariables"), inputVariables));
    103109
    104110      int trainingStart = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data;
     
    116122      scope.AddVariable(new Variable(scope.TranslateName("ActualTrainingSamplesStart"), new IntData(trainingStart)));
    117123      scope.AddVariable(new Variable(scope.TranslateName("ActualTrainingSamplesEnd"), new IntData(trainingStart + nTrainingSamples)));
     124
     125
    118126      return null;
    119127    }
     
    154162
    155163    private void AddVariableToScope(string variableName, IScope scope) {
    156       scope.AddVariable(new Variable(variableName, (IItem)GetVariable(variableName).Value.Clone()));     
     164      scope.AddVariable(new Variable(scope.TranslateName(variableName), (IItem)GetVariable(variableName).Value.Clone()));     
    157165    }
    158166  }
Note: See TracChangeset for help on using the changeset viewer.