Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2377


Ignore:
Timestamp:
09/22/09 11:45:04 (15 years ago)
Author:
gkronber
Message:
  • Implemented cloning and persistence in data-modeling algorithms.
  • Fixed bugs in CEDMA controller.

#754

Location:
trunk/sources
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/DispatcherView.cs

    r2376 r2377  
    101101      testSamplesStartTextBox.Text = selectedSpec.TestSamplesStart.ToString();
    102102      testSamplesEndTextBox.Text = selectedSpec.TestSamplesEnd.ToString();
     103      minTimeOffsetTextBox.Text = selectedSpec.MinTimeOffset.ToString();
     104      maxTimeOffsetTextBox.Text = selectedSpec.MaxTimeOffset.ToString();
     105      autoregressiveCheckBox.Checked = selectedSpec.AutoRegressive;
    103106    }
    104107
     
    134137
    135138    private void radioButton_CheckedChanged(object sender, EventArgs e) {
    136       string selectedTarget = (string)targetVariableList.SelectedItem;
    137139      minTimeOffsetLabel.Enabled = timeSeriesRadioButton.Checked;
    138140      minTimeOffsetTextBox.Enabled = timeSeriesRadioButton.Checked;
     
    144146      else if (classificationRadioButton.Checked) selectedSpec.LearningTask = LearningTask.Classification;
    145147      else if (regressionRadioButton.Checked) selectedSpec.LearningTask = LearningTask.Regression;
     148      var allowedAlgorithms = dispatcher.GetAllowedAlgorithms(selectedSpec.TargetVariable);
     149      foreach (var algo in allowedAlgorithms) {
     150        dispatcher.DisableAlgorithm(selectedSpec.TargetVariable, algo);
     151      }
    146152      UpdateAlgorithms();
    147153    }
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/SimpleDispatcher.cs

    r2375 r2377  
    145145      if (possibleAlgos.Count() > 0) selectedAlgorithm = possibleAlgos.ElementAt(random.Next(possibleAlgos.Count()));
    146146      if (selectedAlgorithm != null) {
     147        // create a clone of the algorithm template before setting the parameters
     148        selectedAlgorithm = (HeuristicLab.Modeling.IAlgorithm)selectedAlgorithm.Clone();
    147149        SetProblemParameters(selectedAlgorithm, problemSpecifications[targetVariable]);
    148150        if (!(selectedAlgorithm is IStochasticAlgorithm))
  • trunk/sources/HeuristicLab.GP.Algorithms/3.2/AlgorithmBase.cs

    r2361 r2377  
    106106    }
    107107
    108     private IOperator algorithm;
    109 
    110     private SequentialEngine.SequentialEngine engine;
     108    private IEngine engine;
    111109    public IEngine Engine {
    112110      get { return engine; }
    113       protected set { engine = (SequentialEngine.SequentialEngine)value; }
     111      protected set { engine = value; }
    114112    }
    115113
     
    158156      algo.OperatorGraph.AddOperator(seq);
    159157      algo.OperatorGraph.InitialOperator = seq;
    160       this.algorithm = seq;
    161158      return algo;
    162159    }
     
    466463    }
    467464
    468 
    469     public override object Clone(IDictionary<Guid, object> clonedObjects) {
    470       AlgorithmBase clone = (AlgorithmBase)base.Clone(clonedObjects);
    471       clonedObjects.Add(Guid, clone);
    472       clone.engine = (SequentialEngine.SequentialEngine)Auxiliary.Clone(Engine, clonedObjects);
    473       return clone;
    474     }
    475 
    476465    protected virtual IOperator GetVariableInjector() {
    477466      CombinedOperator init = (CombinedOperator)GetInitializationOperator();
     
    485474
    486475    protected virtual IOperator GetInitializationOperator() {
    487       return algorithm.SubOperators[0];
     476      CombinedOperator algo = (CombinedOperator)Engine.OperatorGraph.InitialOperator;
     477      return algo.OperatorGraph.InitialOperator.SubOperators[0];
    488478    }
    489479
    490480    #region Persistence Methods
     481    public override object Clone(IDictionary<Guid, object> clonedObjects) {
     482      AlgorithmBase clone = (AlgorithmBase)base.Clone(clonedObjects);
     483      clone.engine = (IEngine)Auxiliary.Clone(Engine, clonedObjects);
     484      return clone;
     485    }
     486
    491487    public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    492488      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     
    496492    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    497493      base.Populate(node, restoredObjects);
    498       engine = (SequentialEngine.SequentialEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects);
     494      engine = (IEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects);
    499495    }
    500496    #endregion
    501 
    502 
    503497  }
    504498}
  • trunk/sources/HeuristicLab.LinearRegression/3.2/LinearRegression.cs

    r2375 r2377  
    4242    public virtual string Description { get { return "TODO"; } }
    4343
    44     private SequentialEngine.SequentialEngine engine;
     44    private IEngine engine;
    4545    public virtual IEngine Engine {
    4646      get { return engine; }
     
    135135
    136136      HL3TreeEvaluatorInjector treeEvaluatorInjector = new HL3TreeEvaluatorInjector();
    137 
    138137
    139138      LinearRegressionOperator lrOperator = new LinearRegressionOperator();
     
    250249
    251250    public virtual IEditor CreateEditor() {
    252       return engine.CreateEditor();
    253     }
    254 
     251      return ((SequentialEngine.SequentialEngine)engine).CreateEditor();
     252    }
     253
     254    #endregion
     255
     256    #region persistence
     257    public override object Clone(IDictionary<Guid, object> clonedObjects) {
     258      LinearRegression clone = (LinearRegression) base.Clone(clonedObjects);
     259      clone.engine = (IEngine)Auxiliary.Clone(Engine, clonedObjects);
     260      return clone;
     261    }
     262
     263    public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     264      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     265      node.AppendChild(PersistenceManager.Persist("Engine", engine, document, persistedObjects));
     266      return node;
     267    }
     268
     269    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     270      base.Populate(node, restoredObjects);
     271      engine = (IEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects);
     272    }
    255273    #endregion
    256274  }
  • trunk/sources/HeuristicLab.Modeling/3.2/IAlgorithm.cs

    r2375 r2377  
    2727
    2828namespace HeuristicLab.Modeling {
    29   public interface IAlgorithm {
     29  public interface IAlgorithm : ICloneable {
    3030    string Name { get; }
    3131    string Description { get; }
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorRegression.cs

    r2375 r2377  
    4242    public virtual string Description { get { return "TODO"; } }
    4343
    44     private SequentialEngine.SequentialEngine engine;
     44    private IEngine engine;
    4545    public IEngine Engine {
    4646      get { return engine; }
     
    490490
    491491    public IEditor CreateEditor() {
    492       return engine.CreateEditor();
    493     }
    494 
     492      return ((SequentialEngine.SequentialEngine)engine).CreateEditor();
     493    }
     494
     495    #endregion
     496
     497    #region persistence
     498    public override object Clone(IDictionary<Guid, object> clonedObjects) {
     499      SupportVectorRegression clone = (SupportVectorRegression) base.Clone(clonedObjects);
     500      clone.engine = (IEngine)Auxiliary.Clone(Engine, clonedObjects);
     501      return clone;
     502    }
     503
     504    public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     505      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     506      node.AppendChild(PersistenceManager.Persist("Engine", engine, document, persistedObjects));
     507      return node;
     508    }
     509
     510    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     511      base.Populate(node, restoredObjects);
     512      engine = (IEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects);
     513    }
    495514    #endregion
    496515  }
Note: See TracChangeset for help on using the changeset viewer.