Changeset 13656 for branches/WebJobManager/HeuristicLab.Optimization
- Timestamp:
- 03/07/16 10:18:05 (9 years ago)
- Location:
- branches/WebJobManager
- Files:
-
- 9 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/WebJobManager/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs
r12012 r13656 37 37 [StorableClass] 38 38 public abstract class Algorithm : ParameterizedNamedItem, IAlgorithm { 39 public static new Image StaticItemImage { 40 get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; } 41 } 42 public override Image ItemImage { 43 get { 39 public static new Image StaticItemImage 40 { 41 get { return new Bitmap(25, 25); } 42 } 43 public override Image ItemImage 44 { 45 get 46 { 44 47 if (ExecutionState == ExecutionState.Prepared) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutablePrepared; 45 48 else if (ExecutionState == ExecutionState.Started) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStarted; … … 52 55 [Storable] 53 56 private ExecutionState executionState; 54 public ExecutionState ExecutionState { 57 public ExecutionState ExecutionState 58 { 55 59 get { return executionState; } 56 private set { 60 private set 61 { 57 62 if (executionState != value) { 58 63 executionState = value; … … 65 70 [Storable] 66 71 private TimeSpan executionTime; 67 public TimeSpan ExecutionTime { 72 public TimeSpan ExecutionTime 73 { 68 74 get { return executionTime; } 69 protected set { 75 protected set 76 { 70 77 executionTime = value; 71 78 OnExecutionTimeChanged(); … … 73 80 } 74 81 75 public virtual Type ProblemType { 82 public virtual Type ProblemType 83 { 76 84 get { return typeof(IProblem); } 77 85 } … … 79 87 [Storable] 80 88 private IProblem problem; 81 public IProblem Problem { 89 public IProblem Problem 90 { 82 91 get { return problem; } 83 set { 92 set 93 { 84 94 if (problem != value) { 85 95 if ((value != null) && !ProblemType.IsInstanceOfType(value)) throw new ArgumentException("Invalid problem type."); … … 97 107 [Storable] 98 108 private bool storeAlgorithmInEachRun; 99 public bool StoreAlgorithmInEachRun { 109 public bool StoreAlgorithmInEachRun 110 { 100 111 get { return storeAlgorithmInEachRun; } 101 set { 112 set 113 { 102 114 if (storeAlgorithmInEachRun != value) { 103 115 storeAlgorithmInEachRun = value; … … 112 124 [Storable] 113 125 private RunCollection runs; 114 public RunCollection Runs { 126 public RunCollection Runs 127 { 115 128 get { return runs; } 116 protected set { 129 protected set 130 { 117 131 if (value == null) throw new ArgumentNullException(); 118 132 if (runs != value) { … … 124 138 } 125 139 126 public virtual IEnumerable<IOptimizer> NestedOptimizers { 140 public virtual IEnumerable<IOptimizer> NestedOptimizers 141 { 127 142 get { return Enumerable.Empty<IOptimizer>(); } 128 143 } -
branches/WebJobManager/HeuristicLab.Optimization/3.3/MetaOptimizers/BatchRun.cs
r12504 r13656 41 41 public string Filename { get; set; } 42 42 43 public static new Image StaticItemImage { 44 get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; } 45 } 46 public override Image ItemImage { 47 get { 43 public static new Image StaticItemImage 44 { 45 get { return new Bitmap(25, 25); } 46 } 47 public override Image ItemImage 48 { 49 get 50 { 48 51 if (ExecutionState == ExecutionState.Prepared) return HeuristicLab.Common.Resources.VSImageLibrary.BatchRunPrepared; 49 52 else if (ExecutionState == ExecutionState.Started) return HeuristicLab.Common.Resources.VSImageLibrary.BatchRunStarted; … … 56 59 [Storable] 57 60 private ExecutionState executionState; 58 public ExecutionState ExecutionState { 61 public ExecutionState ExecutionState 62 { 59 63 get { return executionState; } 60 private set { 64 private set 65 { 61 66 if (executionState != value) { 62 67 executionState = value; … … 69 74 [Storable] 70 75 private TimeSpan executionTime; 71 public TimeSpan ExecutionTime { 72 get { 76 public TimeSpan ExecutionTime 77 { 78 get 79 { 73 80 if ((Optimizer != null) && (Optimizer.ExecutionState != ExecutionState.Stopped)) 74 81 return executionTime + Optimizer.ExecutionTime; … … 76 83 return executionTime; 77 84 } 78 private set { 85 private set 86 { 79 87 executionTime = value; 80 88 OnExecutionTimeChanged(); … … 87 95 [Storable] 88 96 private IOptimizer optimizer; 89 public IOptimizer Optimizer { 97 public IOptimizer Optimizer 98 { 90 99 get { return optimizer; } 91 set { 100 set 101 { 92 102 if (optimizer != value) { 93 103 if (optimizer != null) { … … 110 120 #region Backwards compatible code (remove with 3.4) 111 121 [Storable(AllowOneWay = true)] 112 private IAlgorithm algorithm { 122 private IAlgorithm algorithm 123 { 113 124 set { optimizer = value; } 114 125 } … … 117 128 [Storable] 118 129 private int repetitions; 119 public int Repetitions { 130 public int Repetitions 131 { 120 132 get { return repetitions; } 121 set { 133 set 134 { 122 135 if (repetitions != value) { 123 136 repetitions = value; … … 130 143 [Storable] 131 144 private int repetitionsCounter; 132 public int RepetitionsCounter { 145 public int RepetitionsCounter 146 { 133 147 get { return repetitionsCounter; } 134 private set { 148 private set 149 { 135 150 if (value != repetitionsCounter) { 136 151 repetitionsCounter = value; … … 142 157 [Storable] 143 158 private RunCollection runs; 144 public RunCollection Runs { 159 public RunCollection Runs 160 { 145 161 get { return runs; } 146 private set { 162 private set 163 { 147 164 if (value == null) throw new ArgumentNullException(); 148 165 if (runs != value) { … … 154 171 } 155 172 156 public IEnumerable<IOptimizer> NestedOptimizers { 157 get { 173 public IEnumerable<IOptimizer> NestedOptimizers 174 { 175 get 176 { 158 177 if (Optimizer == null) yield break; 159 178 -
branches/WebJobManager/HeuristicLab.Optimization/3.3/MetaOptimizers/Experiment.cs
r13000 r13656 40 40 public string Filename { get; set; } 41 41 42 public static new Image StaticItemImage { 43 get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; } 44 } 45 public override Image ItemImage { 46 get { 42 public static new Image StaticItemImage 43 { 44 get { return new Bitmap(25, 25); } 45 } 46 public override Image ItemImage 47 { 48 get 49 { 47 50 if (ExecutionState == ExecutionState.Prepared) return HeuristicLab.Common.Resources.VSImageLibrary.ExperimentPrepared; 48 51 else if (ExecutionState == ExecutionState.Started) return HeuristicLab.Common.Resources.VSImageLibrary.ExperimentStarted; … … 55 58 [Storable] 56 59 private ExecutionState executionState; 57 public ExecutionState ExecutionState { 60 public ExecutionState ExecutionState 61 { 58 62 get { return executionState; } 59 private set { 63 private set 64 { 60 65 if (executionState != value) { 61 66 executionState = value; … … 68 73 [Storable] 69 74 private TimeSpan executionTime; 70 public TimeSpan ExecutionTime { 75 public TimeSpan ExecutionTime 76 { 71 77 get { return executionTime; } 72 private set { 78 private set 79 { 73 80 executionTime = value; 74 81 OnExecutionTimeChanged(); … … 78 85 [Storable] 79 86 private OptimizerList optimizers; 80 public OptimizerList Optimizers { 87 public OptimizerList Optimizers 88 { 81 89 get { return optimizers; } 82 90 } … … 84 92 [Storable] 85 93 private RunCollection runs; 86 public RunCollection Runs { 94 public RunCollection Runs 95 { 87 96 get { return runs; } 88 private set { 97 private set 98 { 89 99 if (value == null) throw new ArgumentNullException(); 90 100 if (runs != value) { … … 96 106 } 97 107 98 public IEnumerable<IOptimizer> NestedOptimizers { 99 get { 108 public IEnumerable<IOptimizer> NestedOptimizers 109 { 110 get 111 { 100 112 if (Optimizers == null) yield break; 101 113 -
branches/WebJobManager/HeuristicLab.Optimization/3.3/MetaOptimizers/TimeLimitRun.cs
r13321 r13656 43 43 44 44 #region ItemImage 45 public static new Image StaticItemImage { 46 get { return VSImageLibrary.Event; } 47 } 48 public override Image ItemImage { 45 public static new Image StaticItemImage 46 { 47 get { return new Bitmap(25, 25); } 48 } 49 public override Image ItemImage 50 { 49 51 get { return (Algorithm != null) ? Algorithm.ItemImage : VSImageLibrary.ExecutableStopped; } 50 52 } … … 56 58 [Storable] 57 59 private TimeSpan maximumExecutionTime; 58 public TimeSpan MaximumExecutionTime { 60 public TimeSpan MaximumExecutionTime 61 { 59 62 get { return maximumExecutionTime; } 60 set { 63 set 64 { 61 65 if (maximumExecutionTime == value) return; 62 66 maximumExecutionTime = value; … … 69 73 [Storable] 70 74 private ObservableList<TimeSpan> snapshotTimes; 71 public ObservableList<TimeSpan> SnapshotTimes { 75 public ObservableList<TimeSpan> SnapshotTimes 76 { 72 77 get { return snapshotTimes; } 73 set { 78 set 79 { 74 80 if (snapshotTimes == value) return; 75 81 snapshotTimes = value; … … 83 89 private bool storeAlgorithmInEachSnapshot; 84 90 [Storable] 85 public bool StoreAlgorithmInEachSnapshot { 91 public bool StoreAlgorithmInEachSnapshot 92 { 86 93 get { return storeAlgorithmInEachSnapshot; } 87 set { 94 set 95 { 88 96 if (storeAlgorithmInEachSnapshot == value) return; 89 97 storeAlgorithmInEachSnapshot = value; … … 94 102 [Storable] 95 103 private RunCollection snapshots; 96 public RunCollection Snapshots { 104 public RunCollection Snapshots 105 { 97 106 get { return snapshots; } 98 set { 107 set 108 { 99 109 if (snapshots == value) return; 100 110 snapshots = value; … … 104 114 105 115 #region Inherited Properties 106 public ExecutionState ExecutionState { 116 public ExecutionState ExecutionState 117 { 107 118 get { return (Algorithm != null) ? Algorithm.ExecutionState : ExecutionState.Stopped; } 108 119 } 109 120 110 public TimeSpan ExecutionTime { 121 public TimeSpan ExecutionTime 122 { 111 123 get { return (Algorithm != null) ? Algorithm.ExecutionTime : TimeSpan.FromSeconds(0); } 112 124 } … … 114 126 [Storable] 115 127 private IAlgorithm algorithm; 116 public IAlgorithm Algorithm { 128 public IAlgorithm Algorithm 129 { 117 130 get { return algorithm; } 118 set { 131 set 132 { 119 133 if (algorithm == value) return; 120 134 if (algorithm != null) DeregisterAlgorithmEvents(); … … 130 144 [Storable] 131 145 private RunCollection runs; 132 public RunCollection Runs { 146 public RunCollection Runs 147 { 133 148 get { return runs; } 134 private set { 149 private set 150 { 135 151 if (value == null) throw new ArgumentNullException(); 136 152 if (runs == value) return; … … 140 156 } 141 157 142 public IEnumerable<IOptimizer> NestedOptimizers { 143 get { 158 public IEnumerable<IOptimizer> NestedOptimizers 159 { 160 get 161 { 144 162 if (Algorithm == null) yield break; 145 163 yield return Algorithm; -
branches/WebJobManager/HeuristicLab.Optimization/3.3/Problems/Problem.cs
r12012 r13656 35 35 public abstract class Problem : ParameterizedNamedItem, IProblem { 36 36 private const string OperatorsParameterName = "Operators"; 37 public IFixedValueParameter<ItemCollection<IItem>> OperatorsParameter { 37 public IFixedValueParameter<ItemCollection<IItem>> OperatorsParameter 38 { 38 39 get { return (IFixedValueParameter<ItemCollection<IItem>>)Parameters[OperatorsParameterName]; } 39 40 } 40 41 41 public static new Image StaticItemImage { 42 get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; } 42 public static new Image StaticItemImage 43 { 44 get { return new Bitmap(25, 25); } 43 45 } 44 46 … … 85 87 #region Backwards compatible code, remove with 3.4 86 88 [Storable(Name = "Operators", AllowOneWay = true)] 87 private IEnumerable<IOperator> StorableOperators { 88 set { 89 private IEnumerable<IOperator> StorableOperators 90 { 91 set 92 { 89 93 IParameter operatorsParam; 90 94 if (Parameters.TryGetValue(OperatorsParameterName, out operatorsParam)) { … … 102 106 } 103 107 #endregion 104 protected ItemCollection<IItem> Operators { 105 get { 108 protected ItemCollection<IItem> Operators 109 { 110 get 111 { 106 112 // BackwardsCompatibility3.3 107 113 #region Backwards compatible code, remove with 3.4 … … 120 126 } 121 127 122 public virtual IEnumerable<IParameterizedItem> ExecutionContextItems { 128 public virtual IEnumerable<IParameterizedItem> ExecutionContextItems 129 { 123 130 get { yield return this; } 124 131 } -
branches/WebJobManager/HeuristicLab.Optimization/3.3/Problems/UserDefinedProblem.cs
r12504 r13656 43 43 public string Filename { get; set; } 44 44 45 public static new Image StaticItemImage { 46 get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; } 47 } 48 public new ParameterCollection Parameters { 45 public static new Image StaticItemImage 46 { 47 get { return new Bitmap(25, 25); } 48 } 49 public new ParameterCollection Parameters 50 { 49 51 get { return base.Parameters; } 50 52 } 51 IKeyedItemCollection<string, IParameter> IParameterizedItem.Parameters { 53 IKeyedItemCollection<string, IParameter> IParameterizedItem.Parameters 54 { 52 55 get { return Parameters; } 53 56 } 54 57 55 58 #region Parameters 56 public IValueParameter<ISingleObjectiveEvaluator> EvaluatorParameter { 59 public IValueParameter<ISingleObjectiveEvaluator> EvaluatorParameter 60 { 57 61 get { return (IValueParameter<ISingleObjectiveEvaluator>)Parameters["Evaluator"]; } 58 62 } 59 public ValueParameter<BoolValue> MaximizationParameter { 63 public ValueParameter<BoolValue> MaximizationParameter 64 { 60 65 get { return (ValueParameter<BoolValue>)Parameters["Maximization"]; } 61 66 } 62 IParameter ISingleObjectiveHeuristicOptimizationProblem.MaximizationParameter { 67 IParameter ISingleObjectiveHeuristicOptimizationProblem.MaximizationParameter 68 { 63 69 get { return MaximizationParameter; } 64 70 } 65 public ValueParameter<ISolutionCreator> SolutionCreatorParameter { 71 public ValueParameter<ISolutionCreator> SolutionCreatorParameter 72 { 66 73 get { return (ValueParameter<ISolutionCreator>)Parameters["SolutionCreator"]; } 67 74 } 68 IParameter IHeuristicOptimizationProblem.SolutionCreatorParameter { 75 IParameter IHeuristicOptimizationProblem.SolutionCreatorParameter 76 { 69 77 get { return SolutionCreatorParameter; } 70 78 } 71 IParameter IHeuristicOptimizationProblem.EvaluatorParameter { 79 IParameter IHeuristicOptimizationProblem.EvaluatorParameter 80 { 72 81 get { return EvaluatorParameter; } 73 82 } 74 public OptionalValueParameter<DoubleValue> BestKnownQualityParameter { 83 public OptionalValueParameter<DoubleValue> BestKnownQualityParameter 84 { 75 85 get { return (OptionalValueParameter<DoubleValue>)Parameters["BestKnownQuality"]; } 76 86 } 77 IParameter ISingleObjectiveHeuristicOptimizationProblem.BestKnownQualityParameter { 87 IParameter ISingleObjectiveHeuristicOptimizationProblem.BestKnownQualityParameter 88 { 78 89 get { return BestKnownQualityParameter; } 79 90 } 80 public OptionalValueParameter<IScope> BestKnownSolutionParameter { 91 public OptionalValueParameter<IScope> BestKnownSolutionParameter 92 { 81 93 get { return (OptionalValueParameter<IScope>)Parameters["BestKnownSolution"]; } 82 94 } 83 public ValueParameter<ItemList<IItem>> OperatorsParameter { 95 public ValueParameter<ItemList<IItem>> OperatorsParameter 96 { 84 97 get { return (ValueParameter<ItemList<IItem>>)Parameters["Operators"]; } 85 98 } … … 87 100 88 101 #region Properties 89 public BoolValue Maximization { 102 public BoolValue Maximization 103 { 90 104 get { return MaximizationParameter.Value; } 91 105 set { MaximizationParameter.Value = value; } 92 106 } 93 public ISolutionCreator SolutionCreator { 107 public ISolutionCreator SolutionCreator 108 { 94 109 get { return SolutionCreatorParameter.Value; } 95 110 set { SolutionCreatorParameter.Value = value; } 96 111 } 97 ISolutionCreator IHeuristicOptimizationProblem.SolutionCreator { 112 ISolutionCreator IHeuristicOptimizationProblem.SolutionCreator 113 { 98 114 get { return SolutionCreatorParameter.Value; } 99 115 } 100 public ISingleObjectiveEvaluator Evaluator { 116 public ISingleObjectiveEvaluator Evaluator 117 { 101 118 get { return EvaluatorParameter.Value; } 102 119 set { EvaluatorParameter.Value = value; } 103 120 } 104 ISingleObjectiveEvaluator ISingleObjectiveHeuristicOptimizationProblem.Evaluator { 121 ISingleObjectiveEvaluator ISingleObjectiveHeuristicOptimizationProblem.Evaluator 122 { 105 123 get { return EvaluatorParameter.Value; } 106 124 } 107 IEvaluator IHeuristicOptimizationProblem.Evaluator { 125 IEvaluator IHeuristicOptimizationProblem.Evaluator 126 { 108 127 get { return EvaluatorParameter.Value; } 109 128 } 110 public DoubleValue BestKnownQuality { 129 public DoubleValue BestKnownQuality 130 { 111 131 get { return BestKnownQualityParameter.Value; } 112 132 set { BestKnownQualityParameter.Value = value; } 113 133 } 114 public IEnumerable<IItem> Operators { 134 public IEnumerable<IItem> Operators 135 { 115 136 get { return OperatorsParameter.Value; } 116 137 } 117 138 118 public IEnumerable<IParameterizedItem> ExecutionContextItems { 139 public IEnumerable<IParameterizedItem> ExecutionContextItems 140 { 119 141 get { yield return this; } 120 142 } … … 250 272 #region ISingleObjectiveEvaluator Members 251 273 252 public ILookupParameter<DoubleValue> QualityParameter { 274 public ILookupParameter<DoubleValue> QualityParameter 275 { 253 276 get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; } 254 277 } … … 276 299 #endregion 277 300 278 public static new Image StaticItemImage { 279 get { return HeuristicLab.Common.Resources.VSImageLibrary.Method; } 301 public static new Image StaticItemImage 302 { 303 get { return new Bitmap(25, 25); } 280 304 } 281 305 } -
branches/WebJobManager/HeuristicLab.Optimization/3.3/ResultCollection.cs
r12012 r13656 21 21 22 22 using System.Collections.Generic; 23 using System.Drawing; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; … … 41 42 } 42 43 43 public static new System.Drawing.Image StaticItemImage { 44 get { return HeuristicLab.Common.Resources.VSImageLibrary.Object; } 44 public static new System.Drawing.Image StaticItemImage 45 { 46 get { return new Bitmap(25, 25); } 45 47 } 46 48 -
branches/WebJobManager/HeuristicLab.Optimization/3.3/Termination/MultiTerminator.cs
r12529 r13656 35 35 [StorableClass] 36 36 public sealed class MultiTerminator : CheckedMultiOperator<ITerminator>, ITerminator { 37 public static new Image StaticItemImage { 38 get { return HeuristicLab.Common.Resources.VSImageLibrary.FlagRed; } 37 public static new Image StaticItemImage 38 { 39 get { return new Bitmap(25, 25); } 39 40 } 40 41 41 public ILookupParameter<BoolValue> TerminateParameter { 42 public ILookupParameter<BoolValue> TerminateParameter 43 { 42 44 get { return (ILookupParameter<BoolValue>)Parameters["Terminate"]; } 43 45 } -
branches/WebJobManager/HeuristicLab.Optimization/3.3/Termination/Terminator.cs
r12529 r13656 33 33 [StorableClass] 34 34 public abstract class Terminator : SingleSuccessorOperator, ITerminator { 35 public static new Image StaticItemImage { 36 get { return HeuristicLab.Common.Resources.VSImageLibrary.FlagRed; } 35 public static new Image StaticItemImage 36 { 37 get { return new Bitmap(25, 25); } 37 38 } 38 39 39 public ILookupParameter<BoolValue> TerminateParameter { 40 public ILookupParameter<BoolValue> TerminateParameter 41 { 40 42 get { return (ILookupParameter<BoolValue>)Parameters["Terminate"]; } 41 43 }
Note: See TracChangeset
for help on using the changeset viewer.