Changeset 10358


Ignore:
Timestamp:
01/20/14 17:33:22 (6 years ago)
Author:
jkarder
Message:

#2136:

  • refactored HLScriptGeneration to separate outputs from different running HL scripts.
  • added persistence support for HLScripts and fixed cloning
  • added code completion for all types in the currently loaded assemblies
  • merged trunk changes
Location:
branches/HLScript
Files:
32 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/HLScript

  • branches/HLScript/HeuristicLab 3.3.sln

    r10332 r10358  
    112112    {AB687BBE-1BFE-476B-906D-44237135431D} = {AB687BBE-1BFE-476B-906D-44237135431D}
    113113    {66D249C3-A01D-42A8-82A2-919BC8EC3D83} = {66D249C3-A01D-42A8-82A2-919BC8EC3D83}
     114    {21977CC3-1757-4B3B-87BD-FF817AAA900F} = {21977CC3-1757-4B3B-87BD-FF817AAA900F}
    114115    {E4CFB0C3-0589-4893-B38E-8BEDF885C765} = {E4CFB0C3-0589-4893-B38E-8BEDF885C765}
    115116    {E6CB1FC5-78EC-4EB8-BF12-35303C36F962} = {E6CB1FC5-78EC-4EB8-BF12-35303C36F962}
     117    {0C2917C8-7AA8-4E18-800A-C4D064F992ED} = {0C2917C8-7AA8-4E18-800A-C4D064F992ED}
    116118    {79271BC8-4446-40E2-BB89-9BE4E17174FE} = {79271BC8-4446-40E2-BB89-9BE4E17174FE}
    117119    {7A2531CE-3F7C-4F13-BCCA-ED6DC27A7086} = {7A2531CE-3F7C-4F13-BCCA-ED6DC27A7086}
     
    18621864    {21977CC3-1757-4B3B-87BD-FF817AAA900F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    18631865    {21977CC3-1757-4B3B-87BD-FF817AAA900F}.Debug|Any CPU.Build.0 = Debug|Any CPU
    1864     {21977CC3-1757-4B3B-87BD-FF817AAA900F}.Debug|x64.ActiveCfg = Debug|x64
    1865     {21977CC3-1757-4B3B-87BD-FF817AAA900F}.Debug|x64.Build.0 = Debug|x64
    1866     {21977CC3-1757-4B3B-87BD-FF817AAA900F}.Debug|x86.ActiveCfg = Debug|x86
    1867     {21977CC3-1757-4B3B-87BD-FF817AAA900F}.Debug|x86.Build.0 = Debug|x86
     1866    {21977CC3-1757-4B3B-87BD-FF817AAA900F}.Debug|x64.ActiveCfg = Debug|Any CPU
     1867    {21977CC3-1757-4B3B-87BD-FF817AAA900F}.Debug|x86.ActiveCfg = Debug|Any CPU
    18681868    {21977CC3-1757-4B3B-87BD-FF817AAA900F}.Release|Any CPU.ActiveCfg = Release|Any CPU
    18691869    {21977CC3-1757-4B3B-87BD-FF817AAA900F}.Release|Any CPU.Build.0 = Release|Any CPU
    1870     {21977CC3-1757-4B3B-87BD-FF817AAA900F}.Release|x64.ActiveCfg = Release|x64
    1871     {21977CC3-1757-4B3B-87BD-FF817AAA900F}.Release|x64.Build.0 = Release|x64
    1872     {21977CC3-1757-4B3B-87BD-FF817AAA900F}.Release|x86.ActiveCfg = Release|x86
    1873     {21977CC3-1757-4B3B-87BD-FF817AAA900F}.Release|x86.Build.0 = Release|x86
     1870    {21977CC3-1757-4B3B-87BD-FF817AAA900F}.Release|x64.ActiveCfg = Release|Any CPU
     1871    {21977CC3-1757-4B3B-87BD-FF817AAA900F}.Release|x86.ActiveCfg = Release|Any CPU
    18741872    {0C2917C8-7AA8-4E18-800A-C4D064F992ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    18751873    {0C2917C8-7AA8-4E18-800A-C4D064F992ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
    1876     {0C2917C8-7AA8-4E18-800A-C4D064F992ED}.Debug|x64.ActiveCfg = Debug|x64
    1877     {0C2917C8-7AA8-4E18-800A-C4D064F992ED}.Debug|x64.Build.0 = Debug|x64
    1878     {0C2917C8-7AA8-4E18-800A-C4D064F992ED}.Debug|x86.ActiveCfg = Debug|x86
    1879     {0C2917C8-7AA8-4E18-800A-C4D064F992ED}.Debug|x86.Build.0 = Debug|x86
     1874    {0C2917C8-7AA8-4E18-800A-C4D064F992ED}.Debug|x64.ActiveCfg = Debug|Any CPU
     1875    {0C2917C8-7AA8-4E18-800A-C4D064F992ED}.Debug|x86.ActiveCfg = Debug|Any CPU
    18801876    {0C2917C8-7AA8-4E18-800A-C4D064F992ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
    18811877    {0C2917C8-7AA8-4E18-800A-C4D064F992ED}.Release|Any CPU.Build.0 = Release|Any CPU
    1882     {0C2917C8-7AA8-4E18-800A-C4D064F992ED}.Release|x64.ActiveCfg = Release|x64
    1883     {0C2917C8-7AA8-4E18-800A-C4D064F992ED}.Release|x64.Build.0 = Release|x64
    1884     {0C2917C8-7AA8-4E18-800A-C4D064F992ED}.Release|x86.ActiveCfg = Release|x86
    1885     {0C2917C8-7AA8-4E18-800A-C4D064F992ED}.Release|x86.Build.0 = Release|x86
     1878    {0C2917C8-7AA8-4E18-800A-C4D064F992ED}.Release|x64.ActiveCfg = Release|Any CPU
     1879    {0C2917C8-7AA8-4E18-800A-C4D064F992ED}.Release|x86.ActiveCfg = Release|Any CPU
    18861880  EndGlobalSection
    18871881  GlobalSection(SolutionProperties) = preSolution
  • branches/HLScript/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SuccessfulOffspringAnalysis/SuccessfulOffspringAnalyzer.cs

    r9456 r10358  
    8181      Parameters.Add(new LookupParameter<ResultCollection>("SuccessfulOffspringAnalysis", "The successful offspring analysis which is created."));
    8282      Parameters.Add(new ValueParameter<IntValue>("Depth", "The depth of the individuals in the scope tree.", new IntValue(1)));
     83
     84      CollectedValuesParameter.Value.Add(new StringValue("SelectedCrossoverOperator"));
     85      CollectedValuesParameter.Value.Add(new StringValue("SelectedManipulationOperator"));
    8386    }
    8487
     
    110113        }
    111114
    112         //create a data table containing the collected values
    113         ResultCollection successfulOffspringAnalysis;
     115        if (counts.Count > 0) {
     116          //create a data table containing the collected values
     117          ResultCollection successfulOffspringAnalysis;
    114118
    115         if (SuccessfulOffspringAnalysisParameter.ActualValue == null) {
    116           successfulOffspringAnalysis = new ResultCollection();
    117           SuccessfulOffspringAnalysisParameter.ActualValue = successfulOffspringAnalysis;
    118         } else {
    119           successfulOffspringAnalysis = SuccessfulOffspringAnalysisParameter.ActualValue;
    120         }
    121 
    122         string resultKey = "SuccessfulOffspringAnalyzer Results";
    123         if (!results.ContainsKey(resultKey)) {
    124           results.Add(new Result(resultKey, successfulOffspringAnalysis));
    125         } else {
    126           results[resultKey].Value = successfulOffspringAnalysis;
    127         }
    128 
    129         DataTable successProgressAnalysis;
    130         if (!successfulOffspringAnalysis.ContainsKey(collected.Value)) {
    131           successProgressAnalysis = new DataTable();
    132           successProgressAnalysis.Name = collected.Value;
    133           successfulOffspringAnalysis.Add(new Result(collected.Value, successProgressAnalysis));
    134         } else {
    135           successProgressAnalysis = successfulOffspringAnalysis[collected.Value].Value as DataTable;
    136         }
    137 
    138         int successfulCount = 0;
    139         foreach (string key in counts.Keys) {
    140           successfulCount += counts[key];
    141         }
    142 
    143         foreach (String value in counts.Keys) {
    144           DataRow row;
    145           if (!successProgressAnalysis.Rows.ContainsKey(value)) {
    146             row = new DataRow(value);
    147             int iterations = GenerationsParameter.ActualValue.Value;
    148 
    149             //fill up all values seen the first time
    150             for (int i = 1; i < iterations; i++)
    151               row.Values.Add(0);
    152 
    153             successProgressAnalysis.Rows.Add(row);
     119          if (SuccessfulOffspringAnalysisParameter.ActualValue == null) {
     120            successfulOffspringAnalysis = new ResultCollection();
     121            SuccessfulOffspringAnalysisParameter.ActualValue = successfulOffspringAnalysis;
    154122          } else {
    155             row = successProgressAnalysis.Rows[value];
     123            successfulOffspringAnalysis = SuccessfulOffspringAnalysisParameter.ActualValue;
    156124          }
    157125
    158           row.Values.Add(counts[value] / (double)successfulCount);
    159         }
     126          string resultKey = "SuccessfulOffspringAnalyzer Results";
     127          if (!results.ContainsKey(resultKey)) {
     128            results.Add(new Result(resultKey, successfulOffspringAnalysis));
     129          } else {
     130            results[resultKey].Value = successfulOffspringAnalysis;
     131          }
    160132
    161         //fill up all values that are not present in the current generation
    162         foreach (DataRow row in successProgressAnalysis.Rows) {
    163           if (!counts.ContainsKey(row.Name))
    164             row.Values.Add(0);
     133          DataTable successProgressAnalysis;
     134          if (!successfulOffspringAnalysis.ContainsKey(collected.Value)) {
     135            successProgressAnalysis = new DataTable();
     136            successProgressAnalysis.Name = collected.Value;
     137            successfulOffspringAnalysis.Add(new Result(collected.Value, successProgressAnalysis));
     138          } else {
     139            successProgressAnalysis = successfulOffspringAnalysis[collected.Value].Value as DataTable;
     140          }
     141
     142          int successfulCount = 0;
     143          foreach (string key in counts.Keys) {
     144            successfulCount += counts[key];
     145          }
     146
     147          foreach (String value in counts.Keys) {
     148            DataRow row;
     149            if (!successProgressAnalysis.Rows.ContainsKey(value)) {
     150              row = new DataRow(value);
     151              int iterations = GenerationsParameter.ActualValue.Value;
     152
     153              //fill up all values seen the first time
     154              for (int i = 1; i < iterations; i++)
     155                row.Values.Add(0);
     156
     157              successProgressAnalysis.Rows.Add(row);
     158            } else {
     159              row = successProgressAnalysis.Rows[value];
     160            }
     161
     162            row.Values.Add(counts[value] / (double)successfulCount);
     163          }
     164
     165          //fill up all values that are not present in the current generation
     166          foreach (DataRow row in successProgressAnalysis.Rows) {
     167            if (!counts.ContainsKey(row.Name))
     168              row.Values.Add(0);
     169          }
    165170        }
    166171      }
  • branches/HLScript/HeuristicLab.CodeEditor/3.3/CodeEditor.cs

    r10332 r10358  
    306306    public void AddAssembly(Assembly a) {
    307307      ShowMessage("Loading " + a.GetName().Name + "...");
    308       if (assemblies.Contains(a))
    309         return;
    310       var reference = projectContentRegistry.GetProjectContentForReference(a.GetName().Name, a.Location);
    311       projectContent.AddReferencedContent(reference);
    312       assemblies.Add(a);
     308      if (!assemblies.Contains(a)) {
     309        var reference = projectContentRegistry.GetProjectContentForReference(a.GetName().Name, a.Location);
     310        projectContent.AddReferencedContent(reference);
     311        assemblies.Add(a);
     312      }
    313313      ShowMessage("Ready");
    314314    }
    315315    public void RemoveAssembly(Assembly a) {
    316316      ShowMessage("Unloading " + a.GetName().Name + "...");
    317       if (!assemblies.Contains(a))
    318         return;
    319       var content = projectContentRegistry.GetExistingProjectContent(a.Location);
    320       if (content != null) {
    321         projectContent.ReferencedContents.Remove(content);
    322         projectContentRegistry.UnloadProjectContent(content);
     317      if (assemblies.Contains(a)) {
     318        var content = projectContentRegistry.GetExistingProjectContent(a.Location);
     319        if (content != null) {
     320          projectContent.ReferencedContents.Remove(content);
     321          projectContentRegistry.UnloadProjectContent(content);
     322        }
    323323      }
    324324      ShowMessage("Ready");
  • branches/HLScript/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Crossovers/MultiBinaryVectorCrossover.cs

    r10295 r10358  
    6464          Operators.Add((IBinaryVectorCrossover)Activator.CreateInstance(type), true);
    6565      }
     66
     67      SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator";
    6668    }
    6769
  • branches/HLScript/HeuristicLab.Encodings.IntegerVectorEncoding

  • branches/HLScript/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/MultiIntegerVectorCrossover.cs

    r10295 r10358  
    7070          Operators.Add((IIntegerVectorCrossover)Activator.CreateInstance(type), true);
    7171      }
     72
     73      SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator";
    7274    }
    7375
  • branches/HLScript/HeuristicLab.Encodings.PermutationEncoding

  • branches/HLScript/HeuristicLab.Encodings.PermutationEncoding/3.3/Crossovers/MultiPermutationCrossover.cs

    r10295 r10358  
    6464          Operators.Add((IPermutationCrossover)Activator.CreateInstance(type), true);
    6565      }
     66
     67      SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator";
    6668    }
    6769
  • branches/HLScript/HeuristicLab.Encodings.PermutationEncoding/3.3/Manipulators/MultiPermutationManipulator.cs

    r10295 r10358  
    5757          Operators.Add((IPermutationManipulator)Activator.CreateInstance(type), true);
    5858      }
     59
     60      SelectedOperatorParameter.ActualName = "SelectedManipulationOperator";
    5961    }
    6062
  • branches/HLScript/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/MultiRealVectorCrossover.cs

    r10295 r10358  
    7070          Operators.Add((IRealVectorCrossover)Activator.CreateInstance(type), true);
    7171      }
     72
     73      SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator";
    7274    }
    7375
  • branches/HLScript/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/MultiRealVectorManipulator.cs

    r10295 r10358  
    6262      Operators.Add(new PolynomialOnePositionManipulator());
    6363      Operators.Add(new UniformOnePositionManipulator());
     64
     65      SelectedOperatorParameter.ActualName = "SelectedManipulationOperator";
    6466    }
    6567
  • branches/HLScript/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding

  • branches/HLScript/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators/MultiSymbolicExpressionTreeArchitectureManipulator.cs

    r9456 r10358  
    106106      Operators = checkedItemList.AsReadOnly();
    107107      Operators_ItemsAdded(this, new CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeManipulator>>(Operators.CheckedItems));
     108
     109      SelectedOperatorParameter.ActualName = "SelectedManipulationOperator";
    108110    }
    109111
  • branches/HLScript/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/MultiSymbolicExpressionTreeManipulator.cs

    r9456 r10358  
    8383      Operators = checkedItemList.AsReadOnly();
    8484      Operators_ItemsAdded(this, new CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeManipulator>>(Operators.CheckedItems));
     85
     86      SelectedOperatorParameter.ActualName = "SelectedManipulationOperator";
    8587    }
    8688
  • branches/HLScript/HeuristicLab.HLScript.Views/3.3/HLScriptView.Designer.cs

    r10332 r10358  
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       this.components = new System.ComponentModel.Container();
    4847      this.compilationLabel = new System.Windows.Forms.Label();
    4948      this.showCodeButton = new System.Windows.Forms.Button();
    5049      this.startStopButton = new System.Windows.Forms.Button();
    51       this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    5250      this.errorListView = new System.Windows.Forms.ListView();
    5351      this.categoryColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
     
    6361      this.outputTabPage = new System.Windows.Forms.TabPage();
    6462      this.outputTextBox = new System.Windows.Forms.TextBox();
     63      this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    6564      this.variableStoreView = new HeuristicLab.HLScript.Views.VariableStoreView();
    66       this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     65      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    6766      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
    6867      this.splitContainer1.Panel1.SuspendLayout();
     
    7877      this.SuspendLayout();
    7978      //
     79      // nameTextBox
     80      //
     81      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
     82      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
     83      this.nameTextBox.Location = new System.Drawing.Point(60, 0);
     84      this.nameTextBox.Size = new System.Drawing.Size(750, 20);
     85      //
     86      // infoLabel
     87      //
     88      this.infoLabel.Location = new System.Drawing.Point(816, 4);
     89      //
    8090      // compilationLabel
    8191      //
    8292      this.compilationLabel.AutoSize = true;
    8393      this.compilationLabel.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
    84       this.compilationLabel.Location = new System.Drawing.Point(63, 9);
     94      this.compilationLabel.Location = new System.Drawing.Point(63, 32);
    8595      this.compilationLabel.Name = "compilationLabel";
    8696      this.compilationLabel.Size = new System.Drawing.Size(69, 13);
     
    91101      //
    92102      this.showCodeButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.PrintPreview;
    93       this.showCodeButton.Location = new System.Drawing.Point(33, 3);
     103      this.showCodeButton.Location = new System.Drawing.Point(33, 26);
    94104      this.showCodeButton.Name = "showCodeButton";
    95105      this.showCodeButton.Size = new System.Drawing.Size(24, 24);
     
    103113      //
    104114      this.startStopButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Play;
    105       this.startStopButton.Location = new System.Drawing.Point(3, 3);
     115      this.startStopButton.Location = new System.Drawing.Point(3, 26);
    106116      this.startStopButton.Name = "startStopButton";
    107117      this.startStopButton.Size = new System.Drawing.Size(24, 24);
     
    126136      this.errorListView.Location = new System.Drawing.Point(3, 3);
    127137      this.errorListView.Name = "errorListView";
    128       this.errorListView.Size = new System.Drawing.Size(623, 83);
     138      this.errorListView.Size = new System.Drawing.Size(623, 79);
    129139      this.errorListView.TabIndex = 0;
    130140      this.errorListView.UseCompatibleStateImageBehavior = false;
     
    161171      this.codeEditor.Name = "codeEditor";
    162172      this.codeEditor.Prefix = "";
    163       this.codeEditor.Size = new System.Drawing.Size(637, 447);
     173      this.codeEditor.Size = new System.Drawing.Size(637, 428);
    164174      this.codeEditor.Suffix = "";
    165175      this.codeEditor.TabIndex = 0;
     
    169179      // splitContainer1
    170180      //
    171       this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    172             | System.Windows.Forms.AnchorStyles.Left)
     181      this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     182            | System.Windows.Forms.AnchorStyles.Left) 
    173183            | System.Windows.Forms.AnchorStyles.Right)));
    174       this.splitContainer1.Location = new System.Drawing.Point(3, 33);
     184      this.splitContainer1.Location = new System.Drawing.Point(3, 56);
    175185      this.splitContainer1.Name = "splitContainer1";
    176186      //
     
    183193      this.splitContainer1.Panel2.Controls.Add(this.variableStoreView);
    184194      this.splitContainer1.Panel2.Controls.Add(this.viewHost);
    185       this.splitContainer1.Size = new System.Drawing.Size(829, 566);
     195      this.splitContainer1.Size = new System.Drawing.Size(829, 543);
    186196      this.splitContainer1.SplitterDistance = 637;
    187197      this.splitContainer1.TabIndex = 7;
     
    201211      //
    202212      this.splitContainer2.Panel2.Controls.Add(this.tabControl1);
    203       this.splitContainer2.Size = new System.Drawing.Size(637, 566);
    204       this.splitContainer2.SplitterDistance = 447;
     213      this.splitContainer2.Size = new System.Drawing.Size(637, 543);
     214      this.splitContainer2.SplitterDistance = 428;
    205215      this.splitContainer2.TabIndex = 5;
    206216      //
     
    213223      this.tabControl1.Name = "tabControl1";
    214224      this.tabControl1.SelectedIndex = 0;
    215       this.tabControl1.Size = new System.Drawing.Size(637, 115);
     225      this.tabControl1.Size = new System.Drawing.Size(637, 111);
    216226      this.tabControl1.TabIndex = 1;
    217227      //
     
    222232      this.errorListTabPage.Name = "errorListTabPage";
    223233      this.errorListTabPage.Padding = new System.Windows.Forms.Padding(3);
    224       this.errorListTabPage.Size = new System.Drawing.Size(629, 89);
     234      this.errorListTabPage.Size = new System.Drawing.Size(629, 85);
    225235      this.errorListTabPage.TabIndex = 0;
    226236      this.errorListTabPage.Text = "Error List";
     
    233243      this.outputTabPage.Name = "outputTabPage";
    234244      this.outputTabPage.Padding = new System.Windows.Forms.Padding(3);
    235       this.outputTabPage.Size = new System.Drawing.Size(629, 89);
     245      this.outputTabPage.Size = new System.Drawing.Size(629, 85);
    236246      this.outputTabPage.TabIndex = 1;
    237247      this.outputTabPage.Text = "Output";
     
    247257      this.outputTextBox.ReadOnly = true;
    248258      this.outputTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
    249       this.outputTextBox.Size = new System.Drawing.Size(623, 83);
     259      this.outputTextBox.Size = new System.Drawing.Size(623, 79);
    250260      this.outputTextBox.TabIndex = 0;
    251261      this.outputTextBox.WordWrap = false;
    252       //
    253       // variableStoreView
    254       //
    255       this.variableStoreView.Caption = "ItemCollection View";
    256       this.variableStoreView.Content = null;
    257       this.variableStoreView.Dock = System.Windows.Forms.DockStyle.Fill;
    258       this.variableStoreView.Location = new System.Drawing.Point(0, 0);
    259       this.variableStoreView.Name = "variableStoreView";
    260       this.variableStoreView.ReadOnly = false;
    261       this.variableStoreView.Size = new System.Drawing.Size(188, 566);
    262       this.variableStoreView.TabIndex = 0;
    263262      //
    264263      // viewHost
     
    271270      this.viewHost.Name = "viewHost";
    272271      this.viewHost.ReadOnly = false;
    273       this.viewHost.Size = new System.Drawing.Size(188, 566);
     272      this.viewHost.Size = new System.Drawing.Size(188, 543);
    274273      this.viewHost.TabIndex = 0;
    275274      this.viewHost.ViewsLabelVisible = true;
    276275      this.viewHost.ViewType = null;
     276      //
     277      // variableStoreView
     278      //
     279      this.variableStoreView.Caption = "ItemCollection View";
     280      this.variableStoreView.Content = null;
     281      this.variableStoreView.Dock = System.Windows.Forms.DockStyle.Fill;
     282      this.variableStoreView.Location = new System.Drawing.Point(0, 0);
     283      this.variableStoreView.Name = "variableStoreView";
     284      this.variableStoreView.ReadOnly = false;
     285      this.variableStoreView.Size = new System.Drawing.Size(188, 543);
     286      this.variableStoreView.TabIndex = 0;
    277287      //
    278288      // HLScriptView
     
    285295      this.Name = "HLScriptView";
    286296      this.Size = new System.Drawing.Size(835, 602);
     297      this.Controls.SetChildIndex(this.showCodeButton, 0);
     298      this.Controls.SetChildIndex(this.compilationLabel, 0);
     299      this.Controls.SetChildIndex(this.startStopButton, 0);
     300      this.Controls.SetChildIndex(this.splitContainer1, 0);
     301      this.Controls.SetChildIndex(this.nameLabel, 0);
     302      this.Controls.SetChildIndex(this.nameTextBox, 0);
     303      this.Controls.SetChildIndex(this.infoLabel, 0);
     304      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    287305      this.splitContainer1.Panel1.ResumeLayout(false);
    288306      this.splitContainer1.Panel2.ResumeLayout(false);
     
    307325    private System.Windows.Forms.Label compilationLabel;
    308326    private System.Windows.Forms.Button startStopButton;
    309     private System.Windows.Forms.ToolTip toolTip;
    310327    private System.Windows.Forms.ListView errorListView;
    311328    private System.Windows.Forms.ColumnHeader descriptionColumnHeader;
  • branches/HLScript/HeuristicLab.HLScript.Views/3.3/HLScriptView.cs

    r10332 r10358  
    3636  [View("HLScript View")]
    3737  [Content(typeof(HLScript), true)]
    38   public partial class HLScriptView : ItemView {
     38  public partial class HLScriptView : NamedItemView {
    3939    private bool running;
    4040
     
    6969    }
    7070    private void Content_ScriptExecutionStarted(object sender, EventArgs e) {
    71       ReadOnly = true;
     71      Locked = true;
    7272      startStopButton.Image = VSImageLibrary.Stop;
    7373    }
    7474    private void Content_ScriptExecutionFinished(object sender, EventArgs e) {
    75       ReadOnly = false;
     75      Locked = false;
    7676      startStopButton.Image = VSImageLibrary.Play;
    7777      running = false;
     
    9292      } else {
    9393        codeEditor.UserCode = Content.Code;
     94        foreach (var asm in Content.GetAssemblies())
     95          codeEditor.AddAssembly(asm);
    9496        variableStoreView.Content = Content.VariableStore;
    9597        if (Content.CompileErrors == null) {
     
    108110    protected override void SetEnabledStateOfControls() {
    109111      base.SetEnabledStateOfControls();
    110       startStopButton.Enabled = Content != null;
     112      startStopButton.Enabled = Content != null && !Locked;
    111113      showCodeButton.Enabled = Content != null && !string.IsNullOrEmpty(Content.CompilationUnitCode);
    112       codeEditor.Enabled = Content != null && !ReadOnly;
     114      codeEditor.Enabled = Content != null && !Locked && !ReadOnly;
    113115    }
    114116
     
    137139    protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
    138140      if (keyData == Keys.F5) {
    139         if (Content == null || ReadOnly)
     141        if (Content == null || Locked)
    140142          return base.ProcessCmdKey(ref msg, keyData);
    141143        outputTextBox.Clear();
     
    144146          outputTextBox.Clear();
    145147          Content.Execute();
     148          running = true;
    146149        }
    147150        return true;
     
    156159    private bool Compile() {
    157160      ReadOnly = true;
     161      Locked = true;
    158162      errorListView.Items.Clear();
    159163      outputTextBox.Clear();
     
    170174        OnContentChanged();
    171175        ReadOnly = false;
     176        Locked = false;
    172177      }
    173178    }
  • branches/HLScript/HeuristicLab.HLScript.Views/3.3/HeuristicLab.HLScript.Views-3.3.csproj

    r10332 r10358  
    115115      <Private>False</Private>
    116116    </ProjectReference>
     117    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
     118      <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project>
     119      <Name>HeuristicLab.Persistence-3.3</Name>
     120      <Private>False</Private>
     121    </ProjectReference>
    117122    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
    118123      <Project>{94186a6a-5176-4402-ae83-886557b53cca}</Project>
  • branches/HLScript/HeuristicLab.HLScript.Views/3.3/Plugin.cs.frame

    r10332 r10358  
    3434  [PluginDependency("HeuristicLab.MainForm", "3.3")]
    3535  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
     36  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    3637  public class HeuristicLabHLScriptViewsPlugin : PluginBase {
    3738  }
  • branches/HLScript/HeuristicLab.HLScript.Views/3.3/VariableStoreView.Designer.cs

    r10332 r10358  
    6161            this.valueColumnHeader,
    6262            this.typeColumnHeader});
     63      this.variableListView.FullRowSelect = true;
    6364      this.variableListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
    6465      this.variableListView.HideSelection = false;
  • branches/HLScript/HeuristicLab.HLScript.Views/3.3/VariableStoreView.cs

    r10332 r10358  
    2323using System.Collections;
    2424using System.Collections.Generic;
     25using System.Drawing;
    2526using System.Linq;
    2627using System.Windows.Forms;
     
    3132using HeuristicLab.MainForm;
    3233using HeuristicLab.MainForm.WindowsForms;
     34using HeuristicLab.Persistence.Core;
     35using HeuristicLab.Persistence.Default.Xml;
    3336using HeuristicLab.PluginInfrastructure;
    3437
     
    5356      InitializeComponent();
    5457      itemListViewItemMapping = new Dictionary<string, ListViewItem>();
     58      variableListView.SmallImageList.Images.AddRange(new Image[] {
     59        HeuristicLab.Common.Resources.VSImageLibrary.Error,
     60        HeuristicLab.Common.Resources.VSImageLibrary.Object,
     61        HeuristicLab.Common.Resources.VSImageLibrary.Nothing
     62      });
    5563    }
    5664
     
    101109        variableListView.Enabled = false;
    102110      } else {
    103         addButton.Enabled = /*!Content.IsReadOnly &&*/ !ReadOnly;
     111        addButton.Enabled = !Locked && !ReadOnly;
    104112        sortAscendingButton.Enabled = variableListView.Items.Count > 1;
    105113        sortDescendingButton.Enabled = variableListView.Items.Count > 1;
    106         removeButton.Enabled = /*!Content.IsReadOnly &&*/ !ReadOnly && variableListView.SelectedItems.Count > 0;
     114        removeButton.Enabled = !Locked && !ReadOnly && variableListView.SelectedItems.Count > 0;
    107115        variableListView.Enabled = true;
    108116      }
     
    130138      string value = (variable.Value ?? "null").ToString();
    131139      string type = variable.Value == null ? "null" : variable.Value.GetType().ToString();
    132       var listViewItem = new ListViewItem(new[] { variable.Key, value, type }) { ToolTipText = GetToolTipText(variable), Tag = variable };
    133       variableListView.SmallImageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Object);
    134       listViewItem.ImageIndex = variableListView.SmallImageList.Images.Count - 1;
     140      bool serializable = IsSerializable(variable);
     141      var listViewItem = new ListViewItem(new[] { variable.Key, value, type }) { ToolTipText = GetToolTipText(variable, serializable), Tag = variable };
     142      if (serializable) {
     143        listViewItem.ImageIndex = variable.Value == null ? 2 : 1;
     144      } else listViewItem.ImageIndex = 0;
    135145      variableListView.Items.Add(listViewItem);
    136146      itemListViewItemMapping[variable.Key] = listViewItem;
     
    160170        string value = (variable.Value ?? "null").ToString();
    161171        string type = variable.Value == null ? "null" : variable.Value.GetType().ToString();
     172        bool serializable = IsSerializable(variable);
     173        if (serializable) {
     174          listViewItem.ImageIndex = variable.Value == null ? 2 : 1;
     175        } else listViewItem.ImageIndex = 0;
    162176        listViewItem.SubItems[1].Text = value;
    163177        listViewItem.SubItems[2].Text = type;
    164         listViewItem.ToolTipText = GetToolTipText(variable);
     178        listViewItem.ToolTipText = GetToolTipText(variable, serializable);
    165179        listViewItem.Tag = variable;
    166180      } else throw new ArgumentException("A variable with the specified name does not exist.", "variable");
     
    169183    #region ListView Events
    170184    protected virtual void variableListView_SelectedIndexChanged(object sender, EventArgs e) {
    171       removeButton.Enabled = (Content != null) /*&& !Content.IsReadOnly*/ && !ReadOnly && variableListView.SelectedItems.Count > 0;
     185      removeButton.Enabled = (Content != null) && !Locked && !ReadOnly && variableListView.SelectedItems.Count > 0;
    172186      AdjustListViewColumnSizes();
    173187    }
    174188    protected virtual void variableListView_KeyDown(object sender, KeyEventArgs e) {
    175189      if (e.KeyCode == Keys.Delete) {
    176         if ((variableListView.SelectedItems.Count > 0) /*&& !Content.IsReadOnly*/ && !ReadOnly) {
     190        if ((variableListView.SelectedItems.Count > 0) && !Locked && !ReadOnly) {
    177191          foreach (ListViewItem item in variableListView.SelectedItems)
    178192            Content.Remove(item.Text);
     
    207221          if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]);
    208222          else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items);
    209           if (/*Content.IsReadOnly ||*/ ReadOnly) {
     223          if (ReadOnly) {
    210224            DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
    211225          } else {
     
    220234    protected virtual void variableListView_DragEnter(object sender, DragEventArgs e) {
    221235      validDragOperation = false;
    222       if (/*!Content.IsReadOnly &&*/ !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is object)) {
     236      if (!Locked && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is object)) {
    223237        validDragOperation = true;
    224       } else if (/*!Content.IsReadOnly &&*/ !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)) {
     238      } else if (!Locked && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)) {
    225239        validDragOperation = true;
    226240        IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
     
    361375          item.SubItems[1].Text = value;
    362376          item.SubItems[2].Text = variable.Value.Value.GetType().ToString();
    363           item.ToolTipText = GetToolTipText(variable.Value);
     377          item.ToolTipText = GetToolTipText(variable.Value, item.ImageIndex == 0);
    364378          return;
    365379        }
     
    382396    protected virtual void RebuildImageList() {
    383397      variableListView.SmallImageList.Images.Clear();
     398      variableListView.SmallImageList.Images.AddRange(new Image[] {
     399        HeuristicLab.Common.Resources.VSImageLibrary.Error,
     400        HeuristicLab.Common.Resources.VSImageLibrary.Object,
     401        HeuristicLab.Common.Resources.VSImageLibrary.Nothing
     402      });
    384403      foreach (ListViewItem listViewItem in variableListView.Items) {
    385         object item = listViewItem.Tag as object;
    386         variableListView.SmallImageList.Images.Add(item == null ? HeuristicLab.Common.Resources.VSImageLibrary.Nothing : HeuristicLab.Common.Resources.VSImageLibrary.Object);//item.ItemImage);
    387         listViewItem.ImageIndex = variableListView.SmallImageList.Images.Count - 1;
    388       }
    389     }
    390 
    391     private string GetToolTipText(KeyValuePair<string, object> variable) {
     404        var variable = (KeyValuePair<string, object>)listViewItem.Tag;
     405        bool serializable = IsSerializable(variable);
     406        if (serializable) {
     407          listViewItem.ImageIndex = variable.Value == null ? 2 : 1;
     408        } else listViewItem.ImageIndex = 0;
     409      }
     410    }
     411
     412    private string GetToolTipText(KeyValuePair<string, object> variable, bool serializable) {
    392413      if (string.IsNullOrEmpty(variable.Key)) throw new ArgumentException("The variable must have a name.", "variable");
    393414      string value = (variable.Value ?? "null").ToString();
     415      string type = variable.Value == null ? "null" : variable.Value.GetType().ToString();
    394416      string[] lines = {
    395417        "Name: " + variable.Key,
    396418        "Value: " + value,
    397         "Type: " + variable.Value.GetType()
     419        "Type: " + type
    398420      };
    399       return string.Join(Environment.NewLine, lines);
     421      string toolTipText = string.Join(Environment.NewLine, lines);
     422      if (!serializable)
     423        toolTipText += Environment.NewLine + "CAUTION: Type is not serializable!";
     424      return toolTipText;
    400425    }
    401426
     
    411436      return defaultName;
    412437    }
     438
     439    private bool IsSerializable(KeyValuePair<string, object> variable) {
     440      var ser = new Serializer(variable, ConfigurationService.Instance.GetDefaultConfig(new XmlFormat()), "ROOT", true);
     441      try {
     442        return ser.Count() > 0;
     443      } catch (PersistenceException) {
     444        return false;
     445      }
     446    }
    413447    #endregion
    414448  }
  • branches/HLScript/HeuristicLab.HLScript/3.3/HLScript.cs

    r10332 r10358  
    1717
    1818namespace HeuristicLab.HLScript {
    19   [Item("HLScript", "A HeuristicLab script.")]
     19  [Item("HL Script", "A HeuristicLab script.")]
    2020  [Creatable("Scripts")]
    2121  [StorableClass]
     
    8484      : base(original, cloner) {
    8585      code = original.code;
    86       //      variableStore = cloner.Clone(original.variableStore);
    87       //      compiledHLScript = cloner.Clone(original.compiledHLScript)
     86      variableStore = new VariableStore();
    8887      compilationUnitCode = original.compilationUnitCode;
    8988      if (original.compileErrors != null)
     
    9291
    9392    public HLScript()
    94       : base("HLS") {
     93      : base("HL Script", "A HeuristicLab script.") {
    9594      code = CodeTemplate;
    96       variableStore = new VariableStore();
    97     }
    98 
    99     [StorableHook(HookType.AfterDeserialization)]
    100     private void AfterDeserialization() {
    101       compiledHLScript = null;
    10295      variableStore = new VariableStore();
    10396    }
     
    172165    }
    173166
     167    public IEnumerable<Assembly> GetAssemblies() {
     168      var assemblies = new List<Assembly>();
     169      foreach (var a in AppDomain.CurrentDomain.GetAssemblies()) {
     170        try {
     171          if (File.Exists(a.Location)) assemblies.Add(a);
     172        } catch (NotSupportedException) {
     173          // NotSupportedException is thrown while accessing
     174          // the Location property of the anonymously hosted
     175          // dynamic methods assembly, which is related to
     176          // LINQ queries
     177        }
     178      }
     179      assemblies.Add(typeof(Microsoft.CSharp.RuntimeBinder.Binder).Assembly); // for dlr functionality
     180      return assemblies;
     181    }
     182
    174183    private readonly Regex LineSplitter = new Regex(@"\r\n|\r|\n");
    175184    private readonly Regex SafeTypeNameCharRegex = new Regex("[_a-zA-Z0-9]+");
     
    177186    private readonly Regex NamespaceDeclarationRegex = new Regex(@"using\s+(@?[a-z_A-Z]\w+(?:\s*\.\s*@?[a-z_A-Z]\w*)*)\s*;");
    178187    private readonly Regex NamespaceRegex = new Regex(@"(@?[a-z_A-Z]\w+(?:\s*\.\s*@?[a-z_A-Z]\w*)*)");
     188    private readonly Regex CommentRegex = new Regex(@"((/\*)[^/]+(\*/))|(//.*)");
    179189
    180190    private CodeCompileUnit CreateCompilationUnit() {
     
    191201
    192202    private IEnumerable<string> GetNamespaces() {
    193       var strings = NamespaceDeclarationRegex.Matches(code)
     203      var strings = NamespaceDeclarationRegex.Matches(CommentRegex.Replace(code, string.Empty))
    194204                                             .Cast<Match>()
    195205                                             .Select(m => m.Value);
     
    207217          yield return trimmedLine;
    208218      }
    209     }
    210 
    211     private IEnumerable<Assembly> GetAssemblies() {
    212       var assemblies = new List<Assembly>();
    213       foreach (var a in AppDomain.CurrentDomain.GetAssemblies()) {
    214         try {
    215           if (File.Exists(a.Location)) assemblies.Add(a);
    216         } catch (NotSupportedException) {
    217           // NotSupportedException is thrown while accessing
    218           // the Location property of the anonymously hosted
    219           // dynamic methods assembly, which is related to
    220           // LINQ queries
    221         }
    222       }
    223       assemblies.Add(typeof(Microsoft.CSharp.RuntimeBinder.Binder).Assembly); // for dlr functionality
    224       return assemblies;
    225219    }
    226220
  • branches/HLScript/HeuristicLab.HLScript/3.3/HLScriptGeneration.cs

    r10332 r10358  
    88namespace HeuristicLab.HLScript {
    99  public abstract class HLScriptGeneration {
    10     protected static dynamic vars;
     10    protected dynamic vars;
     11
     12    private readonly EventWriter console;
     13    protected EventWriter Console {
     14      get { return console; }
     15    }
     16
     17    protected HLScriptGeneration() {
     18      console = new EventWriter(this);
     19    }
    1120
    1221    public abstract void Main();
     
    1423    private void Execute(VariableStore variableStore) {
    1524      vars = new Variables(variableStore);
    16       using (new EventWriter(this)) {
    17         try {
    18           Main();
    19         } catch (ThreadAbortException) {
    20         } catch (Exception e) {
    21           Console.WriteLine("---");
    22           Console.WriteLine(e);
    23         }
     25      try {
     26        Main();
     27      } catch (ThreadAbortException) {
     28      } catch (Exception e) {
     29        Console.WriteLine("---");
     30        Console.WriteLine(e);
    2431      }
    2532    }
     
    4855    }
    4956
    50     private class EventWriter : TextWriter {
    51       private readonly TextWriter consoleOut;
     57    protected class EventWriter : TextWriter {
    5258      private readonly HLScriptGeneration hlsg;
    53       private bool disposed;
    5459
    5560      public EventWriter(HLScriptGeneration hlsg) {
    5661        this.hlsg = hlsg;
    57         consoleOut = Console.Out;
    58         Console.SetOut(this);
    59         disposed = false;
    6062      }
    6163
     
    106108      #endregion
    107109      #endregion
    108 
    109       protected override void Dispose(bool disposing) {
    110         if (!disposed && disposing)
    111           Console.SetOut(consoleOut);
    112         disposed = true;
    113       }
    114110    }
    115111  }
  • branches/HLScript/HeuristicLab.Problems.DataAnalysis.Symbolic

  • branches/HLScript/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression

  • branches/HLScript/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj

    r9289 r10358  
    120120    <Compile Include="Plugin.cs" />
    121121    <Compile Include="SingleObjective\ConstantOptimizationAnalyzer.cs" />
     122    <Compile Include="SingleObjective\Evaluators\SymbolicRegressionMeanRelativeErrorEvaluator.cs" />
    122123    <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer.cs" />
    123124    <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs" />
  • branches/HLScript/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/MultiSymbolicDataAnalysisExpressionCrossover.cs

    r9456 r10358  
    109109      InitializeOperators();
    110110      name = "MultiSymbolicDataAnalysisExpressionCrossover";
     111
     112      SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator";
    111113    }
    112114
  • branches/HLScript/HeuristicLab.Problems.VehicleRouting

  • branches/HLScript/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Crossovers/BiasedMultiVRPSolutionCrossover.cs

    r10298 r10358  
    6767      Parameters.Add(new ValueParameter<DoubleValue>("LowerBound", "The depth of the individuals in the scope tree.", new DoubleValue(0.01)));
    6868      Parameters.Add(new ValueParameter<IntValue>("Depth", "The depth of the individuals in the scope tree.", new IntValue(1)));
     69
     70      SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator";
    6971    }
    7072
  • branches/HLScript/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Crossovers/MultiVRPSolutionCrossover.cs

    r10295 r10358  
    6767      Parameters.Add(new LookupParameter<IVRPEncoding>("Child", "The child permutation resulting from the crossover."));
    6868      ChildParameter.ActualName = "VRPTours";
     69
     70      SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator";
    6971    }
    7072
  • branches/HLScript/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Manipulators/BiasedMultiVRPSolutionManipulator.cs

    r10298 r10358  
    6767      Parameters.Add(new ValueParameter<DoubleValue>("LowerBound", "The depth of the individuals in the scope tree.", new DoubleValue(0.01)));
    6868      Parameters.Add(new ValueParameter<IntValue>("Depth", "The depth of the individuals in the scope tree.", new IntValue(1)));
     69
     70      SelectedOperatorParameter.ActualName = "SelectedManipulationOperator";
    6971    }
    7072
  • branches/HLScript/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Manipulators/MultiVRPSolutionManipulator.cs

    r10295 r10358  
    5959      Parameters.Add(new LookupParameter<IVRPProblemInstance>("ProblemInstance", "The VRP problem instance"));
    6060      Parameters.Add(new LookupParameter<IVRPEncoding>("VRPTours", "The VRP tours to be manipulated."));
     61
     62      SelectedOperatorParameter.ActualName = "SelectedManipulationOperator";
    6163    }
    6264
Note: See TracChangeset for help on using the changeset viewer.