Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2199 for branches


Ignore:
Timestamp:
07/28/09 18:32:53 (15 years ago)
Author:
gkronber
Message:

Changed dispatcher to allow all variables as input or target variable. #712

Location:
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/DispatcherBase.cs

    r2198 r2199  
    5050      get {
    5151        if (problem != null) {
    52           return problem.AllowedTargetVariables.Select(x => problem.Dataset.GetVariableName(x));
     52          return Enumerable.Range(0, problem.Dataset.Columns).Select(x => problem.Dataset.GetVariableName(x));
    5353        } else return new string[0];
    5454      }
     
    5858      get {
    5959        if (problem != null) {
    60           return problem.AllowedInputVariables.Select(x => problem.Dataset.GetVariableName(x));
     60          return TargetVariables;
    6161        } else return new string[0];
    6262      }
     
    6565    public DispatcherBase(IModelingDatabase database, Problem problem) {
    6666      this.problem = problem;
     67      allowedTargetVariables = new List<int>();
     68      activeInputVariables = new Dictionary<int, List<int>>();
    6769      problem.Changed += (sender, args) => {
    68         allowedTargetVariables = new List<int>(problem.AllowedTargetVariables);
    69         activeInputVariables = new Dictionary<int, List<int>>();
    70         foreach (int targetVar in problem.AllowedTargetVariables) {
    71           activeInputVariables.Add(targetVar, new List<int>());
    72           activeInputVariables[targetVar].AddRange(problem.AllowedInputVariables);
     70        lock (locker) {
     71          allowedTargetVariables.Clear();
     72          activeInputVariables.Clear();
    7373        }
    7474        OnChanged();
     
    124124        int targetIndex = problem.Dataset.GetVariableIndex(target);
    125125        int inputIndex = problem.Dataset.GetVariableIndex(name);
     126        if (!activeInputVariables.ContainsKey(targetIndex)) activeInputVariables[targetIndex] = new List<int>();
    126127        if (!activeInputVariables[targetIndex].Contains(inputIndex)) {
    127128          activeInputVariables[targetIndex].Add(inputIndex);
     
    134135        int targetIndex = problem.Dataset.GetVariableIndex(target);
    135136        int inputIndex = problem.Dataset.GetVariableIndex(name);
     137        if (!activeInputVariables.ContainsKey(targetIndex)) activeInputVariables[targetIndex] = new List<int>();
    136138        while (activeInputVariables[targetIndex].Remove(inputIndex)) { }
    137139      }
     
    143145
    144146    internal IEnumerable<string> GetInputVariables(string target) {
    145       return activeInputVariables[problem.Dataset.GetVariableIndex(target)]
     147      int targetIndex = problem.Dataset.GetVariableIndex(target);
     148      if (!activeInputVariables.ContainsKey(targetIndex)) activeInputVariables[targetIndex] = new List<int>();
     149      return activeInputVariables[targetIndex]
    146150        .Select(i => problem.Dataset.GetVariableName(i));
    147151    }
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/Problem.cs

    r2198 r2199  
    8787    }
    8888
    89     private List<int> allowedInputVariables;
    90     public List<int> AllowedInputVariables {
    91       get { return allowedInputVariables; }
    92     }
     89    //private List<int> allowedInputVariables;
     90    //public List<int> AllowedInputVariables {
     91    //  get { return allowedInputVariables; }
     92    //}
    9393
    94     private List<int> allowedTargetVariables;
    95     public List<int> AllowedTargetVariables {
    96       get { return allowedTargetVariables; }
    97     }
     94    //private List<int> allowedTargetVariables;
     95    //public List<int> AllowedTargetVariables {
     96    //  get { return allowedTargetVariables; }
     97    //}
    9898
    9999    private bool autoRegressive;
     
    123123    public Problem()
    124124      : base() {
    125       allowedInputVariables = new List<int>();
    126       allowedTargetVariables = new List<int>();
     125      //allowedInputVariables = new List<int>();
     126      //allowedTargetVariables = new List<int>();
    127127      Dataset = new HeuristicLab.DataAnalysis.Dataset();
    128128    }
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/ProblemView.cs

    r2198 r2199  
    102102          problem.TestSamplesStart = parser.TestSamplesStart;
    103103          problem.TestSamplesEnd = parser.TestSamplesEnd;
    104           problem.AllowedTargetVariables.Add(parser.TargetVariable);
     104          //problem.AllowedTargetVariables.Add(parser.TargetVariable);
    105105          problem.FireChanged();
    106           List<int> nonInputVariables = parser.NonInputVariables;
    107           for (int i = 0; i < dataset.Columns; i++) {
    108             if (!nonInputVariables.Contains(i)) problem.AllowedInputVariables.Add(i);
    109           }
     106          //List<int> nonInputVariables = parser.NonInputVariables;
     107          //for (int i = 0; i < dataset.Columns; i++) {
     108          //  if (!nonInputVariables.Contains(i)) problem.AllowedInputVariables.Add(i);
     109          //}
    110110          Refresh();
    111111        }
Note: See TracChangeset for help on using the changeset viewer.