Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2864 for trunk/sources


Ignore:
Timestamp:
02/25/10 02:49:16 (15 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on algorithms
Location:
trunk/sources
Files:
1 added
8 edited
10 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.Designer.cs

    r2851 r2864  
    4949      this.engineTextBox = new System.Windows.Forms.TextBox();
    5050      this.setEngineButton = new System.Windows.Forms.Button();
     51      this.createUserDefinedAlgorithmButton = new System.Windows.Forms.Button();
    5152      this.tabControl.SuspendLayout();
    5253      this.parametersTabPage.SuspendLayout();
     
    5859      //
    5960      this.tabControl.Location = new System.Drawing.Point(0, 149);
    60       this.tabControl.Size = new System.Drawing.Size(490, 174);
     61      this.tabControl.Size = new System.Drawing.Size(656, 278);
    6162      this.tabControl.TabIndex = 7;
    6263      //
    6364      // parametersTabPage
    6465      //
    65       this.parametersTabPage.Size = new System.Drawing.Size(482, 148);
     66      this.parametersTabPage.Size = new System.Drawing.Size(648, 252);
    6667      //
    6768      // problemTabPage
     
    7172      // parameterCollectionView
    7273      //
    73       this.parameterCollectionView.Size = new System.Drawing.Size(470, 136);
     74      this.parameterCollectionView.Size = new System.Drawing.Size(636, 240);
    7475      //
    7576      // problemViewHost
     
    7980      // startButton
    8081      //
     82      this.startButton.Location = new System.Drawing.Point(0, 433);
    8183      this.startButton.TabIndex = 8;
    8284      //
    8385      // stopButton
    8486      //
     87      this.stopButton.Location = new System.Drawing.Point(30, 433);
    8588      this.stopButton.TabIndex = 9;
    8689      //
    8790      // resetButton
    8891      //
     92      this.resetButton.Location = new System.Drawing.Point(60, 433);
    8993      this.resetButton.TabIndex = 10;
    9094      //
    9195      // executionTimeLabel
    9296      //
     97      this.executionTimeLabel.Location = new System.Drawing.Point(430, 440);
    9398      this.executionTimeLabel.TabIndex = 11;
    9499      //
    95100      // executionTimeTextBox
    96101      //
     102      this.executionTimeTextBox.Location = new System.Drawing.Point(519, 437);
    97103      this.executionTimeTextBox.TabIndex = 12;
    98104      //
     
    101107      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    102108      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
     109      this.nameTextBox.Size = new System.Drawing.Size(584, 20);
     110      //
     111      // descriptionTextBox
     112      //
     113      this.descriptionTextBox.Size = new System.Drawing.Size(584, 87);
    103114      //
    104115      // engineLabel
     
    118129      this.engineTextBox.Name = "engineTextBox";
    119130      this.engineTextBox.ReadOnly = true;
    120       this.engineTextBox.Size = new System.Drawing.Size(388, 20);
     131      this.engineTextBox.Size = new System.Drawing.Size(554, 20);
    121132      this.engineTextBox.TabIndex = 6;
    122133      this.engineTextBox.DoubleClick += new System.EventHandler(this.engineTextBox_DoubleClick);
     
    126137      this.setEngineButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    127138      this.setEngineButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Add;
    128       this.setEngineButton.Location = new System.Drawing.Point(466, 119);
     139      this.setEngineButton.Location = new System.Drawing.Point(632, 119);
    129140      this.setEngineButton.Name = "setEngineButton";
    130141      this.setEngineButton.Size = new System.Drawing.Size(24, 24);
    131142      this.setEngineButton.TabIndex = 5;
     143      this.toolTip.SetToolTip(this.setEngineButton, "Set Engine");
    132144      this.setEngineButton.UseVisualStyleBackColor = true;
    133145      this.setEngineButton.Click += new System.EventHandler(this.setEngineButton_Click);
     146      //
     147      // createUserDefinedAlgorithmButton
     148      //
     149      this.createUserDefinedAlgorithmButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     150      this.createUserDefinedAlgorithmButton.Location = new System.Drawing.Point(90, 433);
     151      this.createUserDefinedAlgorithmButton.Name = "createUserDefinedAlgorithmButton";
     152      this.createUserDefinedAlgorithmButton.Size = new System.Drawing.Size(161, 24);
     153      this.createUserDefinedAlgorithmButton.TabIndex = 13;
     154      this.createUserDefinedAlgorithmButton.Text = "&Create User Defined Algorithm";
     155      this.toolTip.SetToolTip(this.createUserDefinedAlgorithmButton, "Create User Defined Algorithm from this Algorithm");
     156      this.createUserDefinedAlgorithmButton.UseVisualStyleBackColor = true;
     157      this.createUserDefinedAlgorithmButton.Click += new System.EventHandler(this.createUserDefinedAlgorithmButton_Click);
    134158      //
    135159      // EngineAlgorithmView
     
    140164      this.Controls.Add(this.engineTextBox);
    141165      this.Controls.Add(this.engineLabel);
     166      this.Controls.Add(this.createUserDefinedAlgorithmButton);
    142167      this.Name = "EngineAlgorithmView";
     168      this.Size = new System.Drawing.Size(656, 457);
     169      this.Controls.SetChildIndex(this.createUserDefinedAlgorithmButton, 0);
    143170      this.Controls.SetChildIndex(this.engineLabel, 0);
    144171      this.Controls.SetChildIndex(this.engineTextBox, 0);
     
    168195    protected System.Windows.Forms.TextBox engineTextBox;
    169196    protected System.Windows.Forms.Button setEngineButton;
     197    protected System.Windows.Forms.Button createUserDefinedAlgorithmButton;
    170198
    171199
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.cs

    r2852 r2864  
    9898        MainFormManager.CreateDefaultView(Content.Engine).Show();
    9999    }
     100
     101    protected void createUserDefinedAlgorithmButton_Click(object sender, EventArgs e) {
     102      MainFormManager.CreateDefaultView(Content.CreateUserDefinedAlgorithm()).Show();
     103    }
    100104  }
    101105}
  • trunk/sources/HeuristicLab.Optimization/3.3/Algorithm.cs

    r2852 r2864  
    5151          if (problem != null) RegisterProblemEvents();
    5252          OnProblemChanged();
     53          Prepare();
    5354        }
    5455      }
  • trunk/sources/HeuristicLab.Optimization/3.3/EngineAlgorithm.cs

    r2851 r2864  
    116116    }
    117117
     118    public UserDefinedAlgorithm CreateUserDefinedAlgorithm() {
     119      UserDefinedAlgorithm algorithm = new UserDefinedAlgorithm(Name, Description);
     120      Cloner cloner = new Cloner();
     121      foreach (IParameter param in Parameters)
     122        algorithm.Parameters.Add((IParameter)cloner.Clone(param));
     123      algorithm.Problem = (IProblem)cloner.Clone(Problem);
     124      algorithm.Engine = (IEngine)cloner.Clone(engine);
     125      algorithm.OperatorGraph = (OperatorGraph)cloner.Clone(operatorGraph);
     126      return algorithm;
     127    }
     128
    118129    protected override void OnCanceledChanged() {
    119130      if (Canceled && (engine != null))
  • trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj

    r2857 r2864  
    5252    <None Include="HeuristicLabOptimizationPlugin.cs.frame" />
    5353    <Compile Include="Algorithm.cs" />
    54     <Compile Include="IManipulationOperator.cs" />
    55     <Compile Include="ICrossoverOperator.cs" />
    56     <Compile Include="IStochasticSolutionCreator.cs" />
    57     <Compile Include="IStochasticOperator.cs" />
    58     <Compile Include="ISolutionCreator.cs" />
     54    <Compile Include="Interfaces\IAlgorithm.cs" />
     55    <Compile Include="Interfaces\ICrossoverOperator.cs" />
     56    <Compile Include="Interfaces\IEvaluator.cs" />
     57    <Compile Include="Interfaces\IManipulationOperator.cs" />
     58    <Compile Include="Interfaces\IProblem.cs" />
     59    <Compile Include="Interfaces\ISingleObjectiveEvaluator.cs" />
     60    <Compile Include="Interfaces\ISingleObjectiveProblem.cs" />
     61    <Compile Include="Interfaces\ISolutionCreator.cs" />
     62    <Compile Include="Interfaces\IStochasticOperator.cs" />
    5963    <Compile Include="SingleObjectiveProblem.cs" />
    60     <Compile Include="ISingleObjectiveProblem.cs" />
    61     <Compile Include="IEvaluator.cs" />
    62     <Compile Include="ISingleObjectiveEvaluator.cs" />
    6364    <Compile Include="SingleObjectiveEvaluator.cs" />
    6465    <Compile Include="UserDefinedAlgorithm.cs" />
    6566    <Compile Include="EngineAlgorithm.cs" />
    66     <Compile Include="IAlgorithm.cs" />
    6767    <Compile Include="HeuristicLabOptimizationPlugin.cs" />
    68     <Compile Include="IProblem.cs" />
    6968    <Compile Include="Problem.cs" />
    7069    <Compile Include="Properties\AssemblyInfo.cs" />
  • trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/ICrossoverOperator.cs

    r2862 r2864  
    2727  /// An interface which represents an operator for crossing solutions.
    2828  /// </summary>
    29   public interface ICrossoverOperator : IStochasticOperator { }
     29  public interface ICrossoverOperator : IOperator { }
    3030}
  • trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IManipulationOperator.cs

    r2862 r2864  
    2727  /// An interface which represents an operator for manipulating solutions.
    2828  /// </summary>
    29   public interface IManipulationOperator : IStochasticOperator { }
     29  public interface IManipulationOperator : IOperator { }
    3030}
  • trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IProblem.cs

    r2862 r2864  
    2929  /// </summary>
    3030  public interface IProblem : IParameterizedNamedItem {
    31     ISolutionCreator SolutionCreator { get; set; }
    32     IEvaluator Evaluator { get; set; }
     31    ISolutionCreator SolutionCreator { get; }
     32    IEvaluator Evaluator { get; }
     33    OperatorSet Operators { get; }
    3334
    3435    event EventHandler SolutionCreatorChanged;
    3536    event EventHandler EvaluatorChanged;
    36     event EventHandler<EventArgs<Type>> OperatorsChanged;
    3737  }
    3838}
  • trunk/sources/HeuristicLab.Optimization/3.3/Problem.cs

    r2857 r2864  
    5151      get { return EvaluatorParameter.Value; }
    5252      set { EvaluatorParameter.Value = value; }
     53    }
     54    private OperatorSet operators;
     55    public OperatorSet Operators {
     56      get { return operators; }
    5357    }
    5458
  • trunk/sources/HeuristicLab.Optimization/3.3/UserDefinedAlgorithm.cs

    r2851 r2864  
    5050
    5151    public UserDefinedAlgorithm() : base() { }
     52    public UserDefinedAlgorithm(string name) : base(name) { }
     53    public UserDefinedAlgorithm(string name, string description) : base(name, description) { }
    5254
    5355    public event EventHandler OperatorGraphChanged;
  • trunk/sources/HeuristicLab.SGA/3.3/SGA.cs

    r2857 r2864  
    4747      get { return (ISingleObjectiveProblem)base.Problem; }
    4848      set { base.Problem = value; }
    49     }
    50 
    51     public new IScope GlobalScope {
    52       get { return base.GlobalScope; }
    5349    }
    5450
     
    106102
    107103    protected override void OnProblemChanged() {
    108       if (Problem.SolutionCreator is IStochasticSolutionCreator) ((IStochasticSolutionCreator)Problem.SolutionCreator).RandomParameter.ActualName = "Random";
     104      if (Problem.SolutionCreator is IStochasticOperator) ((IStochasticOperator)Problem.SolutionCreator).RandomParameter.ActualName = "Random";
    109105      populationCreator.SolutionCreatorParameter.Value = Problem.SolutionCreator;
    110106      populationCreator.SolutionEvaluatorParameter.Value = Problem.Evaluator;
     
    115111    }
    116112    protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
    117       if (Problem.SolutionCreator is IStochasticSolutionCreator) ((IStochasticSolutionCreator)Problem.SolutionCreator).RandomParameter.ActualName = "Random";
     113      if (Problem.SolutionCreator is IStochasticOperator) ((IStochasticOperator)Problem.SolutionCreator).RandomParameter.ActualName = "Random";
    118114      populationCreator.SolutionCreatorParameter.Value = Problem.SolutionCreator;
    119115      base.Problem_SolutionCreatorChanged(sender, e);
Note: See TracChangeset for help on using the changeset viewer.