Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13713


Ignore:
Timestamp:
03/17/16 00:29:30 (9 years ago)
Author:
abeham
Message:

#2457: worked on seeding algorithm instances

Location:
branches/PerformanceComparison
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.Encodings.PermutationEncoding/3.3/Creators/PreexistingPermutationCreator.cs

    r13706 r13713  
    7373      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The new random permutation."));
    7474      Parameters.Add(new ValueParameter<PermutationType>("PermutationType", "The type of the permutation.", new PermutationType(PermutationTypes.RelativeUndirected)));
    75       Parameters.Add(new ValueLookupParameter<ScopeList>("PreexistingSolutions", "The list of solutions that should be used to create a new solution."));
    76       Parameters.Add(new ValueLookupParameter<BoolValue>("SampleFromPreexisting", "Whether the preexisting solutions should be used as a basis to sample from or whether they should be cloned."));
     75      Parameters.Add(new ValueLookupParameter<ScopeList>("PreexistingSolutions", "The list of solutions that should be used to create a new solution.", new ScopeList()));
     76      Parameters.Add(new ValueLookupParameter<BoolValue>("SampleFromPreexisting", "Whether the preexisting solutions should be used as a basis to sample from or whether they should be cloned.", new BoolValue(true)));
    7777    }
    7878
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/ExpertSystem.cs

    r13685 r13713  
    4040using RunCreationClient = HeuristicLab.Clients.OKB.RunCreation.RunCreationClient;
    4141using SingleObjectiveOKBProblem = HeuristicLab.Clients.OKB.RunCreation.SingleObjectiveOKBProblem;
     42using SingleObjectiveOKBSolution = HeuristicLab.Clients.OKB.RunCreation.SingleObjectiveOKBSolution;
    4243
    4344namespace HeuristicLab.OptimizationExpertSystem.Common {
    4445  [Item("Expert-System", "Currently in experimental phase, an expert system that makes algorithm suggestions based on fitness landscape analysis features and an optimization knowledge base.")]
    45   [StorableClass]
    4646  [Creatable(CreatableAttribute.Categories.TestingAndAnalysis, Priority = 119)]
    4747  public sealed class ExpertSystem : NamedItem, IStorableContent, INotifyPropertyChanged {
     
    123123    }
    124124
    125     [Storable(Name = "newSolutionPool")]
    126     private CheckedItemList<IScope> solutionPool;
    127     public CheckedItemList<IScope> SolutionPool {
    128       get { return solutionPool; }
    129       set {
    130         if (solutionPool == value) return;
    131         solutionPool = value;
    132         OnPropertyChanged("SolutionPool");
    133       }
     125    [Storable]
     126    private CheckedItemList<IScope> solutionSeedingPool;
     127    public CheckedItemList<IScope> SolutionSeedingPool {
     128      get { return solutionSeedingPool; }
     129      set { solutionSeedingPool = value; }
     130    }
     131
     132    [Storable]
     133    private EnumValue<SeedingStrategyTypes> seedingStrategy;
     134    public EnumValue<SeedingStrategyTypes> SeedingStrategy {
     135      get { return seedingStrategy; }
     136      set { seedingStrategy = value; }
    134137    }
    135138   
     
    167170      }
    168171      currentResult = cloner.Clone(original.currentResult);
    169       solutionPool = cloner.Clone(original.solutionPool);
     172      solutionSeedingPool = cloner.Clone(original.solutionSeedingPool);
     173      seedingStrategy = cloner.Clone(original.seedingStrategy);
    170174      currentInstance = cloner.Clone(original.currentInstance);
    171175      RegisterEventHandlers();
     
    180184      problemInstances = new RunCollection();
    181185      problem = new SingleObjectiveOKBProblem();
    182       solutionPool = new CheckedItemList<IScope>();
    183186      algorithmId2RunMapping = new BidirectionalLookup<long, IRun>();
    184187      algorithmId2AlgorithmInstanceMapping = new BidirectionalDictionary<long, IAlgorithm>();
     188      solutionSeedingPool = new CheckedItemList<IScope>();
     189      seedingStrategy = new EnumValue<SeedingStrategyTypes>(SeedingStrategyTypes.NoSeeding);
    185190      RegisterEventHandlers();
    186191    }
    187192
    188193    private void ProblemOnProblemChanged(object sender, EventArgs eventArgs) {
    189       if (Problem == null) return;
     194     
    190195    }
    191196
     
    202207    private void RegisterEventHandlers() {
    203208      problem.ProblemChanged += ProblemOnProblemChanged;
     209      problem.Solutions.ItemsAdded += ProblemSolutionsChanged;
     210      problem.Solutions.ItemsReplaced += ProblemSolutionsChanged;
     211      problem.Solutions.ItemsRemoved += ProblemSolutionsChanged;
     212      problem.Solutions.CollectionReset += ProblemSolutionsChanged;
    204213      runs.CollectionReset += InformationChanged;
    205214      runs.ItemsAdded += InformationChanged;
     
    210219      knowledgeBase.ItemsAdded += InformationChanged;
    211220      knowledgeBase.ItemsRemoved += InformationChanged;
     221    }
     222
     223    private void ProblemSolutionsChanged(object sender, EventArgs e) {
     224      foreach (var sol in Problem.Solutions.Select(x => x.Solution).OfType<IScope>()) {
     225        if (!SolutionSeedingPool.Contains(sol))
     226          SolutionSeedingPool.Add(sol, false);
     227      }
    212228    }
    213229
     
    354370    };
    355371
    356     public void StartAlgorithmAsync(int index) {
     372    public Task StartAlgorithmAsync(int index) {
    357373      var selectedInstance = suggestedInstances[index];
    358       var algorithm = (IAlgorithm)selectedInstance.Clone();
    359       algorithm.Problem = Problem.CloneProblem();
    360       algorithm.Prepare(true);
     374      var algorithmClone = (IAlgorithm)selectedInstance.Clone();
     375      var problemClone = Problem.CloneProblem() as ISingleObjectiveHeuristicOptimizationProblem;
     376      if (problemClone == null) throw new InvalidOperationException("Problem is not of type " + typeof(ISingleObjectiveHeuristicOptimizationProblem).FullName);
     377      // TODO: It is assumed the problem instance by default is configured using no preexisting solution creator
     378      if (SeedingStrategy.Value != SeedingStrategyTypes.NoSeeding) {
     379        if (!SolutionSeedingPool.CheckedItems.Any()) throw new InvalidOperationException("There are no solutions selected for seeding.");
     380        // TODO: It would be necessary to specify the solution creator somewhere (property and GUI)
     381        var seedingCreator = problemClone.Operators.OfType<IPreexistingSolutionCreator>().FirstOrDefault();
     382        if (seedingCreator == null) throw new InvalidOperationException("The problem does not contain a solution creator that allows seeding.");
     383        seedingCreator.PreexistingSolutionsParameter.Value.Replace(SolutionSeedingPool.CheckedItems.Select(x => x.Value));
     384        seedingCreator.SampleFromPreexistingParameter.Value.Value = SeedingStrategy.Value == SeedingStrategyTypes.SeedBySampling;
     385        // TODO: WHY!? WHY??!?
     386        ((dynamic)problemClone.SolutionCreatorParameter).Value = (dynamic)seedingCreator;
     387      }
     388      algorithmClone.Problem = problemClone;
     389      algorithmClone.Prepare(true);
    361390      IParameter stopParam;
    362391      var monitorStop = true;
    363       if (algorithm.Parameters.TryGetValue("MaximumEvaluations", out stopParam)) {
     392      if (algorithmClone.Parameters.TryGetValue("MaximumEvaluations", out stopParam)) {
    364393        var maxEvalParam = stopParam as IValueParameter<Data.IntValue>;
    365394        if (maxEvalParam != null) {
     
    368397        }
    369398      }
    370       algorithm.ExecutionStateChanged += AlgorithmOnExecutionStateChanged;
    371       algorithm.ExceptionOccurred += AlgorithmOnExceptionOccurred;
    372       if (monitorStop) algorithm.ExecutionTimeChanged += AlgorithmOnExecutionTimeChanged;
    373 
    374       algorithm.Start();
     399
     400      // TODO: The following can be simplified when we have async implementation patterns for our algorithms:
     401      // TODO: The closures can be removed and replaced with private member methods
     402      var waitHandle = new AutoResetEvent(false);
     403
     404      #region EventHandler closures
     405      EventHandler exeStateChanged = (sender, e) => {
     406        if (algorithmClone.ExecutionState == ExecutionState.Started) {
     407          CurrentResult = algorithmClone.Results;
     408        } else if (algorithmClone.ExecutionState == ExecutionState.Stopped) {
     409          foreach (var solution in algorithmClone.Results.Where(x => x.Name.ToLower().Contains("solution")).Select(x => x.Value).OfType<IScope>()) {
     410            Problem.Solutions.Add(new SingleObjectiveOKBSolution(Problem.ProblemId) {
     411              Quality = solution.Variables.ContainsKey(Problem.Problem.Evaluator.QualityParameter.ActualName) ? ((DoubleValue)solution.Variables[Problem.Problem.Evaluator.QualityParameter.ActualName].Value).Value : double.NaN,
     412              Solution = (IItem)solution.Clone()
     413            });
     414          }
     415          Runs.Add(algorithmClone.Runs.Last());
     416          waitHandle.Set();
     417        }
     418      };
     419
     420      EventHandler<EventArgs<Exception>> exceptionOccurred = (sender, e) => {
     421        waitHandle.Set();
     422      };
     423
     424      EventHandler timeChanged = (sender, e) => {
     425        IResult evalSolResult;
     426        if (!algorithmClone.Results.TryGetValue("EvaluatedSolutions", out evalSolResult) || !(evalSolResult.Value is Data.IntValue)) return;
     427        var evalSols = ((Data.IntValue)evalSolResult.Value).Value;
     428        if (evalSols >= MaximumEvaluations && algorithmClone.ExecutionState == ExecutionState.Started)
     429          algorithmClone.Stop();
     430      };
     431      #endregion
     432
     433      algorithmClone.ExecutionStateChanged += exeStateChanged;
     434      algorithmClone.ExceptionOccurred += exceptionOccurred;
     435      if (monitorStop) algorithmClone.ExecutionTimeChanged += timeChanged;
     436
     437      return Task.Factory.StartNew(() => {
     438        algorithmClone.Start();
     439        waitHandle.WaitOne();
     440        waitHandle.Dispose();
     441      });
    375442    }
    376443
    377444    public void StartAlgorithm(int index) {
    378       var selectedInstance = suggestedInstances[index];
    379       var algorithm = (IAlgorithm)selectedInstance.Clone();
    380       algorithm.Problem = Problem.CloneProblem();
    381       algorithm.Prepare(true);
    382       IParameter stopParam;
    383       var monitorStop = true;
    384       if (algorithm.Parameters.TryGetValue("MaximumEvaluations", out stopParam)) {
    385         var maxEvalParam = stopParam as IValueParameter<Data.IntValue>;
    386         if (maxEvalParam != null) {
    387           maxEvalParam.Value.Value = MaximumEvaluations;
    388           monitorStop = false;
    389         }
    390       }
    391       algorithm.ExecutionStateChanged += AlgorithmOnExecutionStateChanged;
    392       algorithm.ExceptionOccurred += AlgorithmOnExceptionOccurred;
    393       if (monitorStop) algorithm.ExecutionTimeChanged += AlgorithmOnExecutionTimeChanged;
    394 
    395       using (algWh = new AutoResetEvent(false)) {
    396         algorithm.Start();
    397         algWh.WaitOne();
    398       }
    399       algWh = null;
    400     }
    401 
    402     private AutoResetEvent algWh;
    403 
    404     private void AlgorithmOnExecutionStateChanged(object sender, EventArgs eventArgs) {
    405       var alg = sender as IAlgorithm;
    406       if (alg == null) return;
    407       if (alg.ExecutionState == ExecutionState.Started) {
    408         CurrentResult = alg.Results;
    409       } else if (alg.ExecutionState == ExecutionState.Stopped) {
    410         alg.ExecutionStateChanged -= AlgorithmOnExecutionStateChanged;
    411         alg.ExceptionOccurred -= AlgorithmOnExceptionOccurred;
    412         alg.ExecutionTimeChanged -= AlgorithmOnExecutionTimeChanged;
    413         foreach (var solution in alg.Results.Where(x => x.Name.ToLower().Contains("solution")).Select(x => x.Value).OfType<IScope>()) {
    414           solutionPool.Add(solution);
    415         }
    416         Runs.Add(alg.Runs.Last());
    417         if (algWh != null) algWh.Set();
    418       }
    419     }
    420 
    421     private void AlgorithmOnExceptionOccurred(object sender, EventArgs<Exception> eventArgs) {
    422       var alg = sender as IAlgorithm;
    423       if (alg == null) return;
    424       alg.ExecutionStateChanged -= AlgorithmOnExecutionStateChanged;
    425       alg.ExceptionOccurred -= AlgorithmOnExceptionOccurred;
    426       alg.ExecutionTimeChanged -= AlgorithmOnExecutionTimeChanged;
    427       if (algWh != null) algWh.Set();
    428     }
    429 
    430     private void AlgorithmOnExecutionTimeChanged(object sender, EventArgs eventArgs) {
    431       var alg = sender as IAlgorithm;
    432       if (alg == null) return;
    433       IResult evalSolResult;
    434       if (!alg.Results.TryGetValue("EvaluatedSolutions", out evalSolResult) || !(evalSolResult.Value is Data.IntValue)) return;
    435       var evalSols = ((Data.IntValue)evalSolResult.Value).Value;
    436       if (evalSols >= MaximumEvaluations) alg.Stop();
     445      StartAlgorithmAsync(index).Wait();
    437446    }
    438447
     
    613622      }
    614623
    615       suggestedInstances.Clear();
    616624      var instanceLadder = instances.Select(x => (IAlgorithm)x.Value.Clone()).ToList();
    617625      if (Maximization) instanceLadder.Reverse();
    618       suggestedInstances.AddRange(instanceLadder);
     626      suggestedInstances.Replace(instanceLadder);
    619627    }
    620628
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/HeuristicLab.OptimizationExpertSystem.Common-3.3.csproj

    r13663 r13713  
    109109      <Private>False</Private>
    110110    </Reference>
     111    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     112      <SpecificVersion>False</SpecificVersion>
     113      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
     114      <Private>False</Private>
     115    </Reference>
    111116    <Reference Include="HeuristicLab.Persistence-3.3">
    112117      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
     
    140145    <Compile Include="ExpertSystem.cs" />
    141146    <Compile Include="Plugin.cs" />
     147    <Compile Include="SeedingStrategyTypes.cs" />
    142148    <None Include="Properties\AssemblyInfo.cs.frame" />
    143149    <Compile Include="ProblemCharacteristicAnalysis\CharacteristicCalculator.cs" />
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/ExpertSystemView.Designer.cs

    r13668 r13713  
    2727    private System.ComponentModel.IContainer components = null;
    2828
     29    /// <summary>
     30    /// Clean up any resources being used.
     31    /// </summary>
     32    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
     33    protected override void Dispose(bool disposing) {
     34      if (disposing && (components != null)) {
     35        components.Dispose();
     36      }
     37      base.Dispose(disposing);
     38    }
     39
    2940    #region Component Designer generated code
    3041
     
    4758      this.problemTabPage = new System.Windows.Forms.TabPage();
    4859      this.problemViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    49       this.algorithmTabPage = new System.Windows.Forms.TabPage();
    50       this.algorithmCloneButton = new System.Windows.Forms.Button();
    51       this.algorithmStartButton = new System.Windows.Forms.Button();
    52       this.algorithmViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    53       this.algorithmSuggestionLabel = new System.Windows.Forms.Label();
    54       this.suggestedInstancesComboBox = new System.Windows.Forms.ComboBox();
    55       this.runsTabPage = new System.Windows.Forms.TabPage();
    56       this.runsView = new HeuristicLab.Optimization.Views.RunCollectionView();
    5760      this.solutionsTabPage = new System.Windows.Forms.TabPage();
    58       this.qualityNameLabel = new System.Windows.Forms.Label();
     61      this.solutionNameLabel = new System.Windows.Forms.Label();
    5962      this.solutionDiversitySimilarityLabel = new System.Windows.Forms.Label();
    60       this.solutionNameLabel = new System.Windows.Forms.Label();
     63      this.solutionNameComboBox = new System.Windows.Forms.ComboBox();
    6164      this.similarityComboBox = new System.Windows.Forms.ComboBox();
    62       this.qualityNameComboBox = new System.Windows.Forms.ComboBox();
    63       this.solutionNameComboBox = new System.Windows.Forms.ComboBox();
    64       this.solutionsTabControl = new System.Windows.Forms.TabControl();
    65       this.solutionsListTabPage = new System.Windows.Forms.TabPage();
    66       this.solutionsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     65      this.solutionsTabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl();
     66      this.solutionsSeedingTabPage = new System.Windows.Forms.TabPage();
    6767      this.solutionsQualityTabPage = new System.Windows.Forms.TabPage();
    6868      this.solutionsQualityViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     
    7575      this.solutionsNetworkTabPage = new System.Windows.Forms.TabPage();
    7676      this.solutionsNetworkChart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart();
     77      this.solversTabPage = new System.Windows.Forms.TabPage();
     78      this.solversSplitContainer = new System.Windows.Forms.SplitContainer();
     79      this.solverParametersView = new HeuristicLab.Core.Views.ParameterCollectionView();
     80      this.solverResultsView = new HeuristicLab.Optimization.Views.ResultCollectionView();
     81      this.algorithmCloneButton = new System.Windows.Forms.Button();
     82      this.algorithmStartButton = new System.Windows.Forms.Button();
     83      this.algorithmSuggestionLabel = new System.Windows.Forms.Label();
     84      this.suggestedInstancesComboBox = new System.Windows.Forms.ComboBox();
     85      this.runsTabPage = new System.Windows.Forms.TabPage();
     86      this.runsView = new HeuristicLab.Optimization.Views.RunCollectionView();
    7787      this.okbTabPage = new System.Windows.Forms.TabPage();
    7888      this.kbViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    7989      this.problemInstancesTabPage = new System.Windows.Forms.TabPage();
    80       this.label1 = new System.Windows.Forms.Label();
     90      this.projectionLabel = new System.Windows.Forms.Label();
    8191      this.projectionComboBox = new System.Windows.Forms.ComboBox();
    82       this.problemInstancesTabControl = new System.Windows.Forms.TabControl();
     92      this.problemInstancesTabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl();
    8393      this.instancesTabPage = new System.Windows.Forms.TabPage();
    8494      this.problemInstancesView = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     
    8999      this.okbDownloadButton = new System.Windows.Forms.Button();
    90100      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
     101      this.solutionsSeedingTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
    91102      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    92103      this.tabControl.SuspendLayout();
    93104      this.problemTabPage.SuspendLayout();
    94       this.algorithmTabPage.SuspendLayout();
    95       this.runsTabPage.SuspendLayout();
    96105      this.solutionsTabPage.SuspendLayout();
    97106      this.solutionsTabControl.SuspendLayout();
    98       this.solutionsListTabPage.SuspendLayout();
     107      this.solutionsSeedingTabPage.SuspendLayout();
    99108      this.solutionsQualityTabPage.SuspendLayout();
    100109      this.solutionsDiversityTabPage.SuspendLayout();
     
    103112      this.solutionsNetworkTabPage.SuspendLayout();
    104113      ((System.ComponentModel.ISupportInitialize)(this.solutionsNetworkChart)).BeginInit();
     114      this.solversTabPage.SuspendLayout();
     115      ((System.ComponentModel.ISupportInitialize)(this.solversSplitContainer)).BeginInit();
     116      this.solversSplitContainer.Panel1.SuspendLayout();
     117      this.solversSplitContainer.Panel2.SuspendLayout();
     118      this.solversSplitContainer.SuspendLayout();
     119      this.runsTabPage.SuspendLayout();
    105120      this.okbTabPage.SuspendLayout();
    106121      this.problemInstancesTabPage.SuspendLayout();
     
    148163            | System.Windows.Forms.AnchorStyles.Right)));
    149164      this.tabControl.Controls.Add(this.problemTabPage);
    150       this.tabControl.Controls.Add(this.algorithmTabPage);
     165      this.tabControl.Controls.Add(this.solutionsTabPage);
     166      this.tabControl.Controls.Add(this.solversTabPage);
    151167      this.tabControl.Controls.Add(this.runsTabPage);
    152       this.tabControl.Controls.Add(this.solutionsTabPage);
    153168      this.tabControl.Controls.Add(this.okbTabPage);
    154169      this.tabControl.Controls.Add(this.problemInstancesTabPage);
     
    185200      this.problemViewHost.ViewType = null;
    186201      //
    187       // algorithmTabPage
    188       //
    189       this.algorithmTabPage.Controls.Add(this.algorithmCloneButton);
    190       this.algorithmTabPage.Controls.Add(this.algorithmStartButton);
    191       this.algorithmTabPage.Controls.Add(this.algorithmViewHost);
    192       this.algorithmTabPage.Controls.Add(this.algorithmSuggestionLabel);
    193       this.algorithmTabPage.Controls.Add(this.suggestedInstancesComboBox);
    194       this.algorithmTabPage.Location = new System.Drawing.Point(4, 22);
    195       this.algorithmTabPage.Name = "algorithmTabPage";
    196       this.algorithmTabPage.Padding = new System.Windows.Forms.Padding(3);
    197       this.algorithmTabPage.Size = new System.Drawing.Size(681, 428);
    198       this.algorithmTabPage.TabIndex = 4;
    199       this.algorithmTabPage.Text = "Algorithm";
    200       this.algorithmTabPage.UseVisualStyleBackColor = true;
    201       //
    202       // algorithmCloneButton
    203       //
    204       this.algorithmCloneButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    205       this.algorithmCloneButton.Location = new System.Drawing.Point(649, 5);
    206       this.algorithmCloneButton.Name = "algorithmCloneButton";
    207       this.algorithmCloneButton.Size = new System.Drawing.Size(26, 23);
    208       this.algorithmCloneButton.TabIndex = 3;
    209       this.algorithmCloneButton.Text = "Clone";
    210       this.algorithmCloneButton.UseVisualStyleBackColor = true;
    211       this.algorithmCloneButton.Click += new System.EventHandler(this.AlgorithmCloneButtonOnClick);
    212       //
    213       // algorithmStartButton
    214       //
    215       this.algorithmStartButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    216       this.algorithmStartButton.Location = new System.Drawing.Point(617, 5);
    217       this.algorithmStartButton.Name = "algorithmStartButton";
    218       this.algorithmStartButton.Size = new System.Drawing.Size(26, 23);
    219       this.algorithmStartButton.TabIndex = 3;
    220       this.algorithmStartButton.Text = "Start";
    221       this.algorithmStartButton.UseVisualStyleBackColor = true;
    222       this.algorithmStartButton.Click += new System.EventHandler(this.AlgorithmStartButtonOnClick);
    223       //
    224       // algorithmViewHost
    225       //
    226       this.algorithmViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    227             | System.Windows.Forms.AnchorStyles.Left)
    228             | System.Windows.Forms.AnchorStyles.Right)));
    229       this.algorithmViewHost.Caption = "View";
    230       this.algorithmViewHost.Content = null;
    231       this.algorithmViewHost.Enabled = false;
    232       this.algorithmViewHost.Location = new System.Drawing.Point(6, 36);
    233       this.algorithmViewHost.Name = "algorithmViewHost";
    234       this.algorithmViewHost.ReadOnly = false;
    235       this.algorithmViewHost.Size = new System.Drawing.Size(669, 386);
    236       this.algorithmViewHost.TabIndex = 2;
    237       this.algorithmViewHost.ViewsLabelVisible = true;
    238       this.algorithmViewHost.ViewType = null;
    239       //
    240       // algorithmSuggestionLabel
    241       //
    242       this.algorithmSuggestionLabel.AutoSize = true;
    243       this.algorithmSuggestionLabel.Location = new System.Drawing.Point(6, 9);
    244       this.algorithmSuggestionLabel.Name = "algorithmSuggestionLabel";
    245       this.algorithmSuggestionLabel.Size = new System.Drawing.Size(156, 13);
    246       this.algorithmSuggestionLabel.TabIndex = 1;
    247       this.algorithmSuggestionLabel.Text = "Suggested Algorithm Instances:";
    248       //
    249       // suggestedInstancesComboBox
    250       //
    251       this.suggestedInstancesComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    252             | System.Windows.Forms.AnchorStyles.Right)));
    253       this.suggestedInstancesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    254       this.suggestedInstancesComboBox.FormattingEnabled = true;
    255       this.suggestedInstancesComboBox.Location = new System.Drawing.Point(178, 6);
    256       this.suggestedInstancesComboBox.Name = "suggestedInstancesComboBox";
    257       this.suggestedInstancesComboBox.Size = new System.Drawing.Size(433, 21);
    258       this.suggestedInstancesComboBox.TabIndex = 0;
    259       this.suggestedInstancesComboBox.SelectedIndexChanged += new System.EventHandler(this.SuggestedInstancesComboBoxOnSelectedIndexChanged);
    260       //
    261       // runsTabPage
    262       //
    263       this.runsTabPage.Controls.Add(this.runsView);
    264       this.runsTabPage.Location = new System.Drawing.Point(4, 22);
    265       this.runsTabPage.Name = "runsTabPage";
    266       this.runsTabPage.Padding = new System.Windows.Forms.Padding(3);
    267       this.runsTabPage.Size = new System.Drawing.Size(681, 428);
    268       this.runsTabPage.TabIndex = 3;
    269       this.runsTabPage.Text = "Runs";
    270       this.runsTabPage.UseVisualStyleBackColor = true;
    271       //
    272       // runsView
    273       //
    274       this.runsView.Caption = "RunCollection View";
    275       this.runsView.Content = null;
    276       this.runsView.Dock = System.Windows.Forms.DockStyle.Fill;
    277       this.runsView.Location = new System.Drawing.Point(3, 3);
    278       this.runsView.Name = "runsView";
    279       this.runsView.ReadOnly = false;
    280       this.runsView.Size = new System.Drawing.Size(675, 422);
    281       this.runsView.TabIndex = 1;
    282       //
    283202      // solutionsTabPage
    284203      //
    285       this.solutionsTabPage.Controls.Add(this.qualityNameLabel);
     204      this.solutionsTabPage.Controls.Add(this.solutionNameLabel);
    286205      this.solutionsTabPage.Controls.Add(this.solutionDiversitySimilarityLabel);
    287       this.solutionsTabPage.Controls.Add(this.solutionNameLabel);
     206      this.solutionsTabPage.Controls.Add(this.solutionNameComboBox);
    288207      this.solutionsTabPage.Controls.Add(this.similarityComboBox);
    289       this.solutionsTabPage.Controls.Add(this.qualityNameComboBox);
    290       this.solutionsTabPage.Controls.Add(this.solutionNameComboBox);
    291208      this.solutionsTabPage.Controls.Add(this.solutionsTabControl);
    292209      this.solutionsTabPage.Location = new System.Drawing.Point(4, 22);
     
    298215      this.solutionsTabPage.UseVisualStyleBackColor = true;
    299216      //
    300       // qualityNameLabel
    301       //
    302       this.qualityNameLabel.AutoSize = true;
    303       this.qualityNameLabel.Location = new System.Drawing.Point(227, 9);
    304       this.qualityNameLabel.Name = "qualityNameLabel";
    305       this.qualityNameLabel.Size = new System.Drawing.Size(42, 13);
    306       this.qualityNameLabel.TabIndex = 2;
    307       this.qualityNameLabel.Text = "Quality:";
     217      // solutionNameLabel
     218      //
     219      this.solutionNameLabel.AutoSize = true;
     220      this.solutionNameLabel.Location = new System.Drawing.Point(235, 9);
     221      this.solutionNameLabel.Name = "solutionNameLabel";
     222      this.solutionNameLabel.Size = new System.Drawing.Size(48, 13);
     223      this.solutionNameLabel.TabIndex = 2;
     224      this.solutionNameLabel.Text = "Solution:";
    308225      //
    309226      // solutionDiversitySimilarityLabel
    310227      //
    311228      this.solutionDiversitySimilarityLabel.AutoSize = true;
    312       this.solutionDiversitySimilarityLabel.Location = new System.Drawing.Point(449, 9);
     229      this.solutionDiversitySimilarityLabel.Location = new System.Drawing.Point(5, 9);
    313230      this.solutionDiversitySimilarityLabel.Name = "solutionDiversitySimilarityLabel";
    314231      this.solutionDiversitySimilarityLabel.Size = new System.Drawing.Size(50, 13);
     
    316233      this.solutionDiversitySimilarityLabel.Text = "Similarity:";
    317234      //
    318       // solutionNameLabel
    319       //
    320       this.solutionNameLabel.AutoSize = true;
    321       this.solutionNameLabel.Location = new System.Drawing.Point(6, 9);
    322       this.solutionNameLabel.Name = "solutionNameLabel";
    323       this.solutionNameLabel.Size = new System.Drawing.Size(48, 13);
    324       this.solutionNameLabel.TabIndex = 2;
    325       this.solutionNameLabel.Text = "Solution:";
     235      // solutionNameComboBox
     236      //
     237      this.solutionNameComboBox.DisplayMember = "ItemName";
     238      this.solutionNameComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     239      this.solutionNameComboBox.FormattingEnabled = true;
     240      this.solutionNameComboBox.Location = new System.Drawing.Point(291, 6);
     241      this.solutionNameComboBox.Name = "solutionNameComboBox";
     242      this.solutionNameComboBox.Size = new System.Drawing.Size(150, 21);
     243      this.solutionNameComboBox.TabIndex = 1;
     244      this.solutionNameComboBox.SelectedIndexChanged += new System.EventHandler(this.SimilarityComboBoxOnSelectedIndexChanged);
    326245      //
    327246      // similarityComboBox
     
    330249      this.similarityComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    331250      this.similarityComboBox.FormattingEnabled = true;
    332       this.similarityComboBox.Location = new System.Drawing.Point(505, 6);
     251      this.similarityComboBox.Location = new System.Drawing.Point(61, 6);
    333252      this.similarityComboBox.Name = "similarityComboBox";
    334253      this.similarityComboBox.Size = new System.Drawing.Size(150, 21);
    335254      this.similarityComboBox.TabIndex = 1;
    336       this.similarityComboBox.SelectedIndexChanged += new System.EventHandler(this.similarityComboBox_SelectedIndexChanged);
    337       //
    338       // qualityNameComboBox
    339       //
    340       this.qualityNameComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    341       this.qualityNameComboBox.FormattingEnabled = true;
    342       this.qualityNameComboBox.Location = new System.Drawing.Point(281, 6);
    343       this.qualityNameComboBox.Name = "qualityNameComboBox";
    344       this.qualityNameComboBox.Size = new System.Drawing.Size(150, 21);
    345       this.qualityNameComboBox.TabIndex = 1;
    346       this.qualityNameComboBox.SelectedIndexChanged += new System.EventHandler(this.qualityNameComboBox_SelectedIndexChanged);
    347       //
    348       // solutionNameComboBox
    349       //
    350       this.solutionNameComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    351       this.solutionNameComboBox.FormattingEnabled = true;
    352       this.solutionNameComboBox.Location = new System.Drawing.Point(60, 6);
    353       this.solutionNameComboBox.Name = "solutionNameComboBox";
    354       this.solutionNameComboBox.Size = new System.Drawing.Size(150, 21);
    355       this.solutionNameComboBox.TabIndex = 1;
    356       this.solutionNameComboBox.SelectedIndexChanged += new System.EventHandler(this.solutionNameComboBox_SelectedIndexChanged);
     255      this.similarityComboBox.SelectedIndexChanged += new System.EventHandler(this.SimilarityComboBoxOnSelectedIndexChanged);
    357256      //
    358257      // solutionsTabControl
    359258      //
     259      this.solutionsTabControl.AllowDrop = true;
    360260      this.solutionsTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    361261            | System.Windows.Forms.AnchorStyles.Left)
    362262            | System.Windows.Forms.AnchorStyles.Right)));
    363       this.solutionsTabControl.Controls.Add(this.solutionsListTabPage);
     263      this.solutionsTabControl.Controls.Add(this.solutionsSeedingTabPage);
    364264      this.solutionsTabControl.Controls.Add(this.solutionsQualityTabPage);
    365265      this.solutionsTabControl.Controls.Add(this.solutionsDiversityTabPage);
     
    373273      this.solutionsTabControl.TabIndex = 0;
    374274      //
    375       // solutionsListTabPage
    376       //
    377       this.solutionsListTabPage.Controls.Add(this.solutionsViewHost);
    378       this.solutionsListTabPage.Location = new System.Drawing.Point(4, 22);
    379       this.solutionsListTabPage.Name = "solutionsListTabPage";
    380       this.solutionsListTabPage.Padding = new System.Windows.Forms.Padding(3);
    381       this.solutionsListTabPage.Size = new System.Drawing.Size(667, 366);
    382       this.solutionsListTabPage.TabIndex = 0;
    383       this.solutionsListTabPage.Text = "List";
    384       this.solutionsListTabPage.UseVisualStyleBackColor = true;
    385       //
    386       // solutionsViewHost
    387       //
    388       this.solutionsViewHost.Caption = "View";
    389       this.solutionsViewHost.Content = null;
    390       this.solutionsViewHost.Dock = System.Windows.Forms.DockStyle.Fill;
    391       this.solutionsViewHost.Enabled = false;
    392       this.solutionsViewHost.Location = new System.Drawing.Point(3, 3);
    393       this.solutionsViewHost.Name = "solutionsViewHost";
    394       this.solutionsViewHost.ReadOnly = false;
    395       this.solutionsViewHost.Size = new System.Drawing.Size(661, 360);
    396       this.solutionsViewHost.TabIndex = 0;
    397       this.solutionsViewHost.ViewsLabelVisible = true;
    398       this.solutionsViewHost.ViewType = null;
     275      // solutionsSeedingTabPage
     276      //
     277      this.solutionsSeedingTabPage.Controls.Add(this.solutionsSeedingTableLayoutPanel);
     278      this.solutionsSeedingTabPage.Location = new System.Drawing.Point(4, 22);
     279      this.solutionsSeedingTabPage.Name = "solutionsSeedingTabPage";
     280      this.solutionsSeedingTabPage.Padding = new System.Windows.Forms.Padding(3);
     281      this.solutionsSeedingTabPage.Size = new System.Drawing.Size(667, 366);
     282      this.solutionsSeedingTabPage.TabIndex = 6;
     283      this.solutionsSeedingTabPage.Text = "Seeding";
     284      this.solutionsSeedingTabPage.UseVisualStyleBackColor = true;
    399285      //
    400286      // solutionsQualityTabPage
     
    511397      // solutionsNetworkChart
    512398      //
     399      chartArea1.AxisX.IsStartedFromZero = false;
    513400      chartArea1.AxisX.LabelStyle.Enabled = false;
    514401      chartArea1.AxisX.LineWidth = 0;
    515402      chartArea1.AxisX.MajorGrid.Enabled = false;
    516403      chartArea1.AxisX.MajorTickMark.Enabled = false;
     404      chartArea1.AxisY.IsStartedFromZero = false;
    517405      chartArea1.AxisY.LabelStyle.Enabled = false;
    518406      chartArea1.AxisY.LineWidth = 0;
     
    540428      this.solutionsNetworkChart.Text = "enhancedChart1";
    541429      //
     430      // solversTabPage
     431      //
     432      this.solversTabPage.Controls.Add(this.solversSplitContainer);
     433      this.solversTabPage.Controls.Add(this.algorithmCloneButton);
     434      this.solversTabPage.Controls.Add(this.algorithmStartButton);
     435      this.solversTabPage.Controls.Add(this.algorithmSuggestionLabel);
     436      this.solversTabPage.Controls.Add(this.suggestedInstancesComboBox);
     437      this.solversTabPage.Location = new System.Drawing.Point(4, 22);
     438      this.solversTabPage.Name = "solversTabPage";
     439      this.solversTabPage.Padding = new System.Windows.Forms.Padding(3);
     440      this.solversTabPage.Size = new System.Drawing.Size(681, 428);
     441      this.solversTabPage.TabIndex = 4;
     442      this.solversTabPage.Text = "Solvers";
     443      this.solversTabPage.UseVisualStyleBackColor = true;
     444      //
     445      // solversSplitContainer
     446      //
     447      this.solversSplitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     448            | System.Windows.Forms.AnchorStyles.Left)
     449            | System.Windows.Forms.AnchorStyles.Right)));
     450      this.solversSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
     451      this.solversSplitContainer.Location = new System.Drawing.Point(3, 33);
     452      this.solversSplitContainer.Name = "solversSplitContainer";
     453      //
     454      // solversSplitContainer.Panel1
     455      //
     456      this.solversSplitContainer.Panel1.Controls.Add(this.solverParametersView);
     457      //
     458      // solversSplitContainer.Panel2
     459      //
     460      this.solversSplitContainer.Panel2.Controls.Add(this.solverResultsView);
     461      this.solversSplitContainer.Size = new System.Drawing.Size(675, 392);
     462      this.solversSplitContainer.SplitterDistance = 300;
     463      this.solversSplitContainer.TabIndex = 4;
     464      //
     465      // solverParametersView
     466      //
     467      this.solverParametersView.AllowEditingOfHiddenParameters = true;
     468      this.solverParametersView.Caption = "ParameterCollection View";
     469      this.solverParametersView.Content = null;
     470      this.solverParametersView.Dock = System.Windows.Forms.DockStyle.Fill;
     471      this.solverParametersView.Location = new System.Drawing.Point(0, 0);
     472      this.solverParametersView.Name = "solverParametersView";
     473      this.solverParametersView.ReadOnly = true;
     474      this.solverParametersView.ShowDetails = false;
     475      this.solverParametersView.Size = new System.Drawing.Size(300, 392);
     476      this.solverParametersView.TabIndex = 0;
     477      //
     478      // solverResultsView
     479      //
     480      this.solverResultsView.Caption = "ResultCollection View";
     481      this.solverResultsView.Content = null;
     482      this.solverResultsView.Dock = System.Windows.Forms.DockStyle.Fill;
     483      this.solverResultsView.Location = new System.Drawing.Point(0, 0);
     484      this.solverResultsView.Name = "solverResultsView";
     485      this.solverResultsView.ReadOnly = true;
     486      this.solverResultsView.ShowDetails = true;
     487      this.solverResultsView.Size = new System.Drawing.Size(371, 392);
     488      this.solverResultsView.TabIndex = 0;
     489      //
     490      // algorithmCloneButton
     491      //
     492      this.algorithmCloneButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     493      this.algorithmCloneButton.Location = new System.Drawing.Point(649, 5);
     494      this.algorithmCloneButton.Name = "algorithmCloneButton";
     495      this.algorithmCloneButton.Size = new System.Drawing.Size(26, 23);
     496      this.algorithmCloneButton.TabIndex = 3;
     497      this.algorithmCloneButton.Text = "Clone";
     498      this.algorithmCloneButton.UseVisualStyleBackColor = true;
     499      this.algorithmCloneButton.Click += new System.EventHandler(this.AlgorithmCloneButtonOnClick);
     500      //
     501      // algorithmStartButton
     502      //
     503      this.algorithmStartButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     504      this.algorithmStartButton.Location = new System.Drawing.Point(617, 5);
     505      this.algorithmStartButton.Name = "algorithmStartButton";
     506      this.algorithmStartButton.Size = new System.Drawing.Size(26, 23);
     507      this.algorithmStartButton.TabIndex = 3;
     508      this.algorithmStartButton.Text = "Start";
     509      this.algorithmStartButton.UseVisualStyleBackColor = true;
     510      this.algorithmStartButton.Click += new System.EventHandler(this.AlgorithmStartButtonOnClick);
     511      //
     512      // algorithmSuggestionLabel
     513      //
     514      this.algorithmSuggestionLabel.AutoSize = true;
     515      this.algorithmSuggestionLabel.Location = new System.Drawing.Point(6, 9);
     516      this.algorithmSuggestionLabel.Name = "algorithmSuggestionLabel";
     517      this.algorithmSuggestionLabel.Size = new System.Drawing.Size(99, 13);
     518      this.algorithmSuggestionLabel.TabIndex = 1;
     519      this.algorithmSuggestionLabel.Text = "Suggested Solvers:";
     520      //
     521      // suggestedInstancesComboBox
     522      //
     523      this.suggestedInstancesComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     524            | System.Windows.Forms.AnchorStyles.Right)));
     525      this.suggestedInstancesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     526      this.suggestedInstancesComboBox.FormattingEnabled = true;
     527      this.suggestedInstancesComboBox.Location = new System.Drawing.Point(111, 6);
     528      this.suggestedInstancesComboBox.Name = "suggestedInstancesComboBox";
     529      this.suggestedInstancesComboBox.Size = new System.Drawing.Size(500, 21);
     530      this.suggestedInstancesComboBox.TabIndex = 0;
     531      this.suggestedInstancesComboBox.SelectedIndexChanged += new System.EventHandler(this.SuggestedInstancesComboBoxOnSelectedIndexChanged);
     532      //
     533      // runsTabPage
     534      //
     535      this.runsTabPage.Controls.Add(this.runsView);
     536      this.runsTabPage.Location = new System.Drawing.Point(4, 22);
     537      this.runsTabPage.Name = "runsTabPage";
     538      this.runsTabPage.Padding = new System.Windows.Forms.Padding(3);
     539      this.runsTabPage.Size = new System.Drawing.Size(681, 428);
     540      this.runsTabPage.TabIndex = 3;
     541      this.runsTabPage.Text = "Runs";
     542      this.runsTabPage.UseVisualStyleBackColor = true;
     543      //
     544      // runsView
     545      //
     546      this.runsView.Caption = "RunCollection View";
     547      this.runsView.Content = null;
     548      this.runsView.Dock = System.Windows.Forms.DockStyle.Fill;
     549      this.runsView.Location = new System.Drawing.Point(3, 3);
     550      this.runsView.Name = "runsView";
     551      this.runsView.ReadOnly = false;
     552      this.runsView.Size = new System.Drawing.Size(675, 422);
     553      this.runsView.TabIndex = 1;
     554      //
    542555      // okbTabPage
    543556      //
     
    567580      // problemInstancesTabPage
    568581      //
    569       this.problemInstancesTabPage.Controls.Add(this.label1);
     582      this.problemInstancesTabPage.Controls.Add(this.projectionLabel);
    570583      this.problemInstancesTabPage.Controls.Add(this.projectionComboBox);
    571584      this.problemInstancesTabPage.Controls.Add(this.problemInstancesTabControl);
     
    579592      this.problemInstancesTabPage.UseVisualStyleBackColor = true;
    580593      //
    581       // label1
    582       //
    583       this.label1.AutoSize = true;
    584       this.label1.Location = new System.Drawing.Point(35, 11);
    585       this.label1.Name = "label1";
    586       this.label1.Size = new System.Drawing.Size(57, 13);
    587       this.label1.TabIndex = 6;
    588       this.label1.Text = "Projection:";
     594      // projectionLabel
     595      //
     596      this.projectionLabel.AutoSize = true;
     597      this.projectionLabel.Location = new System.Drawing.Point(35, 11);
     598      this.projectionLabel.Name = "projectionLabel";
     599      this.projectionLabel.Size = new System.Drawing.Size(57, 13);
     600      this.projectionLabel.TabIndex = 6;
     601      this.projectionLabel.Text = "Projection:";
    589602      //
    590603      // projectionComboBox
     
    600613      // problemInstancesTabControl
    601614      //
     615      this.problemInstancesTabControl.AllowDrop = true;
    602616      this.problemInstancesTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    603617            | System.Windows.Forms.AnchorStyles.Left)
     
    719733      this.openFileDialog.Title = "Open Optimizer";
    720734      //
     735      // solutionsSeedingTableLayoutPanel
     736      //
     737      this.solutionsSeedingTableLayoutPanel.ColumnCount = 1;
     738      this.solutionsSeedingTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
     739      this.solutionsSeedingTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
     740      this.solutionsSeedingTableLayoutPanel.Location = new System.Drawing.Point(3, 3);
     741      this.solutionsSeedingTableLayoutPanel.Name = "solutionsSeedingTableLayoutPanel";
     742      this.solutionsSeedingTableLayoutPanel.RowCount = 2;
     743      this.solutionsSeedingTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
     744      this.solutionsSeedingTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
     745      this.solutionsSeedingTableLayoutPanel.Size = new System.Drawing.Size(661, 360);
     746      this.solutionsSeedingTableLayoutPanel.TabIndex = 0;
     747      //
    721748      // ExpertSystemView
    722749      //
     
    740767      this.tabControl.ResumeLayout(false);
    741768      this.problemTabPage.ResumeLayout(false);
    742       this.algorithmTabPage.ResumeLayout(false);
    743       this.algorithmTabPage.PerformLayout();
    744       this.runsTabPage.ResumeLayout(false);
    745769      this.solutionsTabPage.ResumeLayout(false);
    746770      this.solutionsTabPage.PerformLayout();
    747771      this.solutionsTabControl.ResumeLayout(false);
    748       this.solutionsListTabPage.ResumeLayout(false);
     772      this.solutionsSeedingTabPage.ResumeLayout(false);
    749773      this.solutionsQualityTabPage.ResumeLayout(false);
    750774      this.solutionsDiversityTabPage.ResumeLayout(false);
     
    753777      this.solutionsNetworkTabPage.ResumeLayout(false);
    754778      ((System.ComponentModel.ISupportInitialize)(this.solutionsNetworkChart)).EndInit();
     779      this.solversTabPage.ResumeLayout(false);
     780      this.solversTabPage.PerformLayout();
     781      this.solversSplitContainer.Panel1.ResumeLayout(false);
     782      this.solversSplitContainer.Panel2.ResumeLayout(false);
     783      ((System.ComponentModel.ISupportInitialize)(this.solversSplitContainer)).EndInit();
     784      this.solversSplitContainer.ResumeLayout(false);
     785      this.runsTabPage.ResumeLayout(false);
    755786      this.okbTabPage.ResumeLayout(false);
    756787      this.problemInstancesTabPage.ResumeLayout(false);
     
    775806    private System.Windows.Forms.TabPage problemTabPage;
    776807    private MainForm.WindowsForms.ViewHost problemViewHost;
    777     private System.Windows.Forms.TabPage algorithmTabPage;
    778     private MainForm.WindowsForms.ViewHost algorithmViewHost;
     808    private System.Windows.Forms.TabPage solversTabPage;
    779809    private System.Windows.Forms.Label algorithmSuggestionLabel;
    780810    private System.Windows.Forms.ComboBox suggestedInstancesComboBox;
     
    786816    private MainForm.WindowsForms.ViewHost kbViewHost;
    787817    private System.Windows.Forms.Button algorithmStartButton;
    788     private System.Windows.Forms.TabControl problemInstancesTabControl;
     818    private HeuristicLab.MainForm.WindowsForms.DragOverTabControl problemInstancesTabControl;
    789819    private System.Windows.Forms.TabPage instancesTabPage;
    790820    private MainForm.WindowsForms.ViewHost problemInstancesView;
    791821    private System.Windows.Forms.TabPage mapTabPage;
    792822    private Visualization.ChartControlsExtensions.EnhancedChart instanceMapChart;
    793     private System.Windows.Forms.Label label1;
     823    private System.Windows.Forms.Label projectionLabel;
    794824    private System.Windows.Forms.ComboBox projectionComboBox;
    795825    private System.Windows.Forms.TabPage solutionsTabPage;
    796     private System.Windows.Forms.TabControl solutionsTabControl;
    797     private System.Windows.Forms.TabPage solutionsListTabPage;
     826    private HeuristicLab.MainForm.WindowsForms.DragOverTabControl solutionsTabControl;
    798827    private System.Windows.Forms.TabPage solutionsQualityTabPage;
    799828    private System.Windows.Forms.TabPage solutionsDiversityTabPage;
    800     private System.Windows.Forms.Label qualityNameLabel;
    801     private System.Windows.Forms.Label solutionNameLabel;
    802     private System.Windows.Forms.ComboBox qualityNameComboBox;
    803     private System.Windows.Forms.ComboBox solutionNameComboBox;
    804829    private MainForm.WindowsForms.ViewHost solutionsQualityViewHost;
    805     private MainForm.WindowsForms.ViewHost solutionsViewHost;
    806830    private MainForm.WindowsForms.ViewHost solutionsDiversityViewHost;
    807831    private System.Windows.Forms.Label solutionDiversitySimilarityLabel;
     
    814838    private Visualization.ChartControlsExtensions.EnhancedChart solutionsNetworkChart;
    815839    private System.Windows.Forms.Button algorithmCloneButton;
     840    private System.Windows.Forms.SplitContainer solversSplitContainer;
     841    private Core.Views.ParameterCollectionView solverParametersView;
     842    private Optimization.Views.ResultCollectionView solverResultsView;
     843    private System.Windows.Forms.Label solutionNameLabel;
     844    private System.Windows.Forms.ComboBox solutionNameComboBox;
     845    private System.Windows.Forms.TabPage solutionsSeedingTabPage;
     846    private System.Windows.Forms.TableLayoutPanel solutionsSeedingTableLayoutPanel;
    816847  }
    817848}
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/ExpertSystemView.cs

    r13668 r13713  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2222using HeuristicLab.Analysis;
    2323using HeuristicLab.Analysis.QualityAnalysis;
     24using HeuristicLab.Clients.OKB.RunCreation;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Common.Resources;
     27using HeuristicLab.Core;
    2628using HeuristicLab.Core.Views;
    2729using HeuristicLab.Data;
     30using HeuristicLab.Data.Views;
    2831using HeuristicLab.MainForm;
    2932using HeuristicLab.Optimization;
     
    3740using System.Windows.Forms;
    3841using System.Windows.Forms.DataVisualization.Charting;
     42using DoubleValue = HeuristicLab.Data.DoubleValue;
    3943
    4044namespace HeuristicLab.OptimizationExpertSystem {
     
    4246  [Content(typeof(ExpertSystem), IsDefaultView = true)]
    4347  public partial class ExpertSystemView : NamedItemView {
    44     protected TypeSelectorDialog problemTypeSelectorDialog;
     48    private EnumValueView<SeedingStrategyTypes> seedingStrategyView;
     49    private CheckedItemListView<IScope> seedingSolutionsView;
    4550    protected virtual bool SuppressEvents { get; set; }
    4651    private bool okbDownloadInProgress;
     
    6166      refreshMapButton.Text = string.Empty;
    6267      refreshMapButton.Image = VSImageLibrary.Refresh;
    63     }
    64 
    65     protected override void Dispose(bool disposing) {
    66       if (disposing) {
    67         if (problemTypeSelectorDialog != null) problemTypeSelectorDialog.Dispose();
    68         if (components != null) components.Dispose();
    69       }
    70       base.Dispose(disposing);
    71     }
    72 
     68      seedingStrategyView = new EnumValueView<SeedingStrategyTypes>() {
     69        Dock = DockStyle.Fill
     70      };
     71      seedingSolutionsView = new CheckedItemListView<IScope>() {
     72        Dock = DockStyle.Fill
     73      };
     74      solutionsSeedingTableLayoutPanel.SuspendLayout();
     75      solutionsSeedingTableLayoutPanel.Controls.Add(seedingStrategyView, 0, 0);
     76      solutionsSeedingTableLayoutPanel.Controls.Add(seedingSolutionsView, 0, 1);
     77      solutionsSeedingTableLayoutPanel.ResumeLayout(true);
     78    }
     79
     80    #region Event Registration
    7381    protected override void DeregisterContentEvents() {
    7482      Content.PropertyChanged -= ContentOnPropertyChanged;
     
    7886      Content.SuggestedInstances.ItemsRemoved -= SuggestedInstancesOnChanged;
    7987      Content.SuggestedInstances.ItemsReplaced -= SuggestedInstancesOnChanged;
    80       Content.SolutionPool.ItemsAdded -= SolutionPoolOnChanged;
    81       Content.SolutionPool.ItemsRemoved -= SolutionPoolOnChanged;
    82       Content.SolutionPool.ItemsReplaced -= SolutionPoolOnChanged;
    83       Content.SolutionPool.CollectionReset -= SolutionPoolOnChanged;
    84       if (Content.Problem != null) Content.Problem.ProblemChanged -= ContentOnProblemChanged;
     88      DeregisterProblemEvents(Content.Problem);
    8589      base.DeregisterContentEvents();
    8690    }
     91
    8792    protected override void RegisterContentEvents() {
    8893      base.RegisterContentEvents();
     
    9398      Content.SuggestedInstances.ItemsRemoved += SuggestedInstancesOnChanged;
    9499      Content.SuggestedInstances.ItemsReplaced += SuggestedInstancesOnChanged;
    95       Content.SolutionPool.ItemsAdded += SolutionPoolOnChanged;
    96       Content.SolutionPool.ItemsRemoved += SolutionPoolOnChanged;
    97       Content.SolutionPool.ItemsReplaced += SolutionPoolOnChanged;
    98       Content.SolutionPool.CollectionReset += SolutionPoolOnChanged;
    99       if (Content.Problem != null) Content.Problem.ProblemChanged += ContentOnProblemChanged;
    100     }
     100      RegisterProblemEvents(Content.Problem);
     101    }
     102
     103    private void DeregisterProblemEvents(OKBProblem problem) {
     104      if (problem == null) return;
     105      problem.Solutions.ItemsAdded -= SolutionsOnChanged;
     106      problem.Solutions.ItemsRemoved -= SolutionsOnChanged;
     107      problem.Solutions.ItemsReplaced -= SolutionsOnChanged;
     108      problem.Solutions.CollectionReset -= SolutionsOnChanged;
     109      problem.ProblemChanged -= ContentOnProblemChanged;
     110    }
     111
     112    private void RegisterProblemEvents(OKBProblem problem) {
     113      if (problem == null) return;
     114      problem.Solutions.ItemsAdded += SolutionsOnChanged;
     115      problem.Solutions.ItemsRemoved += SolutionsOnChanged;
     116      problem.Solutions.ItemsReplaced += SolutionsOnChanged;
     117      problem.Solutions.CollectionReset += SolutionsOnChanged;
     118      problem.ProblemChanged += ContentOnProblemChanged;
     119    }
     120    #endregion
    101121
    102122    protected override void OnContentChanged() {
     
    107127        if (Content == null) {
    108128          maxEvaluationsTextBox.Text = String.Empty;
    109 
    110129          problemViewHost.Content = null;
    111           algorithmViewHost.Content = null;
     130          solverParametersView.Content = null;
     131          solverResultsView.Content = null;
    112132          runsView.Content = null;
    113           solutionsViewHost.Content = null;
    114133          kbViewHost.Content = null;
    115134          problemInstancesView.Content = null;
     135          seedingStrategyView.Content = null;
     136          seedingSolutionsView.Content = null;
    116137        } else {
    117138          maxEvaluationsTextBox.Text = Content.MaximumEvaluations.ToString();
    118139          problemViewHost.Content = Content.Problem;
    119140          runsView.Content = Content.Runs;
    120           solutionsViewHost.Content = Content.SolutionPool;
    121141          kbViewHost.ViewType = typeof(RunCollectionRLDView);
    122142          kbViewHost.Content = Content.KnowledgeBase;
    123143          problemInstancesView.Content = Content.ProblemInstances;
    124           algorithmViewHost.Content = Content.CurrentResult;
     144          solverResultsView.Content = Content.CurrentResult;
     145          seedingStrategyView.Content = Content.SeedingStrategy;
     146          seedingSolutionsView.Content = Content.SolutionSeedingPool;
    125147        }
    126148      } finally { SuppressEvents = false; }
    127149      UpdateSuggestedInstancesCombobox();
     150      UpdateSimilarityCalculators();
    128151      UpdateNamesComboboxes();
    129       UpdateSimilarityCalculators();
    130152    }
    131153
     
    137159      algorithmStartButton.Enabled = Content != null && !ReadOnly && !Locked && suggestedInstancesComboBox.SelectedIndex >= 0;
    138160      algorithmCloneButton.Enabled = Content != null && !ReadOnly && !Locked && suggestedInstancesComboBox.SelectedIndex >= 0;
    139       algorithmViewHost.Enabled = Content != null && !ReadOnly && !Locked;
    140161      runsView.Enabled = Content != null;
    141162      kbViewHost.Enabled = Content != null && !okbDownloadInProgress;
     
    143164      refreshMapButton.Enabled = Content != null;
    144165      okbDownloadButton.Enabled = Content != null && Content.Problem != null && Content.Problem.ProblemId >= 0 && !ReadOnly && !Locked && !okbDownloadInProgress;
    145     }
    146 
    147     private void UpdateSuggestedInstancesCombobox() {
    148       var prevSelection = (IAlgorithm)suggestedInstancesComboBox.SelectedItem;
    149       var prevNewIndex = -1;
    150       suggestedInstancesComboBox.Items.Clear();
    151       if (Content == null) return;
    152 
    153       for (var i = 0; i < Content.SuggestedInstances.Count; i++) {
    154         suggestedInstancesComboBox.Items.Add(Content.SuggestedInstances[i]);
    155         if (prevSelection == null || Content.SuggestedInstances[i].Name == prevSelection.Name)
    156           prevNewIndex = prevSelection == null ? 0 : i;
    157       }
    158       if (prevNewIndex >= 0) {
    159         suggestedInstancesComboBox.SelectedIndex = prevNewIndex;
    160       }
    161     }
    162 
    163     private void UpdateNamesComboboxes() {
    164       var selectedSolutionName = solutionNameComboBox.SelectedIndex >= 0 ? (string)solutionNameComboBox.SelectedItem : string.Empty;
    165       var selectedQualityName = qualityNameComboBox.SelectedIndex >= 0 ? (string)qualityNameComboBox.SelectedItem : string.Empty;
    166 
    167       solutionNameComboBox.Items.Clear();
    168       qualityNameComboBox.Items.Clear();
    169       if (Content == null) return;
    170       var qualityNames = new HashSet<string>(Content.SolutionPool.SelectMany(x => x.Variables).Where(x => x.Value is DoubleValue).Select(x => x.Name));
    171       var solutionNames = Content.SolutionPool.SelectMany(x => x.Variables).Where(x => !qualityNames.Contains(x.Name));
    172 
    173       foreach (var sn in solutionNames.GroupBy(x => x.Name).OrderBy(x => x.Key)) {
    174         solutionNameComboBox.Items.Add(sn.Key);
    175         // either it was previously selected, or the variable value is defined in the HeuristicLab.Encodings sub-namespace
    176         if (sn.Key == selectedSolutionName || (string.IsNullOrEmpty(selectedSolutionName) && sn.All(x => x.Value != null && x.Value.GetType().FullName.StartsWith("HeuristicLab.Encodings."))))
    177           solutionNameComboBox.SelectedItem = sn.Key;
    178       }
    179       foreach (var qn in qualityNames.OrderBy(x => x)) {
    180         qualityNameComboBox.Items.Add(qn);
    181         if (qn == selectedQualityName || string.IsNullOrEmpty(selectedQualityName)) qualityNameComboBox.SelectedItem = qn;
    182       }
    183     }
    184 
    185     private void UpdateSimilarityCalculators() {
    186       var selected = (ISolutionSimilarityCalculator)(similarityComboBox.SelectedIndex >= 0 ? similarityComboBox.SelectedItem : null);
    187       similarityComboBox.Items.Clear();
    188      
    189       if (Content == null || Content.Problem == null) return;
    190 
    191       foreach (var calc in Content.Problem.Operators.OfType<ISolutionSimilarityCalculator>()) {
    192         similarityComboBox.Items.Add(calc);
    193         if (selected != null && calc.ItemName == selected.ItemName) similarityComboBox.SelectedItem = calc;
    194       }
    195       if (selected == null && similarityComboBox.Items.Count > 0)
    196         similarityComboBox.SelectedIndex = 0;
    197166    }
    198167
     
    216185          case "MaximumEvaluations": maxEvaluationsTextBox.Text = Content.MaximumEvaluations.ToString(); break;
    217186          case "Problem":
     187            DeregisterProblemEvents(problemViewHost.Content as OKBProblem);
    218188            problemViewHost.Content = Content.Problem;
    219             Content.Problem.ProblemChanged += ContentOnProblemChanged;
     189            RegisterProblemEvents(Content.Problem);
     190            UpdateNamesComboboxes();
    220191            break;
    221192          case "ProblemInstances": problemInstancesView.Content = Content.ProblemInstances; break;
    222           case "CurrentResult": algorithmViewHost.Content = Content.CurrentResult; break;
     193          case "CurrentResult": solverResultsView.Content = Content.CurrentResult; break;
    223194        }
    224195      } finally { SuppressEvents = false; }
     
    230201    }
    231202
    232     private void SolutionPoolOnChanged(object sender, EventArgs e) {
     203    private void SolutionsOnChanged(object sender, EventArgs e) {
    233204      UpdateNamesComboboxes();
    234       if (qualityNameComboBox.SelectedIndex >= 0) {
    235         var qualityName = (string)qualityNameComboBox.SelectedItem;
    236         UpdateSolutionQualityAnalysis(qualityName);
    237       }
    238       if (similarityComboBox.SelectedIndex >= 0) {
    239         var calculator = (ISolutionSimilarityCalculator)similarityComboBox.SelectedItem;
    240         UpdateSolutionDiversityAnalysis(calculator);
    241         UpdateSolutionFdcAnalysis(calculator);
    242         UpdateSolutionLengthScaleAnalysis(calculator);
    243         UpdateSolutionNetworkAnalysis(calculator);
    244       } else solutionsDiversityViewHost.Content = null;
     205      UpdateSolutionVisualization();
    245206    }
    246207    #endregion
     
    263224      }
    264225    }
    265     #endregion
    266     #endregion
    267226
    268227    private void RefreshMapButtonOnClick(object sender, EventArgs e) {
    269228      Content.UpdateInstanceProjection();
    270229      UpdateProjectionComboBox();
    271     }
    272 
    273     private void UpdateProjectionComboBox() {
    274       projectionComboBox.Items.Clear();
    275       var projStrings = Content.ProblemInstances
    276         .SelectMany(x => x.Results.Where(y => Regex.IsMatch(y.Key, "^Projection[.].*[.][XY]$")))
    277         .Select(x => Regex.Match(x.Key, "Projection[.](?<g>.*)[.][XY]").Groups["g"].Value)
    278         .Distinct();
    279       foreach (var str in projStrings) {
    280         projectionComboBox.Items.Add(str);
    281       }
    282230    }
    283231
     
    295243    }
    296244
    297     private void OkbDownloadProgressOnStateChanged(object sender, EventArgs eventArgs) {
     245    private void OkbDownloadProgressOnStateChanged(object sender, EventArgs e) {
     246      if (InvokeRequired) { Invoke((Action<object, EventArgs>)OkbDownloadProgressOnStateChanged, sender, e); return; }
    298247      var progress = (IProgress)sender;
    299248      okbDownloadInProgress = progress.ProgressState == ProgressState.Started;
     
    316265
    317266    private void ProjectionComboBoxOnSelectedIndexChanged(object sender, EventArgs e) {
     267      if (InvokeRequired) { Invoke((Action<object, EventArgs>)ProjectionComboBoxOnSelectedIndexChanged, sender, e); return; }
    318268      if (projectionComboBox.SelectedIndex < 0) return;
    319269      var projection = (string)projectionComboBox.SelectedItem;
     
    346296    }
    347297
     298    private void SuggestedInstancesComboBoxOnSelectedIndexChanged(object sender, EventArgs e) {
     299      if (InvokeRequired) { Invoke((Action<object, EventArgs>)SuggestedInstancesComboBoxOnSelectedIndexChanged, sender, e); return; }
     300      if (suggestedInstancesComboBox.SelectedIndex >= 0) {
     301        solverParametersView.Content = Content.SuggestedInstances[suggestedInstancesComboBox.SelectedIndex].Parameters;
     302      } else solverParametersView.Content = null;
     303      SetEnabledStateOfControls();
     304    }
     305
     306    private void SimilarityComboBoxOnSelectedIndexChanged(object sender, EventArgs e) {
     307      if (InvokeRequired) { Invoke((Action<object, EventArgs>)SimilarityComboBoxOnSelectedIndexChanged, sender, e); return; }
     308      var calculator = (ISolutionSimilarityCalculator)similarityComboBox.SelectedItem;
     309      if (calculator != null) {
     310        calculator.SolutionVariableName = (string)solutionNameComboBox.SelectedItem;
     311        calculator.QualityVariableName = Content.Problem.Problem.Evaluator.QualityParameter.ActualName;
     312      }
     313      UpdateSolutionDiversityAnalysis(calculator);
     314      UpdateSolutionFdcAnalysis(calculator);
     315      UpdateSolutionLengthScaleAnalysis(calculator);
     316      UpdateSolutionNetworkAnalysis(calculator);
     317    }
     318    #endregion
     319    #endregion
     320
     321    #region Control Configuration
     322    private void UpdateSuggestedInstancesCombobox() {
     323      var prevSelection = (IAlgorithm)suggestedInstancesComboBox.SelectedItem;
     324      var prevNewIndex = -1;
     325      suggestedInstancesComboBox.Items.Clear();
     326      if (Content == null) return;
     327
     328      for (var i = 0; i < Content.SuggestedInstances.Count; i++) {
     329        suggestedInstancesComboBox.Items.Add(Content.SuggestedInstances[i]);
     330        if (prevSelection == null || Content.SuggestedInstances[i].Name == prevSelection.Name)
     331          prevNewIndex = prevSelection == null ? 0 : i;
     332      }
     333      if (prevNewIndex >= 0) {
     334        suggestedInstancesComboBox.SelectedIndex = prevNewIndex;
     335      }
     336    }
     337
     338    private void UpdateSimilarityCalculators() {
     339      var selected = (ISolutionSimilarityCalculator)(similarityComboBox.SelectedIndex >= 0 ? similarityComboBox.SelectedItem : null);
     340      similarityComboBox.Items.Clear();
     341
     342      if (Content == null || Content.Problem == null) return;
     343
     344      foreach (var calc in Content.Problem.Operators.OfType<ISolutionSimilarityCalculator>()) {
     345        similarityComboBox.Items.Add(calc);
     346        if (selected != null && calc.ItemName == selected.ItemName) similarityComboBox.SelectedItem = calc;
     347      }
     348      if (selected == null && similarityComboBox.Items.Count > 0)
     349        similarityComboBox.SelectedIndex = 0;
     350    }
     351
     352    private void UpdateNamesComboboxes() {
     353      var selectedSolutionName = solutionNameComboBox.SelectedIndex >= 0 ? (string)solutionNameComboBox.SelectedItem : string.Empty;
     354
     355      solutionNameComboBox.Items.Clear();
     356      if (Content == null) return;
     357      var solutionNames = Content.Problem.Solutions.Select(x => x.Solution).OfType<IScope>().SelectMany(x => x.Variables);
     358
     359      foreach (var sn in solutionNames.GroupBy(x => x.Name).OrderBy(x => x.Key)) {
     360        solutionNameComboBox.Items.Add(sn.Key);
     361        // either it was previously selected, or the variable value is defined in the HeuristicLab.Encodings sub-namespace
     362        if (sn.Key == selectedSolutionName || (string.IsNullOrEmpty(selectedSolutionName) && sn.All(x => x.Value != null && x.Value.GetType().FullName.StartsWith("HeuristicLab.Encodings."))))
     363          solutionNameComboBox.SelectedItem = sn.Key;
     364      }
     365    }
     366   
     367    private void UpdateProjectionComboBox() {
     368      projectionComboBox.Items.Clear();
     369      var projStrings = Content.ProblemInstances
     370        .SelectMany(x => x.Results.Where(y => Regex.IsMatch(y.Key, "^Projection[.].*[.][XY]$")))
     371        .Select(x => Regex.Match(x.Key, "Projection[.](?<g>.*)[.][XY]").Groups["g"].Value)
     372        .Distinct();
     373      foreach (var str in projStrings) {
     374        projectionComboBox.Items.Add(str);
     375      }
     376    }
     377    #endregion
     378
     379    #region Visualization
     380    #region Solution Visualization
     381    public void UpdateSolutionVisualization() {
     382      if (InvokeRequired) { Invoke((Action)UpdateSolutionVisualization); return;  }
     383      var qualityName = Content.Problem.Problem.Evaluator.QualityParameter.ActualName;
     384      UpdateSolutionQualityAnalysis(qualityName);
     385      if (similarityComboBox.SelectedIndex >= 0) {
     386        var calculator = (ISolutionSimilarityCalculator)similarityComboBox.SelectedItem;
     387        UpdateSolutionDiversityAnalysis(calculator);
     388        UpdateSolutionFdcAnalysis(calculator);
     389        UpdateSolutionLengthScaleAnalysis(calculator);
     390        UpdateSolutionNetworkAnalysis(calculator);
     391      } else {
     392        solutionsDiversityViewHost.Content = null;
     393        solutionsFdcViewHost.Content = null;
     394        solutionsLengthScaleViewHost.Content = null;
     395        solutionsNetworkChart.Series.First().Points.Clear();
     396      }
     397    }
    348398    private void UpdateSolutionQualityAnalysis(string qualityName) {
    349399      var dt = solutionsQualityViewHost.Content as DataTable;
    350400      if (dt == null) {
    351401        dt = QualityDistributionAnalyzer.PrepareTable(qualityName);
     402        dt.VisualProperties.Title = "Quality Distribution";
    352403        solutionsQualityViewHost.Content = dt;
    353404      }
    354       QualityDistributionAnalyzer.UpdateTable(dt, Content.SolutionPool.Where(x => x.Variables.ContainsKey(qualityName)).Select(x => x.Variables[qualityName].Value).OfType<DoubleValue>().Select(x => x.Value));
     405      QualityDistributionAnalyzer.UpdateTable(dt, Content.Problem.Solutions.Select(x => x.Solution).OfType<IScope>().Where(x => x.Variables.ContainsKey(qualityName)).Select(x => x.Variables[qualityName].Value).OfType<DoubleValue>().Select(x => x.Value));
    355406    }
    356407
     
    358409      try {
    359410        solutionsDiversityViewHost.Content = null;
    360         if (Content.SolutionPool == null) return;
    361         var similarities = new double[Content.SolutionPool.Count, Content.SolutionPool.Count];
    362         for (int i = 0; i < Content.SolutionPool.Count; i++) {
    363           for (int j = 0; j < Content.SolutionPool.Count; j++)
    364             similarities[i, j] = calculator.CalculateSolutionSimilarity(Content.SolutionPool[i], Content.SolutionPool[j]);
     411        var similarities = new double[Content.Problem.Solutions.Count, Content.Problem.Solutions.Count];
     412        for (int i = 0; i < Content.Problem.Solutions.Count; i++) {
     413          for (int j = 0; j < Content.Problem.Solutions.Count; j++)
     414            similarities[i, j] = calculator.CalculateSolutionSimilarity((IScope)Content.Problem.Solutions[i].Solution, (IScope)Content.Problem.Solutions[j].Solution);
    365415        }
    366416        var hm = new HeatMap(similarities, "Solution Similarities", 0.0, 1.0);
     
    372422      try {
    373423        solutionsFdcViewHost.Content = null;
    374         if (Content.SolutionPool == null) return;
    375424        var points = new List<Point2D<double>>();
    376         for (int i = 0; i < Content.SolutionPool.Count; i++) {
    377           for (int j = 0; j < Content.SolutionPool.Count; j++) {
     425        for (int i = 0; i < Content.Problem.Solutions.Count; i++) {
     426          for (int j = 0; j < Content.Problem.Solutions.Count; j++) {
    378427            if (i == j) continue;
    379             var qDiff = Math.Abs(((DoubleValue)Content.SolutionPool[i].Variables[calculator.QualityVariableName].Value).Value - ((DoubleValue)Content.SolutionPool[j].Variables[calculator.QualityVariableName].Value).Value);
    380             points.Add(new Point2D<double>(qDiff, 1.0 - calculator.CalculateSolutionSimilarity(Content.SolutionPool[i], Content.SolutionPool[j])));
     428            var qDiff = Math.Abs(((DoubleValue)((IScope)Content.Problem.Solutions[i].Solution).Variables[calculator.QualityVariableName].Value).Value
     429              - ((DoubleValue)((IScope)Content.Problem.Solutions[j].Solution).Variables[calculator.QualityVariableName].Value).Value);
     430            points.Add(new Point2D<double>(qDiff, 1.0 - calculator.CalculateSolutionSimilarity((IScope)Content.Problem.Solutions[i].Solution, (IScope)Content.Problem.Solutions[j].Solution)));
    381431          }
    382432        }
    383433        var splot = new ScatterPlot("Fitness-Distance", "");
     434        splot.VisualProperties.XAxisTitle = "Absolute Fitness Difference";
     435        splot.VisualProperties.XAxisMinimumFixedValue = 0.0;
     436        splot.VisualProperties.YAxisTitle = "Solution Distance";
     437        splot.VisualProperties.YAxisMinimumFixedValue = 0.0;
     438        splot.VisualProperties.YAxisMaximumFixedValue = 1.0;
    384439        var row = new ScatterPlotDataRow("Fdc", "", points);
    385440        row.VisualProperties.PointSize = 7;
     
    392447      try {
    393448        solutionsLengthScaleViewHost.Content = null;
    394         if (Content.SolutionPool == null) return;
    395449        var dt = solutionsLengthScaleViewHost.Content as DataTable;
    396450        if (dt == null) {
     
    404458
    405459    private IEnumerable<double> CalculateLengthScale(ISolutionSimilarityCalculator calculator) {
    406       for (int i = 0; i < Content.SolutionPool.Count; i++) {
    407         for (int j = 0; j < Content.SolutionPool.Count; j++) {
     460      for (int i = 0; i < Content.Problem.Solutions.Count; i++) {
     461        for (int j = 0; j < Content.Problem.Solutions.Count; j++) {
    408462          if (i == j) continue;
    409           var sim = calculator.CalculateSolutionSimilarity(Content.SolutionPool[i], Content.SolutionPool[j]);
     463          var sim = calculator.CalculateSolutionSimilarity((IScope)Content.Problem.Solutions[i].Solution, (IScope)Content.Problem.Solutions[j].Solution);
    410464          if (sim.IsAlmost(0)) continue;
    411           var qDiff = Math.Abs(((DoubleValue)Content.SolutionPool[i].Variables[calculator.QualityVariableName].Value).Value - ((DoubleValue)Content.SolutionPool[j].Variables[calculator.QualityVariableName].Value).Value);
     465          var qDiff = Math.Abs(((DoubleValue)((IScope)Content.Problem.Solutions[i].Solution).Variables[calculator.QualityVariableName].Value).Value
     466            - ((DoubleValue)((IScope)Content.Problem.Solutions[j].Solution).Variables[calculator.QualityVariableName].Value).Value);
    412467          yield return qDiff / sim;
    413468        }
     
    419474        var series = solutionsNetworkChart.Series["SolutionSeries"];
    420475        series.Points.Clear();
    421         var dissimilarities = new DoubleMatrix(Content.SolutionPool.Count, Content.SolutionPool.Count);
    422         for (int i = 0; i < Content.SolutionPool.Count; i++) {
    423           for (int j = 0; j < Content.SolutionPool.Count; j++) {
     476        var dissimilarities = new DoubleMatrix(Content.Problem.Solutions.Count, Content.Problem.Solutions.Count);
     477        for (int i = 0; i < Content.Problem.Solutions.Count; i++) {
     478          for (int j = 0; j < Content.Problem.Solutions.Count; j++) {
    424479            if (i == j) continue;
    425             dissimilarities[i, j] = 1.0 - calculator.CalculateSolutionSimilarity(Content.SolutionPool[i], Content.SolutionPool[j]);
     480            dissimilarities[i, j] = 1.0 - calculator.CalculateSolutionSimilarity((IScope)Content.Problem.Solutions[i].Solution, (IScope)Content.Problem.Solutions[j].Solution);
    426481          }
    427482        }
    428483        var coords = MultidimensionalScaling.KruskalShepard(dissimilarities);
    429484        for (var i = 0; i < coords.Rows; i++) {
    430           var quality = ((DoubleValue)Content.SolutionPool[i].Variables[calculator.QualityVariableName].Value).Value;
     485          var quality = ((DoubleValue)((IScope)Content.Problem.Solutions[i].Solution).Variables[calculator.QualityVariableName].Value).Value;
    431486          series.Points.Add(new DataPoint() {
    432             Name = i.ToString(),
     487            Name = (i + 1).ToString(),
    433488            XValue = coords[i, 0],
    434489            YValues = new[] { coords[i, 1], quality },
     
    438493      } catch { }
    439494    }
    440 
    441     private void SuggestedInstancesComboBoxOnSelectedIndexChanged(object sender, EventArgs e) {
    442       SetEnabledStateOfControls();
    443     }
    444 
    445     private void qualityNameComboBox_SelectedIndexChanged(object sender, EventArgs e) {
    446       if (qualityNameComboBox.SelectedIndex < 0) return;
    447       solutionsQualityViewHost.Content = null;
    448       solutionsDiversityViewHost.Content = null;
    449       var qualityName = (string)qualityNameComboBox.SelectedItem;
    450       UpdateSolutionQualityAnalysis(qualityName);
    451       var calculator = (ISolutionSimilarityCalculator)similarityComboBox.SelectedItem;
    452       if (calculator != null) calculator.QualityVariableName = qualityName;
    453       UpdateSolutionDiversityAnalysis(calculator);
    454       UpdateSolutionFdcAnalysis(calculator);
    455       UpdateSolutionLengthScaleAnalysis(calculator);
    456       UpdateSolutionNetworkAnalysis(calculator);
    457     }
    458 
    459     private void solutionNameComboBox_SelectedIndexChanged(object sender, EventArgs e) {
    460       var calculator = (ISolutionSimilarityCalculator)similarityComboBox.SelectedItem;
    461       if (calculator != null) calculator.SolutionVariableName = (string)solutionNameComboBox.SelectedItem;
    462       UpdateSolutionDiversityAnalysis(calculator);
    463       UpdateSolutionFdcAnalysis(calculator);
    464       UpdateSolutionLengthScaleAnalysis(calculator);
    465       UpdateSolutionNetworkAnalysis(calculator);
    466     }
    467 
    468     private void similarityComboBox_SelectedIndexChanged(object sender, EventArgs e) {
    469       var calculator = (ISolutionSimilarityCalculator)similarityComboBox.SelectedItem;
    470       if (calculator != null) {
    471         calculator.SolutionVariableName = (string)solutionNameComboBox.SelectedItem;
    472         calculator.QualityVariableName = (string)qualityNameComboBox.SelectedItem;
    473       }
    474       UpdateSolutionDiversityAnalysis(calculator);
    475       UpdateSolutionFdcAnalysis(calculator);
    476       UpdateSolutionLengthScaleAnalysis(calculator);
    477       UpdateSolutionNetworkAnalysis(calculator);
    478     }
     495    #endregion
     496    #endregion
    479497  }
    480498}
Note: See TracChangeset for help on using the changeset viewer.