- Timestamp:
- 03/28/12 15:47:26 (13 years ago)
- Location:
- branches/HeuristicLab.Hive.Azure
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive.Azure
- Property svn:ignore
-
old new 3 3 *.resharper 4 4 *.suo 5 *.user 5 6 *.vsp 6 7 Doxygen 8 FxCopResults.txt 7 9 Google.ProtocolBuffers-0.9.1.dll 8 10 HeuristicLab 3.3.5.1.ReSharper.user
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HeuristicLab.Hive.Azure/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs
r7270 r7669 240 240 } 241 241 242 protected override IEnumerable<KeyValuePair<string, IItem>> GetCollectedValues(IItem value) { 243 var children = base.GetCollectedValues(value); 244 foreach (var child in children) { 245 if (child.Value is IOperator) 246 yield return new KeyValuePair<string, IItem>(child.Key, new StringValue(((IOperator)child.Value).Name)); 247 else yield return child; 248 } 249 } 250 242 251 #region Events 243 252 public event EventHandler ExecutionStateChanged; … … 265 274 ExecutionState = ExecutionState.Prepared; 266 275 ExecutionTime = TimeSpan.Zero; 267 foreach (IStatefulItem statefulObject in this.GetObjectGraphObjects( ).OfType<IStatefulItem>()) {276 foreach (IStatefulItem statefulObject in this.GetObjectGraphObjects(new HashSet<string>() { "runs" }).OfType<IStatefulItem>()) { 268 277 statefulObject.InitializeState(); 269 278 } … … 286 295 protected virtual void OnStopped() { 287 296 ExecutionState = ExecutionState.Stopped; 288 foreach (IStatefulItem statefulObject in this.GetObjectGraphObjects( ).OfType<IStatefulItem>()) {297 foreach (IStatefulItem statefulObject in this.GetObjectGraphObjects(new HashSet<string>() { "runs" }).OfType<IStatefulItem>()) { 289 298 statefulObject.ClearState(); 290 299 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Optimization/3.3/BatchRun.cs
r7270 r7669 339 339 private void Optimizer_Paused(object sender, EventArgs e) { 340 340 if (ExecutionState == ExecutionState.Started) { 341 batchRunStarted = false;342 batchRunPaused = true;343 batchRunStopped = false;344 341 OnPaused(); 345 342 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Optimization/3.3/Experiment.cs
r7270 r7669 337 337 private void optimizer_Prepared(object sender, EventArgs e) { 338 338 if (Optimizers.All(x => x.ExecutionState == ExecutionState.Prepared)) OnPrepared(); 339 else if (Optimizers.All(x => x.ExecutionState != ExecutionState.Started)) OnPaused();340 339 } 341 340 private void optimizer_Started(object sender, EventArgs e) { -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Optimization/3.3/Problems/Problem.cs
r7270 r7669 26 26 using HeuristicLab.Common; 27 27 using HeuristicLab.Core; 28 using HeuristicLab.Data; 28 29 using HeuristicLab.Parameters; 29 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 44 45 45 46 [StorableConstructor] 46 protected Problem(bool deserializing) 47 : base(deserializing) { 48 operators = new OperatorCollection(); // operators must never be null 49 } 47 protected Problem(bool deserializing) : base(deserializing) { } 50 48 protected Problem(Problem original, Cloner cloner) 51 49 : base(original, cloner) { 52 operators = cloner.Clone(original.operators);53 50 RegisterEventHandlers(); 54 51 } … … 56 53 protected Problem() 57 54 : base() { 58 operators = new OperatorCollection(); 59 Parameters.Add(new FixedValueParameter<OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", operators, false)); 55 Parameters.Add(new FixedValueParameter<OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", new OperatorCollection(), false)); 60 56 OperatorsParameter.Hidden = true; 61 57 RegisterEventHandlers(); … … 64 60 [StorableHook(HookType.AfterDeserialization)] 65 61 private void AfterDeserialization() { 66 // BackwardsCompatibility3.367 #region Backwards compatible code, remove with 3.468 if (!Parameters.ContainsKey(OperatorsParameterName)) {69 Parameters.Add(new FixedValueParameter<OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", operators, false));70 OperatorsParameter.Hidden = true;71 }72 #endregion73 62 RegisterEventHandlers(); 74 63 } … … 81 70 82 71 #region properties 83 private OperatorCollection operators; 72 // BackwardsCompatibility3.3 73 #region Backwards compatible code, remove with 3.4 84 74 [Storable(Name = "Operators")] 85 75 private IEnumerable<IOperator> StorableOperators { 86 get { return operators; } 87 set { operators = new OperatorCollection(value); } 76 get { return null; } 77 set { 78 if (!Parameters.ContainsKey(OperatorsParameterName)) { 79 Parameters.Add(new FixedValueParameter<OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", new OperatorCollection(value), false)); 80 OperatorsParameter.Hidden = true; 81 } 82 } 88 83 } 84 #endregion 89 85 protected OperatorCollection Operators { 90 get { return this.operators; } 86 get { 87 // BackwardsCompatibility3.3 88 #region Backwards compatible code, remove with 3.4 89 if (!Parameters.ContainsKey(OperatorsParameterName)) { 90 Parameters.Add(new FixedValueParameter<OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", new OperatorCollection(), false)); 91 OperatorsParameter.Hidden = true; 92 } 93 #endregion 94 return OperatorsParameter.Value; 95 } 91 96 } 92 IEnumerable<IOperator> IProblem.Operators { get { return operators; } }97 IEnumerable<IOperator> IProblem.Operators { get { return Operators; } } 93 98 #endregion 99 100 protected override IEnumerable<KeyValuePair<string, IItem>> GetCollectedValues(IItem value) { 101 var children = base.GetCollectedValues(value); 102 foreach (var child in children) { 103 if (child.Value is IOperator) 104 yield return new KeyValuePair<string, IItem>(child.Key, new StringValue(((IOperator)child.Value).Name)); 105 else yield return child; 106 } 107 } 94 108 95 109 #region events -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Optimization/3.3/Problems/SingleObjectiveHeuristicOptimizationProblem.cs
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Optimization/3.3/Problems/SingleObjectiveHeuristicOptimizationProblem.cs merged: 7440,7442
r7270 r7669 41 41 : base() { 42 42 Parameters.Add(new ValueParameter<BoolValue>(MaximizationParameterName, "Set to false if the problem should be minimized.", new BoolValue())); 43 Parameters.Add(new OptionalValueParameter<DoubleValue>(BestKnownQualityParameterName, "The quality of the best known solution of this problem." , new DoubleValue()));43 Parameters.Add(new OptionalValueParameter<DoubleValue>(BestKnownQualityParameterName, "The quality of the best known solution of this problem.")); 44 44 } 45 45 … … 47 47 : base(evaluator, solutionCreator) { 48 48 Parameters.Add(new ValueParameter<BoolValue>(MaximizationParameterName, "Set to false if the problem should be minimized.", new BoolValue())); 49 Parameters.Add(new OptionalValueParameter<DoubleValue>(BestKnownQualityParameterName, "The quality of the best known solution of this problem." , new DoubleValue()));49 Parameters.Add(new OptionalValueParameter<DoubleValue>(BestKnownQualityParameterName, "The quality of the best known solution of this problem.")); 50 50 } 51 51 … … 68 68 public BoolValue Maximization { 69 69 get { return MaximizationParameter.Value; } 70 protectedset { MaximizationParameter.Value = value; }70 set { MaximizationParameter.Value = value; } 71 71 } 72 72 … … 79 79 public DoubleValue BestKnownQuality { 80 80 get { return BestKnownQualityParameter.Value; } 81 protectedset { BestKnownQualityParameter.Value = value; }81 set { BestKnownQualityParameter.Value = value; } 82 82 } 83 83 - Property svn:mergeinfo changed
-
branches/HeuristicLab.Hive.Azure/HeuristicLab.Optimization/3.3/Problems/UserDefinedProblem.cs
r7270 r7669 121 121 [StorableHook(HookType.AfterDeserialization)] 122 122 private void AfterDeserialization() { 123 AttachEventHandlers();123 RegisterEventHandlers(); 124 124 } 125 125 public UserDefinedProblem() … … 132 132 Parameters.Add(new ValueParameter<ItemList<IOperator>>("Operators", "The operators that are passed to the algorithm.", new ItemList<IOperator>())); 133 133 134 AttachEventHandlers();134 RegisterEventHandlers(); 135 135 } 136 136 137 137 private UserDefinedProblem(UserDefinedProblem original, Cloner cloner) 138 138 : base(original, cloner) { 139 AttachEventHandlers();139 RegisterEventHandlers(); 140 140 } 141 141 public override IDeepCloneable Clone(Cloner cloner) { … … 194 194 195 195 #region Helpers 196 private void AttachEventHandlers() {196 private void RegisterEventHandlers() { 197 197 SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged); 198 198 EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged);
Note: See TracChangeset
for help on using the changeset viewer.