Changeset 11064 for branches/DataPreprocessing/HeuristicLab.Optimizer
- Timestamp:
- 07/01/14 10:53:46 (10 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 5 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing
- Property svn:mergeinfo changed
/trunk/sources merged: 11008,11012-11014,11019,11024-11027,11031,11034-11035,11048,11050-11052,11056-11058,11060
- Property svn:mergeinfo changed
-
branches/DataPreprocessing/HeuristicLab.Optimizer/3.3/FileManager.cs
r9901 r11064 25 25 using System.Windows.Forms; 26 26 using HeuristicLab.Common; 27 using HeuristicLab.Core; 27 28 using HeuristicLab.MainForm; 28 29 using HeuristicLab.PluginInfrastructure; … … 120 121 saveFileDialog.FilterIndex = 2; 121 122 } 122 saveFileDialog.FileName = string.IsNullOrEmpty(content.Filename) ? "Item" : content.Filename; 123 124 INamedItem namedItem = content as INamedItem; 125 string suggestedFileName = string.Empty; 126 if (!string.IsNullOrEmpty(content.Filename)) suggestedFileName = content.Filename; 127 else if (namedItem != null) suggestedFileName = namedItem.Name; 128 else suggestedFileName = "Item"; 129 130 saveFileDialog.FileName = suggestedFileName; 123 131 124 132 if (saveFileDialog.ShowDialog() == DialogResult.OK) { -
branches/DataPreprocessing/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj
r11009 r11064 130 130 <EmbeddedResource Include="Documents\GE_ArtificialAnt.hl" /> 131 131 <EmbeddedResource Include="Documents\GE_SymbReg.hl" /> 132 <EmbeddedResource Include="Documents\GA_QAP_Script.hl" /> 133 <EmbeddedResource Include="Documents\GUI_Automation_Script.hl" /> 134 <EmbeddedResource Include="Documents\OSGA_Rastrigin_Script.hl" /> 135 <EmbeddedResource Include="Documents\GP_Multiplexer.hl" /> 132 136 <None Include="Plugin.cs.frame" /> 133 137 <Compile Include="OptimizerSingleDocumentMainForm.cs"> -
branches/DataPreprocessing/HeuristicLab.Optimizer/3.3/StartPage.Designer.cs
r9907 r11064 86 86 this.firstStepsRichTextBox.Name = "firstStepsRichTextBox"; 87 87 this.firstStepsRichTextBox.ReadOnly = true; 88 this.firstStepsRichTextBox.Size = new System.Drawing.Size( 725, 370);88 this.firstStepsRichTextBox.Size = new System.Drawing.Size(389, 581); 89 89 this.firstStepsRichTextBox.TabIndex = 1; 90 90 this.firstStepsRichTextBox.Text = "First Steps"; … … 98 98 this.titleLabel.Location = new System.Drawing.Point(-1, 0); 99 99 this.titleLabel.Name = "titleLabel"; 100 this.titleLabel.Size = new System.Drawing.Size( 729, 30);100 this.titleLabel.Size = new System.Drawing.Size(393, 30); 101 101 this.titleLabel.TabIndex = 0; 102 102 this.titleLabel.Text = "Title"; … … 111 111 this.samplesGroupBox.Location = new System.Drawing.Point(0, 3); 112 112 this.samplesGroupBox.Name = "samplesGroupBox"; 113 this.samplesGroupBox.Size = new System.Drawing.Size( 728, 201);113 this.samplesGroupBox.Size = new System.Drawing.Size(332, 637); 114 114 this.samplesGroupBox.TabIndex = 0; 115 115 this.samplesGroupBox.TabStop = false; … … 127 127 this.samplesListView.Name = "samplesListView"; 128 128 this.samplesListView.ShowItemToolTips = true; 129 this.samplesListView.Size = new System.Drawing.Size( 722, 182);129 this.samplesListView.Size = new System.Drawing.Size(326, 618); 130 130 this.samplesListView.SmallImageList = this.imageList; 131 131 this.samplesListView.Sorting = System.Windows.Forms.SortOrder.Ascending; … … 154 154 // splitContainer 155 155 // 156 this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 157 | System.Windows.Forms.AnchorStyles.Left) 158 | System.Windows.Forms.AnchorStyles.Right))); 156 this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill; 159 157 this.splitContainer.Location = new System.Drawing.Point(0, 0); 160 158 this.splitContainer.Name = "splitContainer"; 161 this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;162 159 // 163 160 // splitContainer.Panel1 164 161 // 165 162 this.splitContainer.Panel1.Controls.Add(this.titleLabel); 163 this.splitContainer.Panel1.Controls.Add(this.showStartPageCheckBox); 166 164 this.splitContainer.Panel1.Controls.Add(this.firstStepsRichTextBox); 167 165 // … … 169 167 // 170 168 this.splitContainer.Panel2.Controls.Add(this.samplesGroupBox); 171 this.splitContainer.Size = new System.Drawing.Size(728, 6 14);172 this.splitContainer.SplitterDistance = 406;169 this.splitContainer.Size = new System.Drawing.Size(728, 640); 170 this.splitContainer.SplitterDistance = 392; 173 171 this.splitContainer.TabIndex = 0; 174 172 // … … 177 175 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 178 176 this.Controls.Add(this.splitContainer); 179 this.Controls.Add(this.showStartPageCheckBox);180 177 this.Name = "StartPage"; 181 178 this.Size = new System.Drawing.Size(728, 640); 182 179 this.samplesGroupBox.ResumeLayout(false); 183 180 this.splitContainer.Panel1.ResumeLayout(false); 181 this.splitContainer.Panel1.PerformLayout(); 184 182 this.splitContainer.Panel2.ResumeLayout(false); 185 183 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); 186 184 this.splitContainer.ResumeLayout(false); 187 185 this.ResumeLayout(false); 188 this.PerformLayout();189 186 190 187 } -
branches/DataPreprocessing/HeuristicLab.Optimizer/3.3/StartPage.cs
r10538 r11064 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.IO; 24 25 using System.Linq; … … 34 35 [View("Start Page")] 35 36 public partial class StartPage : HeuristicLab.MainForm.WindowsForms.View { 37 private const string StandardProblemsGroupName = "Standard Problems"; 38 private const string DataAnalysisGroupName = "Data Analysis"; 39 private const string ScriptsGroupName = "Scripts"; 40 private const string UncategorizedGroupName = "Uncategorized"; 41 private const string SampleNamePrefix = "HeuristicLab.Optimizer.Documents."; 42 private const string SampleNameSuffix = ".hl"; 43 44 private readonly Dictionary<ListViewGroup, List<string>> GroupLookup = new Dictionary<ListViewGroup, List<string>>(); 45 private readonly ListViewGroup StandardProblemsGroup = new ListViewGroup(StandardProblemsGroupName); 46 private readonly ListViewGroup DataAnalysisGroup = new ListViewGroup(DataAnalysisGroupName); 47 private readonly ListViewGroup ScriptsGroup = new ListViewGroup(ScriptsGroupName); 48 private readonly ListViewGroup UncategorizedGroup = new ListViewGroup(UncategorizedGroupName); 49 36 50 private IProgress progress; 37 51 … … 55 69 56 70 samplesListView.Enabled = false; 71 samplesListView.Groups.Add(StandardProblemsGroup); 72 samplesListView.Groups.Add(DataAnalysisGroup); 73 samplesListView.Groups.Add(ScriptsGroup); 74 samplesListView.Groups.Add(UncategorizedGroup); 75 FillGroupLookup(); 76 57 77 showStartPageCheckBox.Checked = Properties.Settings.Default.ShowStartPage; 58 78 … … 71 91 progress = MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(samplesListView, "Loading..."); 72 92 try { 73 Assemblyassembly = Assembly.GetExecutingAssembly();74 var samples = assembly.GetManifestResourceNames().Where(x => x.EndsWith( ".hl"));93 var assembly = Assembly.GetExecutingAssembly(); 94 var samples = assembly.GetManifestResourceNames().Where(x => x.EndsWith(SampleNameSuffix)); 75 95 int count = samples.Count(); 76 96 string path = Path.GetTempFileName(); 77 97 78 foreach (string name in samples) { 79 try { 80 using (Stream stream = assembly.GetManifestResourceStream(name)) { 81 WriteStreamToTempFile(stream, path); 82 INamedItem item = XmlParser.Deserialize<INamedItem>(path); 83 OnSampleLoaded(item, 1.0 / count); 84 } 98 foreach (var entry in GroupLookup) { 99 var group = entry.Key; 100 var sampleList = entry.Value; 101 foreach (var sampleName in sampleList) { 102 string resourceName = SampleNamePrefix + sampleName + SampleNameSuffix; 103 LoadSample(resourceName, assembly, path, group, count); 85 104 } 86 catch (Exception) { 87 } 88 } 105 } 106 107 var categorizedSamples = GroupLookup.Select(x => x.Value).SelectMany(x => x).Select(x => SampleNamePrefix + x + SampleNameSuffix); 108 var uncategorizedSamples = samples.Except(categorizedSamples); 109 110 foreach (var resourceName in uncategorizedSamples) { 111 LoadSample(resourceName, assembly, path, UncategorizedGroup, count); 112 } 113 89 114 OnAllSamplesLoaded(); 90 115 } … … 93 118 } 94 119 } 95 private void OnSampleLoaded(INamedItem sample, double progress) { 120 121 private void LoadSample(string name, Assembly assembly, string path, ListViewGroup group, int count) { 122 try { 123 using (var stream = assembly.GetManifestResourceStream(name)) { 124 WriteStreamToTempFile(stream, path); 125 var item = XmlParser.Deserialize<INamedItem>(path); 126 OnSampleLoaded(item, group, 1.0 / count); 127 } 128 } 129 catch (Exception) { } 130 } 131 132 private void FillGroupLookup() { 133 var standardProblems = new List<string>( 134 new[] { "ES_Griewank", "GA_TSP", "GA_VRP", "GE_ArtificialAnt", 135 "IslandGA_TSP", "LS_Knapsack", "PSO_Schwefel", "RAPGA_JSSP", 136 "SA_Rastrigin", "SGP_SantaFe","GP_Multiplexer", "SS_VRP", "TS_TSP", "TS_VRP", "VNS_TSP" 137 }); 138 GroupLookup[StandardProblemsGroup] = standardProblems; 139 var dataAnalysisProblems = new List<string>(new[] { "GE_SymbReg", "GPR", "SGP_SymbClass", "SGP_SymbReg" }); 140 GroupLookup[DataAnalysisGroup] = dataAnalysisProblems; 141 var scripts = new List<string>(new[] { "GA_QAP_Script", "GUI_Automation_Script", "OSGA_Rastrigin_Script" }); 142 GroupLookup[ScriptsGroup] = scripts; 143 } 144 145 private void OnSampleLoaded(INamedItem sample, ListViewGroup group, double progress) { 96 146 if (InvokeRequired) 97 Invoke(new Action<INamedItem, double>(OnSampleLoaded), sample, progress);147 Invoke(new Action<INamedItem, ListViewGroup, double>(OnSampleLoaded), sample, group, progress); 98 148 else { 99 ListViewItem item = new ListViewItem(new string[] { sample.Name, sample.Description } );149 ListViewItem item = new ListViewItem(new string[] { sample.Name, sample.Description }, group); 100 150 item.ToolTipText = sample.ItemName + ": " + sample.ItemDescription; 101 151 samplesListView.SmallImageList.Images.Add(sample.ItemImage);
Note: See TracChangeset
for help on using the changeset viewer.