Changeset 16901 for branches/2679_HeuristicLab.GoalSeekingProblem
- Timestamp:
- 05/06/19 15:36:43 (6 years ago)
- Location:
- branches/2679_HeuristicLab.GoalSeekingProblem
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2679_HeuristicLab.GoalSeekingProblem/HeuristicLab.GoalSeekingProblem.Views/3.4/GoalSeekingOptimizerView.cs
r14526 r16901 20 20 #endregion 21 21 22 using System;23 using System.Windows.Forms;24 22 using HeuristicLab.MainForm; 25 23 using HeuristicLab.Optimization; 26 24 using HeuristicLab.Optimization.Views; 27 25 using HeuristicLab.Problems.DataAnalysis; 26 using System; 27 using System.Windows.Forms; 28 28 29 29 namespace HeuristicLab.GoalSeeking { … … 61 61 protected override void RegisterContentEvents() { 62 62 base.RegisterContentEvents(); 63 Content.AlgorithmChanged += (o, e) => { algorithmViewHost.Content = Content.Optimizer; };64 Content.ProblemChanged += (o, e) => { problemViewHost.Content = Content.Problem; };65 Content.ProblemDataChanged += (o, e) => { dataViewHost.Content = Content.ProblemData; };66 Content.ResultsChanged += (o, e) => { resultsViewHost.Content = Content.Results; };63 Content.AlgorithmChanged += (o, e) => algorithmViewHost.Content = Content.Optimizer; 64 Content.ProblemChanged += (o, e) => problemViewHost.Content = Content.Problem; 65 Content.ProblemDataChanged += (o, e) => dataViewHost.Content = Content.ProblemData; 66 Content.ResultsChanged += (o, e) => resultsViewHost.Content = Content.Results; 67 67 } 68 68 … … 77 77 Content.Problem = (IGoalSeekingProblem)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 78 78 problemViewHost.Content = Content.Problem; 79 } 80 catch (Exception ex) { 79 } catch (Exception ex) { 81 80 MessageBox.Show(ex.Message, "Set problem", MessageBoxButtons.OK, MessageBoxIcon.Error); 82 81 } … … 100 99 Content.Optimizer = (IAlgorithm)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 101 100 algorithmViewHost.Content = Content.Optimizer; 102 } 103 catch (Exception ex) { 101 } catch (Exception ex) { 104 102 MessageBox.Show(ex.Message, "Set algorithm", MessageBoxButtons.OK, MessageBoxIcon.Error); 105 103 } … … 123 121 Content.ProblemData = (IRegressionProblemData)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 124 122 dataViewHost.Content = Content.ProblemData; 125 } 126 catch (Exception ex) { 123 } catch (Exception ex) { 127 124 // provide some information to the user 128 125 MessageBox.Show(ex.Message, "Set problem data", MessageBoxButtons.OK, MessageBoxIcon.Error); -
branches/2679_HeuristicLab.GoalSeekingProblem/HeuristicLab.GoalSeekingProblem.Views/3.4/GoalSeekingProblem.Views.csproj
r14526 r16901 10 10 <RootNamespace>HeuristicLab.GoalSeekingProblem.Views</RootNamespace> 11 11 <AssemblyName>HeuristicLab.GoalSeekingProblem.Views-3.4</AssemblyName> 12 <TargetFrameworkVersion>v4. 5</TargetFrameworkVersion>12 <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> 13 13 <FileAlignment>512</FileAlignment> 14 14 <TargetFrameworkProfile /> … … 18 18 <DebugType>full</DebugType> 19 19 <Optimize>false</Optimize> 20 <OutputPath>..\..\..\..\trunk\ sources\bin\</OutputPath>20 <OutputPath>..\..\..\..\trunk\bin\</OutputPath> 21 21 <DefineConstants>DEBUG;TRACE</DefineConstants> 22 22 <ErrorReport>prompt</ErrorReport> 23 23 <WarningLevel>4</WarningLevel> 24 <LangVersion> 4</LangVersion>24 <LangVersion>5</LangVersion> 25 25 </PropertyGroup> 26 26 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 27 27 <DebugType>pdbonly</DebugType> 28 28 <Optimize>true</Optimize> 29 <OutputPath>..\..\..\..\trunk\ sources\bin\</OutputPath>29 <OutputPath>..\..\..\..\trunk\bin\</OutputPath> 30 30 <DefineConstants>TRACE</DefineConstants> 31 31 <ErrorReport>prompt</ErrorReport> 32 32 <WarningLevel>4</WarningLevel> 33 <LangVersion>5</LangVersion> 33 34 </PropertyGroup> 34 35 <ItemGroup> 35 <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec" /> 36 <Reference Include="HeuristicLab.Common-3.3"> 37 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath> 36 <Reference Include="HeuristicLab.Collections-3.3"> 37 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Collections-3.3.dll</HintPath> 38 38 <Private>False</Private> 39 39 </Reference> 40 <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 41 <SpecificVersion>False</SpecificVersion> 42 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath> 40 <Reference Include="HeuristicLab.Common-3.3"> 41 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Common-3.3.dll</HintPath> 43 42 <Private>False</Private> 44 43 </Reference> 45 <Reference Include="HeuristicLab.Core.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 46 <SpecificVersion>False</SpecificVersion> 47 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core.Views-3.3.dll</HintPath> 44 <Reference Include="HeuristicLab.Core-3.3"> 45 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Core-3.3.dll</HintPath> 46 <Private>False</Private> 47 </Reference> 48 <Reference Include="HeuristicLab.Core.Views-3.3"> 49 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Core.Views-3.3.dll</HintPath> 48 50 <Private>False</Private> 49 51 </Reference> 50 52 <Reference Include="HeuristicLab.MainForm-3.3"> 51 <HintPath>..\..\..\..\trunk\ sources\bin\HeuristicLab.MainForm-3.3.dll</HintPath>53 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.MainForm-3.3.dll</HintPath> 52 54 <Private>False</Private> 53 55 </Reference> 54 56 <Reference Include="HeuristicLab.MainForm.WindowsForms-3.3"> 55 <HintPath>..\..\..\..\trunk\ sources\bin\HeuristicLab.MainForm.WindowsForms-3.3.dll</HintPath>57 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.MainForm.WindowsForms-3.3.dll</HintPath> 56 58 <Private>False</Private> 57 59 </Reference> 58 <Reference Include="HeuristicLab.Op timization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">60 <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 59 61 <SpecificVersion>False</SpecificVersion> 60 <HintPath>..\..\..\..\trunk\ sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>62 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Operators-3.3.dll</HintPath> 61 63 <Private>False</Private> 62 64 </Reference> 63 <Reference Include="HeuristicLab.Optimization.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 64 <SpecificVersion>False</SpecificVersion> 65 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Views-3.3.dll</HintPath> 65 <Reference Include="HeuristicLab.Optimization-3.3"> 66 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Optimization-3.3.dll</HintPath> 66 67 <Private>False</Private> 67 68 </Reference> 68 <Reference Include="HeuristicLab. PluginInfrastructure-3.3">69 <HintPath>..\..\..\..\trunk\ sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>69 <Reference Include="HeuristicLab.Optimization.Views-3.3"> 70 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Optimization.Views-3.3.dll</HintPath> 70 71 <Private>False</Private> 71 72 </Reference> 72 <Reference Include="HeuristicLab.P roblems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">73 <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 73 74 <SpecificVersion>False</SpecificVersion> 74 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath> 75 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> 76 </Reference> 77 <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4"> 78 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath> 75 79 <Private>False</Private> 76 80 </Reference> -
branches/2679_HeuristicLab.GoalSeekingProblem/HeuristicLab.GoalSeekingProblem/3.4/Analyzers/BestSolutionAnalyzer.cs
r14526 r16901 20 20 #endregion 21 21 22 using System.Collections.Generic; 23 using System.Linq; 22 using HEAL.Attic; 24 23 using HeuristicLab.Common; 25 24 using HeuristicLab.Core; … … 29 28 using HeuristicLab.Optimization; 30 29 using HeuristicLab.Parameters; 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;32 30 using HeuristicLab.Problems.DataAnalysis; 31 using System.Collections.Generic; 32 using System.Linq; 33 33 34 34 namespace HeuristicLab.GoalSeeking { 35 [StorableClass]36 35 [Item("BestSolutionAnalyzer", "An analyzer which identifies the best solution from the SingleObjectiveProcessParameterOptimizationProblem")] 36 [StorableType("2CAFF3A8-D2FC-4402-A2F8-DD828465870E")] 37 37 public class BestSolutionAnalyzer : SingleSuccessorOperator, IAnalyzer { 38 38 private const string RowParameterName = "Row"; … … 100 100 101 101 [StorableConstructor] 102 protected BestSolutionAnalyzer( bool deserializing) : base(deserializing) { }102 protected BestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { } 103 103 104 104 -
branches/2679_HeuristicLab.GoalSeekingProblem/HeuristicLab.GoalSeekingProblem/3.4/GoalParameter.cs
r14338 r16901 20 20 #endregion 21 21 22 using System;22 using HEAL.Attic; 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;25 using System; 26 26 27 27 namespace HeuristicLab.GoalSeeking { 28 28 [Item("GoalParameter", "An object describing a tunable parameter used in goal seeking.")] 29 [Storable Class]29 [StorableType("493140D6-5DA2-40AD-97C9-86CDCA72CDA7")] 30 30 public class GoalParameter : NamedItem { 31 31 [Storable] … … 107 107 108 108 [StorableConstructor] 109 protected GoalParameter( bool deserializing) : base(deserializing) { }109 protected GoalParameter(StorableConstructorFlag _) : base(_) { } 110 110 111 111 public GoalParameter(string name, double goal, double weight, double variance, double step, bool active = true) { -
branches/2679_HeuristicLab.GoalSeekingProblem/HeuristicLab.GoalSeekingProblem/3.4/GoalSeekingOptimizer.cs
r14526 r16901 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using System.Drawing; 25 using System.Linq; 22 using HEAL.Attic; 26 23 using HeuristicLab.Analysis; 27 24 using HeuristicLab.Common; … … 29 26 using HeuristicLab.Data; 30 27 using HeuristicLab.Optimization; 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;32 28 using HeuristicLab.Problems.DataAnalysis; 29 using System; 30 using System.Collections.Generic; 31 using System.Drawing; 32 using System.Linq; 33 using System.Threading; 34 using System.Threading.Tasks; 33 35 34 36 namespace HeuristicLab.GoalSeeking { 35 37 internal enum GoalSeekingOptimizerAction { None, Prepare, Start, Stop, Pause } 36 38 37 [StorableClass]38 39 [Item("GoalSeeking Optimizer", "A wrapper for the GoalSeekingProblem class to facilitate adding models and problem data.")] 39 40 [Creatable("Algorithms")] 41 [StorableType("92552DF1-7FC7-4DC9-A021-8661E878A72B")] 40 42 public class GoalSeekingOptimizer : NamedItem, IOptimizer, IStorableContent { 41 43 [Storable] … … 108 110 } 109 111 110 private GoalSeekingOptimizerAction gsoAction;112 private GoalSeekingOptimizerAction optimizerAction; 111 113 112 114 public GoalSeekingOptimizer() { … … 115 117 116 118 [StorableConstructor] 117 protected GoalSeekingOptimizer( bool deserializing) : base(deserializing) { }119 protected GoalSeekingOptimizer(StorableConstructorFlag _) : base(_) { } 118 120 119 121 … … 166 168 private int currentRow; 167 169 170 private void PrepareAndConfigure() { 171 Optimizer.Prepare(clearRuns: true); 172 calculatedRows = 0; 173 currentRow = problemData.TrainingIndices.First(); 174 problem.Configure(problemData, currentRow); 175 } 176 168 177 public void Start() { 178 Start(CancellationToken.None); 179 } 180 181 public void Start(CancellationToken cancellationToken) { 169 182 if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused)) 170 183 throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState)); 171 184 if (optimizer == null) return; 172 gsoAction = GoalSeekingOptimizerAction.Start;185 optimizerAction = GoalSeekingOptimizerAction.Start; 173 186 if (Optimizer.ExecutionState == ExecutionState.Stopped) { 174 Optimizer.Prepare(clearRuns: true); 175 calculatedRows = 0; 176 currentRow = problemData.TrainingIndices.Skip(calculatedRows).First(); 177 problem.Configure(problemData, currentRow); 178 optimizer.Prepare(); 179 } 180 optimizer.Start(); 187 PrepareAndConfigure(); 188 } 189 Optimizer.Start(cancellationToken); 190 } 191 192 public async Task StartAsync() { 193 await StartAsync(CancellationToken.None); 194 } 195 196 public async Task StartAsync(CancellationToken cancellationToken) { 197 await AsyncHelper.DoAsync(Start, cancellationToken); 181 198 } 182 199 … … 185 202 throw new InvalidOperationException(string.Format("Pause not allowed in execution state \"{0}\".", ExecutionState)); 186 203 if (optimizer == null) return; 187 gsoAction = GoalSeekingOptimizerAction.Pause;204 optimizerAction = GoalSeekingOptimizerAction.Pause; 188 205 if (optimizer.ExecutionState != ExecutionState.Started) return; 189 206 // a race-condition may occur when the algorithm has changed the state by itself in the meantime 190 try { optimizer.Pause(); } 191 catch (InvalidOperationException) { } 207 try { optimizer.Pause(); } catch (InvalidOperationException) { } 192 208 } 193 209 … … 196 212 throw new InvalidOperationException(string.Format("Stop not allowed in execution state \"{0}\".", ExecutionState)); 197 213 if (optimizer == null) return; 198 gsoAction = GoalSeekingOptimizerAction.Stop;214 optimizerAction = GoalSeekingOptimizerAction.Stop; 199 215 if (optimizer.ExecutionState != ExecutionState.Started && optimizer.ExecutionState != ExecutionState.Paused) { 200 216 OnStopped(); … … 202 218 } 203 219 // a race-condition may occur when the algorithm has changed the state by itself in the meantime 204 try { optimizer.Stop(); } 205 catch (InvalidOperationException) { } 220 try { optimizer.Stop(); } catch (InvalidOperationException) { } 206 221 } 207 222 … … 220 235 ExecutionTime = TimeSpan.Zero; 221 236 if (clearRuns) optimizer.Runs.Clear(); 222 gsoAction = GoalSeekingOptimizerAction.Prepare;237 optimizerAction = GoalSeekingOptimizerAction.Prepare; 223 238 // a race-condition may occur when the algorithm has changed the state by itself in the meantime 224 try { optimizer.Prepare(clearRuns); } 225 catch (InvalidOperationException) { } 239 try { optimizer.Prepare(clearRuns); } catch (InvalidOperationException) { } 226 240 } else { 227 241 ExecutionState = ExecutionState.Stopped; … … 290 304 public event EventHandler Prepared; 291 305 private void OnPrepared() { 292 gsoAction = GoalSeekingOptimizerAction.None;306 optimizerAction = GoalSeekingOptimizerAction.None; 293 307 ExecutionState = ExecutionState.Prepared; 294 308 EventHandler handler = Prepared; … … 305 319 public event EventHandler Paused; 306 320 private void OnPaused() { 307 gsoAction = GoalSeekingOptimizerAction.None;321 optimizerAction = GoalSeekingOptimizerAction.None; 308 322 ExecutionState = ExecutionState.Paused; 309 323 EventHandler handler = Paused; … … 313 327 public event EventHandler Stopped; 314 328 private void OnStopped() { 315 gsoAction = GoalSeekingOptimizerAction.None;329 optimizerAction = GoalSeekingOptimizerAction.None; 316 330 ExecutionState = ExecutionState.Stopped; 317 331 EventHandler handler = Stopped; … … 337 351 } 338 352 339 public event EventHandler Repet etionsCounterChanged;353 public event EventHandler RepetitionsCounterChanged; 340 354 private void OnRepetitionsCounterChanged() { 341 EventHandler handler = Repet etionsCounterChanged;355 EventHandler handler = RepetitionsCounterChanged; 342 356 if (handler != null) handler(this, EventArgs.Empty); 343 357 } … … 378 392 379 393 private void Optimizer_Prepared(object sender, EventArgs e) { 380 if ( gsoAction == GoalSeekingOptimizerAction.Prepare || ExecutionState == ExecutionState.Stopped) {394 if (optimizerAction == GoalSeekingOptimizerAction.Prepare || ExecutionState == ExecutionState.Stopped) { 381 395 calculatedRows = 0; 382 396 ExecutionTime = TimeSpan.Zero; … … 399 413 GetResults(); 400 414 401 if ( gsoAction == GoalSeekingOptimizerAction.Stop)415 if (optimizerAction == GoalSeekingOptimizerAction.Stop) 402 416 OnStopped(); 403 417 else if (!remainingRows.Any()) { 404 418 OnStopped(); 405 } else switch ( gsoAction) {419 } else switch (optimizerAction) { 406 420 case GoalSeekingOptimizerAction.Pause: 407 421 OnPaused(); -
branches/2679_HeuristicLab.GoalSeekingProblem/HeuristicLab.GoalSeekingProblem/3.4/GoalSeekingProblem.csproj
r14526 r16901 1 1 <?xml version="1.0" encoding="utf-8"?> 2 <Project ToolsVersion=" 4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">2 <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 3 3 <PropertyGroup> 4 4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> … … 11 11 <RootNamespace>HeuristicLab.GoalSeekingProblem</RootNamespace> 12 12 <AssemblyName>HeuristicLab.GoalSeekingProblem-3.4</AssemblyName> 13 <TargetFrameworkVersion>v4. 5</TargetFrameworkVersion>13 <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> 14 14 <FileAlignment>512</FileAlignment> 15 15 <TargetFrameworkProfile /> … … 19 19 <DebugType>full</DebugType> 20 20 <Optimize>false</Optimize> 21 <OutputPath>..\..\..\..\trunk\ sources\bin\</OutputPath>21 <OutputPath>..\..\..\..\trunk\bin\</OutputPath> 22 22 <DefineConstants>DEBUG;TRACE</DefineConstants> 23 23 <ErrorReport>prompt</ErrorReport> … … 25 25 <Prefer32Bit>false</Prefer32Bit> 26 26 <PlatformTarget>AnyCPU</PlatformTarget> 27 <LangVersion> 4</LangVersion>27 <LangVersion>5</LangVersion> 28 28 </PropertyGroup> 29 29 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 30 30 <DebugType>pdbonly</DebugType> 31 31 <Optimize>true</Optimize> 32 <OutputPath>..\..\..\..\trunk\ sources\bin\</OutputPath>32 <OutputPath>..\..\..\..\trunk\bin\</OutputPath> 33 33 <DefineConstants>TRACE</DefineConstants> 34 34 <ErrorReport>prompt</ErrorReport> … … 36 36 <Prefer32Bit>false</Prefer32Bit> 37 37 <PlatformTarget>AnyCPU</PlatformTarget> 38 <LangVersion>5</LangVersion> 38 39 </PropertyGroup> 39 40 <PropertyGroup> … … 45 46 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> 46 47 <DebugSymbols>true</DebugSymbols> 47 <OutputPath>..\..\..\..\trunk\ sources\bin\</OutputPath>48 <OutputPath>..\..\..\..\trunk\bin\</OutputPath> 48 49 <DefineConstants>DEBUG;TRACE</DefineConstants> 49 50 <DebugType>full</DebugType> … … 61 62 </PropertyGroup> 62 63 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> 63 <OutputPath>..\..\..\..\trunk\ sources\bin\</OutputPath>64 <OutputPath>..\..\..\..\trunk\bin\</OutputPath> 64 65 <DefineConstants>TRACE</DefineConstants> 65 66 <Optimize>true</Optimize> … … 78 79 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> 79 80 <DebugSymbols>true</DebugSymbols> 80 <OutputPath>..\..\..\..\trunk\ sources\bin\</OutputPath>81 <OutputPath>..\..\..\..\trunk\bin\</OutputPath> 81 82 <DefineConstants>DEBUG;TRACE</DefineConstants> 82 83 <DebugType>full</DebugType> … … 94 95 </PropertyGroup> 95 96 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> 96 <OutputPath>..\..\..\..\trunk\ sources\bin\</OutputPath>97 <OutputPath>..\..\..\..\trunk\bin\</OutputPath> 97 98 <DefineConstants>TRACE</DefineConstants> 98 99 <Optimize>true</Optimize> … … 112 113 </PropertyGroup> 113 114 <ItemGroup> 115 <Reference Include="HEAL.Attic"> 116 <HintPath>..\..\..\..\trunk\bin\HEAL.Attic.dll</HintPath> 117 <Private>False</Private> 118 </Reference> 114 119 <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 115 120 <SpecificVersion>False</SpecificVersion> 116 <HintPath>..\..\..\..\..\Projects\HeuristicLab\trunk\sources\HeuristicLab trunk sources\binHeuristicLab.Analysis-3.3.dll</HintPath> 117 <Private>False</Private> 118 </Reference> 119 <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 120 <SpecificVersion>False</SpecificVersion> 121 <HintPath>..\HeuristicLab trunk sources\binHeuristicLab.Collections-3.3.dll</HintPath> 122 <Private>False</Private> 123 </Reference> 124 <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 125 <SpecificVersion>False</SpecificVersion> 126 <HintPath>..\HeuristicLab trunk sources\binHeuristicLab.Common-3.3.dll</HintPath> 121 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Analysis-3.3.dll</HintPath> 122 <Private>False</Private> 123 </Reference> 124 <Reference Include="HeuristicLab.Collections-3.3"> 125 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Collections-3.3.dll</HintPath> 126 <Private>False</Private> 127 </Reference> 128 <Reference Include="HeuristicLab.Common-3.3"> 129 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Common-3.3.dll</HintPath> 127 130 <Private>False</Private> 128 131 </Reference> 129 132 <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 130 133 <SpecificVersion>False</SpecificVersion> 131 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath> 132 <Private>False</Private> 133 </Reference> 134 <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 135 <SpecificVersion>False</SpecificVersion> 136 <HintPath>..\HeuristicLab trunk sources\binHeuristicLab.Core-3.3.dll</HintPath> 137 <Private>False</Private> 138 </Reference> 139 <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 140 <SpecificVersion>False</SpecificVersion> 141 <HintPath>..\HeuristicLab trunk sources\binHeuristicLab.Data-3.3.dll</HintPath> 142 <Private>False</Private> 143 </Reference> 144 <Reference Include="HeuristicLab.Encodings.RealVectorEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 145 <SpecificVersion>False</SpecificVersion> 146 <HintPath>..\HeuristicLab trunk sources\binHeuristicLab.Encodings.RealVectorEncoding-3.3.dll</HintPath> 134 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath> 135 <Private>False</Private> 136 </Reference> 137 <Reference Include="HeuristicLab.Core-3.3"> 138 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Core-3.3.dll</HintPath> 139 <Private>False</Private> 140 </Reference> 141 <Reference Include="HeuristicLab.Data-3.3"> 142 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Data-3.3.dll</HintPath> 143 <Private>False</Private> 144 </Reference> 145 <Reference Include="HeuristicLab.Encodings.RealVectorEncoding-3.3"> 146 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Encodings.RealVectorEncoding-3.3.dll</HintPath> 147 147 <Private>False</Private> 148 148 </Reference> 149 149 <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 150 150 <SpecificVersion>False</SpecificVersion> 151 <HintPath>..\HeuristicLab trunk sources\binHeuristicLab.Operators-3.3.dll</HintPath> 152 <Private>False</Private> 153 </Reference> 154 <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 155 <SpecificVersion>False</SpecificVersion> 156 <HintPath>..\HeuristicLab trunk sources\binHeuristicLab.Optimization-3.3.dll</HintPath> 157 <Private>False</Private> 158 </Reference> 159 <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 160 <SpecificVersion>False</SpecificVersion> 161 <HintPath>..\HeuristicLab trunk sources\binHeuristicLab.Parameters-3.3.dll</HintPath> 162 <Private>False</Private> 163 </Reference> 164 <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 165 <SpecificVersion>False</SpecificVersion> 166 <HintPath>..\HeuristicLab trunk sources\binHeuristicLab.Persistence-3.3.dll</HintPath> 167 <Private>False</Private> 168 </Reference> 169 <Reference Include="HeuristicLab.PluginInfrastructure-3.3"> 170 <HintPath>C:\Program Files\HeuristicLab 3.3\PluginInfrastructure-3.3.dll</HintPath> 171 <Private>False</Private> 172 </Reference> 173 <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 174 <SpecificVersion>False</SpecificVersion> 175 <HintPath>..\HeuristicLab trunk sources\binHeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath> 176 <Private>False</Private> 177 </Reference> 178 <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 179 <SpecificVersion>False</SpecificVersion> 180 <HintPath>..\HeuristicLab trunk sources\binHeuristicLab.Problems.DataAnalysis.Symbolic-3.4.dll</HintPath> 181 <Private>False</Private> 182 </Reference> 183 <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 184 <SpecificVersion>False</SpecificVersion> 185 <HintPath>..\HeuristicLab trunk sources\binHeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.dll</HintPath> 151 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Operators-3.3.dll</HintPath> 152 <Private>False</Private> 153 </Reference> 154 <Reference Include="HeuristicLab.Optimization-3.3"> 155 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Optimization-3.3.dll</HintPath> 156 <Private>False</Private> 157 </Reference> 158 <Reference Include="HeuristicLab.Parameters-3.3"> 159 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Parameters-3.3.dll</HintPath> 160 <Private>False</Private> 161 </Reference> 162 <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 163 <SpecificVersion>False</SpecificVersion> 164 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> 165 <Private>False</Private> 166 </Reference> 167 <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4"> 168 <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath> 186 169 <Private>False</Private> 187 170 </Reference> -
branches/2679_HeuristicLab.GoalSeekingProblem/HeuristicLab.GoalSeekingProblem/3.4/InputParameter.cs
r14338 r16901 20 20 #endregion 21 21 22 using System;22 using HEAL.Attic; 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;25 using System; 26 26 27 27 namespace HeuristicLab.GoalSeeking { 28 28 [Item("InputParameter", "An object describing a target for the goal seeking.")] 29 [Storable Class]29 [StorableType("3F8B2C70-7EF4-439C-8E5A-A770F5431E65")] 30 30 public class InputParameter : NamedItem { 31 31 [Storable] … … 106 106 107 107 [StorableConstructor] 108 protected InputParameter( bool deserializing) : base(deserializing) { }108 protected InputParameter(StorableConstructorFlag _) : base(_) { } 109 109 110 110 public InputParameter(string name, double value, double min, double max, double step, bool active = true) { -
branches/2679_HeuristicLab.GoalSeekingProblem/HeuristicLab.GoalSeekingProblem/3.4/MultiObjectiveGoalSeekingProblem.cs
r14526 r16901 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 22 using HEAL.Attic; 25 23 using HeuristicLab.Collections; 26 24 using HeuristicLab.Common; … … 30 28 using HeuristicLab.Optimization; 31 29 using HeuristicLab.Parameters; 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;33 30 using HeuristicLab.Problems.DataAnalysis; 31 using System; 32 using System.Collections.Generic; 33 using System.Linq; 34 34 35 35 namespace HeuristicLab.GoalSeeking { 36 36 [Item("Goal seeking problem (multi-objective)", "Represents a single objective optimization problem which uses configurable regression models to evaluate targets from a given dataset.")] 37 37 [Creatable("Problems")] 38 [Storable Class]38 [StorableType("76EA4627-FD52-41D0-A594-20C99F700F46")] 39 39 public sealed class MultiObjectiveGoalSeekingProblem : MultiObjectiveBasicProblem<RealVectorEncoding>, IGoalSeekingProblem { 40 40 #region parameter names … … 91 91 public IEnumerable<double> GetEstimatedGoalValues(IEnumerable<double> parameterValues, bool round = false) { 92 92 var ds = (ModifiableDataset)dataset.Clone(); 93 foreach (var parameter in ActiveInputs.Zip(parameterValues, (p, v) => new { Name =p.Name, Value = v })) {93 foreach (var parameter in ActiveInputs.Zip(parameterValues, (p, v) => new { p.Name, Value = v })) { 94 94 ds.SetVariableValue(parameter.Value, parameter.Name, 0); 95 95 } 96 96 var rows = new[] { 0 }; // actually just one row 97 var estimatedValues = 98 round ? ActiveGoals.Select(t => RoundToNearestStepMultiple(GetModels(t.Name).Average(m => m.GetEstimatedValues(ds, rows).Single()), t.Step)) 99 : ActiveGoals.Select(t => GetModels(t.Name).Average(m => m.GetEstimatedValues(ds, rows).Single())); 100 return estimatedValues; 97 return round ? ActiveGoals.Select(t => RoundToNearestStepMultiple(GetModels(t.Name).Average(m => m.GetEstimatedValues(ds, rows).Single()), t.Step)) 98 : ActiveGoals.Select(t => GetModels(t.Name).Average(m => m.GetEstimatedValues(ds, rows).Single())); 101 99 } 102 100 … … 131 129 #region constructors 132 130 [StorableConstructor] 133 private MultiObjectiveGoalSeekingProblem( bool deserializing) : base(deserializing) { }131 private MultiObjectiveGoalSeekingProblem(StorableConstructorFlag _) : base(_) { } 134 132 135 133 private MultiObjectiveGoalSeekingProblem(MultiObjectiveGoalSeekingProblem original, Cloner cloner) : base(original, cloner) { … … 219 217 for (int j = 0; j < activeGoals.Count * 2; j += 2) { 220 218 int k = j + offset; 221 var goal = activeGoals[j / 2].Goal; 222 rowValues[k] = goal; // original value 219 rowValues[k] = activeGoals[j / 2].Goal; // original value 223 220 rowValues[k + 1] = estimatedValues[j / 2]; // estimated value 224 221 } -
branches/2679_HeuristicLab.GoalSeekingProblem/HeuristicLab.GoalSeekingProblem/3.4/SingleObjectiveGoalSeekingProblem.cs
r14526 r16901 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 22 using HEAL.Attic; 25 23 using HeuristicLab.Collections; 26 24 using HeuristicLab.Common; … … 30 28 using HeuristicLab.Optimization; 31 29 using HeuristicLab.Parameters; 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;33 30 using HeuristicLab.Problems.DataAnalysis; 31 using System; 32 using System.Collections.Generic; 33 using System.Linq; 34 34 35 35 namespace HeuristicLab.GoalSeeking { 36 36 [Item("Goal seeking problem (single-objective)", "Represents a single objective optimization problem which uses configurable regression solutions to evaluate targets from a given dataset.")] 37 37 [Creatable("Problems")] 38 [Storable Class]38 [StorableType("DD67A460-1A32-414A-AB18-E0C773B46689")] 39 39 public sealed class SingleObjectiveGoalSeekingProblem : SingleObjectiveBasicProblem<RealVectorEncoding>, IGoalSeekingProblem { 40 40 #region parameter names … … 91 91 } 92 92 var rows = new[] { 0 }; // actually just one row 93 var estimatedValues = 94 round ? ActiveGoals.Select(t => RoundToNearestStepMultiple(GetModels(t.Name).Average(m => m.GetEstimatedValues(ds, rows).Single()), t.Step)) 95 : ActiveGoals.Select(t => GetModels(t.Name).Average(m => m.GetEstimatedValues(ds, rows).Single())); 96 return estimatedValues; 93 return round ? ActiveGoals.Select(t => RoundToNearestStepMultiple(GetModels(t.Name).Average(m => m.GetEstimatedValues(ds, rows).Single()), t.Step)) 94 : ActiveGoals.Select(t => GetModels(t.Name).Average(m => m.GetEstimatedValues(ds, rows).Single())); 97 95 } 98 96 … … 118 116 #region constructors 119 117 [StorableConstructor] 120 private SingleObjectiveGoalSeekingProblem( bool deserializing) : base(deserializing) { }118 private SingleObjectiveGoalSeekingProblem(StorableConstructorFlag _) : base(_) { } 121 119 122 120 private SingleObjectiveGoalSeekingProblem(SingleObjectiveGoalSeekingProblem original, Cloner cloner) : base(original, cloner) { … … 156 154 } 157 155 var estimatedValues = GetEstimatedGoalValues(vector, round: true); 158 var quality = ActiveGoals.Zip(estimatedValues, (t, v) => new { Target = t, EstimatedValue = v }) 159 .Average(x => x.Target.Weight * Math.Pow(x.EstimatedValue - x.Target.Goal, 2) / x.Target.Variance); 160 return quality; 156 return ActiveGoals.Zip(estimatedValues, (t, v) => new { Target = t, EstimatedValue = v }) 157 .Average(x => x.Target.Weight * Math.Pow(x.EstimatedValue - x.Target.Goal, 2) / x.Target.Variance); 161 158 } 162 159
Note: See TracChangeset
for help on using the changeset viewer.