- Timestamp:
- 03/07/16 10:18:05 (9 years ago)
- Location:
- branches/WebJobManager
- Files:
-
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/WebJobManager/HeuristicLab.Algorithms.Benchmarks/3.3/Benchmark.cs
r12012 r13656 32 32 [StorableClass] 33 33 public abstract class Benchmark : IBenchmark { 34 public virtual string ItemName { 34 public virtual string ItemName 35 { 35 36 get { return ItemAttribute.GetName(this.GetType()); } 36 37 } 37 public virtual string ItemDescription { 38 public virtual string ItemDescription 39 { 38 40 get { return ItemAttribute.GetDescription(this.GetType()); } 39 41 } 40 public Version ItemVersion { 42 public Version ItemVersion 43 { 41 44 get { return ItemAttribute.GetVersion(this.GetType()); } 42 45 } 43 public static Image StaticItemImage { 44 get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; } 45 } 46 public virtual Image ItemImage { 46 47 public virtual Image ItemImage 48 { 47 49 get { return ItemAttribute.GetImage(this.GetType()); } 48 50 } … … 50 52 [Storable] 51 53 private byte[][] chunk; 52 public byte[][] ChunkData { 54 public byte[][] ChunkData 55 { 53 56 get { return chunk; } 54 57 set { chunk = value; } … … 57 60 [Storable] 58 61 private TimeSpan timeLimit; 59 public TimeSpan TimeLimit { 62 public TimeSpan TimeLimit 63 { 60 64 get { return timeLimit; } 61 65 set { timeLimit = value; } -
branches/WebJobManager/HeuristicLab.Algorithms.Benchmarks/3.3/BenchmarkAlgorithm.cs
r12504 r13656 42 42 private CancellationTokenSource cancellationTokenSource; 43 43 44 public string ItemName { 44 public string ItemName 45 { 45 46 get { return ItemAttribute.GetName(this.GetType()); } 46 47 } 47 public string ItemDescription { 48 public string ItemDescription 49 { 48 50 get { return ItemAttribute.GetDescription(this.GetType()); } 49 51 } 50 public Version ItemVersion { 52 public Version ItemVersion 53 { 51 54 get { return ItemAttribute.GetVersion(this.GetType()); } 52 55 } 53 public static Image StaticItemImage { 54 get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; } 55 } 56 public Image ItemImage { 57 get { 56 public static Image StaticItemImage 57 { 58 get { return new Bitmap(25, 25); } 59 } 60 public Image ItemImage 61 { 62 get 63 { 58 64 if (ExecutionState == ExecutionState.Prepared) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutablePrepared; 59 65 else if (ExecutionState == ExecutionState.Started) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStarted; … … 69 75 [Storable] 70 76 private IBenchmark benchmark; 71 public IBenchmark Benchmark { 77 public IBenchmark Benchmark 78 { 72 79 get { return benchmark; } 73 set { 80 set 81 { 74 82 if (value == null) throw new ArgumentNullException(); 75 83 benchmark = value; … … 79 87 [Storable] 80 88 private ExecutionState executionState; 81 public ExecutionState ExecutionState { 89 public ExecutionState ExecutionState 90 { 82 91 get { return executionState; } 83 private set { 92 private set 93 { 84 94 if (executionState != value) { 85 95 executionState = value; … … 92 102 [Storable] 93 103 private TimeSpan executionTime; 94 public TimeSpan ExecutionTime { 104 public TimeSpan ExecutionTime 105 { 95 106 get { return executionTime; } 96 private set { 107 private set 108 { 97 109 executionTime = value; 98 110 OnExecutionTimeChanged(); … … 102 114 [Storable] 103 115 private bool storeAlgorithmInEachRun; 104 public bool StoreAlgorithmInEachRun { 116 public bool StoreAlgorithmInEachRun 117 { 105 118 get { return storeAlgorithmInEachRun; } 106 set { 119 set 120 { 107 121 if (storeAlgorithmInEachRun != value) { 108 122 storeAlgorithmInEachRun = value; … … 117 131 [Storable] 118 132 private RunCollection runs = new RunCollection(); 119 public RunCollection Runs { 133 public RunCollection Runs 134 { 120 135 get { return runs; } 121 private set { 136 private set 137 { 122 138 if (value == null) throw new ArgumentNullException(); 123 139 if (runs != value) { … … 131 147 [Storable] 132 148 private ResultCollection results; 133 public ResultCollection Results { 149 public ResultCollection Results 150 { 134 151 get { return results; } 135 152 } 136 153 137 public Type ProblemType { 138 get { 154 public Type ProblemType 155 { 156 get 157 { 139 158 // BenchmarkAlgorithm does not have a problem, so return a type which is no problem for sure 140 159 return typeof(BenchmarkAlgorithm); … … 142 161 } 143 162 144 public IProblem Problem { 163 public IProblem Problem 164 { 145 165 get { return null; } 146 166 set { throw new NotImplementedException("BenchmarkAlgorithm does not have a problem."); } … … 149 169 [Storable] 150 170 private string name; 151 public string Name { 171 public string Name 172 { 152 173 get { return name; } 153 set { 174 set 175 { 154 176 if (!CanChangeName) throw new NotSupportedException("Name cannot be changed."); 155 177 if (!(name.Equals(value) || (value == null) && (name == string.Empty))) { … … 164 186 } 165 187 } 166 public bool CanChangeName { 188 public bool CanChangeName 189 { 167 190 get { return true; } 168 191 } … … 170 193 [Storable] 171 194 private string description; 172 public string Description { 195 public string Description 196 { 173 197 get { return description; } 174 set { 198 set 199 { 175 200 if (!CanChangeDescription) throw new NotSupportedException("Description cannot be changed."); 176 201 if (!(description.Equals(value) || (value == null) && (description == string.Empty))) { … … 180 205 } 181 206 } 182 public bool CanChangeDescription { 207 public bool CanChangeDescription 208 { 183 209 get { return true; } 184 210 } … … 186 212 [Storable] 187 213 private ParameterCollection parameters = new ParameterCollection(); 188 public IKeyedItemCollection<string, IParameter> Parameters { 214 public IKeyedItemCollection<string, IParameter> Parameters 215 { 189 216 get { return parameters; } 190 217 } 191 218 private ReadOnlyKeyedItemCollection<string, IParameter> readOnlyParameters; 192 IKeyedItemCollection<string, IParameter> IParameterizedItem.Parameters { 193 get { 219 IKeyedItemCollection<string, IParameter> IParameterizedItem.Parameters 220 { 221 get 222 { 194 223 if (readOnlyParameters == null) readOnlyParameters = parameters.AsReadOnly(); 195 224 return readOnlyParameters; … … 197 226 } 198 227 199 public IEnumerable<IOptimizer> NestedOptimizers { 228 public IEnumerable<IOptimizer> NestedOptimizers 229 { 200 230 get { return Enumerable.Empty<IOptimizer>(); } 201 231 } 202 232 203 233 #region Parameter Properties 204 public IConstrainedValueParameter<IBenchmark> BenchmarkParameter { 234 public IConstrainedValueParameter<IBenchmark> BenchmarkParameter 235 { 205 236 get { return (IConstrainedValueParameter<IBenchmark>)Parameters["Benchmark"]; } 206 237 } 207 private ValueParameter<IntValue> ChunkSizeParameter { 238 private ValueParameter<IntValue> ChunkSizeParameter 239 { 208 240 get { return (ValueParameter<IntValue>)Parameters["ChunkSize"]; } 209 241 } 210 private ValueParameter<DoubleValue> TimeLimitParameter { 242 private ValueParameter<DoubleValue> TimeLimitParameter 243 { 211 244 get { return (ValueParameter<DoubleValue>)Parameters["TimeLimit"]; } 212 245 }
Note: See TracChangeset
for help on using the changeset viewer.