Changeset 5355 for branches/OKB (trunk integration)
- Timestamp:
- 01/22/11 02:38:40 (14 years ago)
- Location:
- branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/HeuristicLab.Clients.OKB-3.3.csproj
r5344 r5355 100 100 <ItemGroup> 101 101 <Compile Include="AdministratorMenuItem.cs" /> 102 <Compile Include="ItemWrapper.cs" /> 103 <Compile Include="NamedItemWrapper.cs" /> 104 <Compile Include="OKBRun.cs" /> 102 105 <Compile Include="EmptyAlgorithm.cs" /> 103 106 <Compile Include="OKBAlgorithm.cs" /> -
branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/MultiObjectiveOKBProblem.cs
r5344 r5355 30 30 [Creatable("Optimization Knowledge Base (OKB)")] 31 31 [StorableClass] 32 public sealed class MultiObjectiveOKBProblem : OKBProblem, IMultiObjectiveProblem { 32 public sealed class MultiObjectiveOKBProblem : OKBProblem, IMultiObjectiveProblem, IStorableContent { 33 public string Filename { get; set; } 34 33 35 public override Type ProblemType { 34 36 get { return typeof(IMultiObjectiveProblem); } -
branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/OKBAlgorithm.cs
r5344 r5355 24 24 using System.Drawing; 25 25 using System.IO; 26 using HeuristicLab.Collections; 26 27 using HeuristicLab.Common; 27 28 using HeuristicLab.Core; … … 34 35 [Creatable("Optimization Knowledge Base (OKB)")] 35 36 [StorableClass] 36 public sealed class OKBAlgorithm : Item, IAlgorithm { 37 public sealed class OKBAlgorithm : Item, IAlgorithm, IStorableContent { 38 public string Filename { get; set; } 39 37 40 private long algorithmId; 38 41 public long AlgorithmId { … … 48 51 OnNameChanging(e); 49 52 if (!e.Cancel) { 53 IProblem problem = algorithm.Problem; 50 54 DeregisterAlgorithmEvents(); 51 55 algorithm = value; … … 57 61 OnDescriptionChanged(); 58 62 OnAlgorithmChanged(); 63 OnStoreAlgorithmInEachRunChanged(); 64 65 try { 66 algorithm.Problem = problem; 67 } 68 catch (ArgumentException) { 69 algorithm.Problem = null; 70 } 71 algorithm.Prepare(true); 59 72 } 60 73 } … … 104 117 } 105 118 119 private int runsCounter; 120 private RunCollection runs; 106 121 public RunCollection Runs { 107 get { return Algorithm.Runs; }122 get { return runs; } 108 123 } 109 124 public bool StoreAlgorithmInEachRun { … … 124 139 algorithm = value; 125 140 RegisterAlgorithmEvents(); 141 } 142 } 143 [Storable(Name = "RunsCounter")] 144 private int StorableRunsCounter { 145 get { return runsCounter; } 146 set { runsCounter = value; } 147 } 148 [Storable(Name = "Runs")] 149 private RunCollection StorableRuns { 150 get { return runs; } 151 set { 152 runs = value; 153 RegisterRunsEvents(); 126 154 } 127 155 } … … 135 163 algorithm = cloner.Clone(original.algorithm); 136 164 RegisterAlgorithmEvents(); 165 runsCounter = original.runsCounter; 166 runs = cloner.Clone(original.runs); 167 RegisterRunsEvents(); 137 168 } 138 169 public OKBAlgorithm() … … 141 172 algorithm = new EmptyAlgorithm("No algorithm selected. Please choose an algorithm from the OKB."); 142 173 RegisterAlgorithmEvents(); 174 runsCounter = 0; 175 runs = new RunCollection(); 176 RegisterRunsEvents(); 143 177 } 144 178 … … 167 201 168 202 public void Prepare() { 169 Algorithm.Prepare( );203 Algorithm.Prepare(true); 170 204 } 171 205 public void Prepare(bool clearRuns) { 172 Algorithm.Prepare(clearRuns); 206 if (clearRuns) runs.Clear(); 207 Algorithm.Prepare(true); 173 208 } 174 209 public void Start() { … … 240 275 public event EventHandler Stopped; 241 276 private void OnStopped() { 277 runsCounter++; 278 runs.Add(new HeuristicLab.Optimization.Run(string.Format("{0} Run {1}", Name, runsCounter), this)); 242 279 var handler = Stopped; 243 280 if (handler != null) handler(this, EventArgs.Empty); … … 328 365 OnExceptionOccurred(e.Value); 329 366 } 367 368 private void RegisterRunsEvents() { 369 runs.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Runs_CollectionReset); 370 } 371 private void Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) { 372 runsCounter = runs.Count; 373 } 330 374 #endregion 331 375 } -
branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/SingleObjectiveOKBProblem.cs
r5344 r5355 30 30 [Creatable("Optimization Knowledge Base (OKB)")] 31 31 [StorableClass] 32 public sealed class SingleObjectiveOKBProblem : OKBProblem, ISingleObjectiveProblem { 32 public sealed class SingleObjectiveOKBProblem : OKBProblem, ISingleObjectiveProblem, IStorableContent { 33 public string Filename { get; set; } 34 33 35 public override Type ProblemType { 34 36 get { return typeof(ISingleObjectiveProblem); }
Note: See TracChangeset
for help on using the changeset viewer.