Changeset 11303 for branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Algorithms.VariableNeighborhoodSearch
- Timestamp:
- 08/26/14 13:05:22 (10 years ago)
- Location:
- branches/HeuristicLab.Problems.Orienteering
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.Orienteering
- Property svn:mergeinfo changed
/trunk/sources merged: 11214,11241,11248-11251,11256,11263,11274,11280,11282-11283,11290,11292,11294-11296,11298,11300,11302
- Property svn:mergeinfo changed
-
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Algorithms.VariableNeighborhoodSearch/3.3/VariableNeighborhoodSearch.cs
r11247 r11303 283 283 private void ParameterizeLocalImprovementOperators() { 284 284 foreach (ILocalImprovementOperator op in LocalImprovementParameter.ValidValues) { 285 if (op != LocalImprovementParameter.Value) op.Problem = null;286 285 op.MaximumIterationsParameter.Value = null; 287 286 op.MaximumIterationsParameter.ActualName = LocalImprovementMaximumIterationsParameter.Name; 288 } 289 if (LocalImprovementParameter.Value != null) 290 LocalImprovementParameter.Value.Problem = Problem; 287 288 var algOp = op as ILocalImprovementAlgorithmOperator; 289 if (algOp != null && algOp != LocalImprovementParameter.Value) algOp.Problem = null; 290 } 291 if (LocalImprovementParameter.Value is ILocalImprovementAlgorithmOperator) 292 ((ILocalImprovementAlgorithmOperator)LocalImprovementParameter.Value).Problem = Problem; 291 293 } 292 294 private void InitializeLocalImprovementOperators() { 293 if (Problem == null) { 294 LocalImprovementParameter.ValidValues.Clear(); 295 } else { 296 foreach (var entry in LocalImprovementParameter.ValidValues.ToList()) { 297 if (!entry.ProblemType.IsAssignableFrom(Problem.GetType())) { 298 LocalImprovementParameter.ValidValues.Remove(entry); 299 } 300 } 301 foreach (var op in Problem.Operators.OfType<ILocalImprovementOperator>()) { 295 LocalImprovementParameter.ValidValues.Clear(); 296 if (Problem != null) { 297 // Regular ILocalImprovementOperators queried from Problem 298 foreach (var op in Problem.Operators.OfType<ILocalImprovementOperator>().Where(x => !(x is ILocalImprovementAlgorithmOperator))) { 302 299 LocalImprovementParameter.ValidValues.Add(op); 303 300 } 304 foreach (ILocalImprovementOperator op in ApplicationManager.Manager.GetInstances<ILocalImprovementOperator>().Where(x => x.ProblemType.IsAssignableFrom(Problem.GetType()))) { 305 if (!LocalImprovementParameter.ValidValues.Any(x => x.GetType() == op.GetType())) 301 // ILocalImprovementAlgorithmOperators queried from ApplicationManager 302 var algOps = ApplicationManager.Manager.GetInstances<ILocalImprovementAlgorithmOperator>() 303 .Where(x => x.ProblemType.IsInstanceOfType(Problem)); 304 foreach (var op in algOps) { 305 if (LocalImprovementParameter.ValidValues.All(x => x.GetType() != op.GetType())) 306 306 LocalImprovementParameter.ValidValues.Add(op); 307 307 }
Note: See TracChangeset
for help on using the changeset viewer.