Changeset 3717 for trunk/sources
- Timestamp:
- 05/08/10 04:36:13 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization/3.3
- Files:
-
- 5 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r3702 r3717 104 104 <Compile Include="Interfaces\IStrategyParameterCreator.cs" /> 105 105 <Compile Include="Interfaces\IRun.cs" /> 106 <Compile Include=" IRunCollectionConstraint.cs" />106 <Compile Include="RunCollectionConstraints\IRunCollectionConstraint.cs" /> 107 107 <Compile Include="OptimizerList.cs" /> 108 108 <Compile Include="Experiment.cs" /> -
trunk/sources/HeuristicLab.Optimization/3.3/RunCollection.cs
r3716 r3717 147 147 148 148 public IItem GetValue(IRun run, int columnIndex) { 149 string name = ((IStringConvertibleMatrix)this).ColumnNames.ElementAt(columnIndex); 150 return GetValue(run, name); 151 } 152 153 public IItem GetValue(IRun run, string columnName) { 149 154 IItem value = null; 150 if (columnIndex < parameterNames.Count) { 151 string parameterName = parameterNames[columnIndex]; 152 if (run.Parameters.ContainsKey(parameterName)) 153 value = run.Parameters[parameterName]; 154 } else if (columnIndex < parameterNames.Count + resultNames.Count) { 155 string resultName = resultNames[columnIndex - parameterNames.Count]; 156 if (run.Results.ContainsKey(resultName)) 157 value = run.Results[resultName]; 158 } 155 if (run.Parameters.ContainsKey(columnName)) 156 value = run.Parameters[columnName]; 157 else if (run.Results.ContainsKey(columnName)) 158 value = run.Results[columnName]; 159 159 return value; 160 160 } 161 161 162 162 163 public override IDeepCloneable Clone(Cloner cloner) { … … 193 194 List<string> value = new List<string>(parameterNames); 194 195 value.AddRange(resultNames); 196 value.Sort(); 195 197 return value; 196 198 } -
trunk/sources/HeuristicLab.Optimization/3.3/RunCollectionConstraints/IRunCollectionConstraint.cs
r3713 r3717 29 29 public interface IRunCollectionConstraint : IConstraint{ 30 30 new RunCollection ConstrainedValue { get; set; } 31 intConstraintColumn { get; set; }31 string ConstraintColumn { get; set; } 32 32 event EventHandler ConstraintColumnChanged; 33 33 } -
trunk/sources/HeuristicLab.Optimization/3.3/RunCollectionConstraints/RunCollectionComparisonConstraint.cs
r3632 r3717 61 61 62 62 [Storable] 63 private intconstraintColumn;64 public intConstraintColumn {63 private string constraintColumn; 64 public string ConstraintColumn { 65 65 get { return constraintColumn; } 66 66 set { 67 if ( value < 0 || value >= ((IStringConvertibleMatrix)ConstrainedValue).ColumnNames.Count())67 if (!((IStringConvertibleMatrix)ConstrainedValue).ColumnNames.Contains(value)) 68 68 throw new ArgumentException("Could not set ConstraintData to not existing column index."); 69 69 if (constraintColumn != value) { … … 80 80 if (handler != null) 81 81 handler(this, EventArgs.Empty); 82 } 83 84 protected override void OnConstrainedValueChanged() { 85 base.OnConstrainedValueChanged(); 86 IStringConvertibleMatrix matrix = (IStringConvertibleMatrix)ConstrainedValue; 87 if (constraintColumn == null && ConstrainedValue != null && matrix.Columns != 0) 88 constraintColumn = matrix.ColumnNames.ElementAt(0); 82 89 } 83 90 … … 111 118 IStringConvertibleMatrix matrix = ConstrainedValue; 112 119 if (matrix != null && matrix.ColumnNames.Count() != 0) 113 s += matrix.ColumnNames.ElementAt(constraintColumn)+ " ";120 s += constraintColumn + " "; 114 121 else 115 122 return "ComparisonConstraint"; -
trunk/sources/HeuristicLab.Optimization/3.3/RunCollectionConstraints/RunCollectionEqualityConstraint.cs
r3617 r3717 58 58 59 59 [Storable] 60 private intconstraintColumn;61 public intConstraintColumn {60 private string constraintColumn; 61 public string ConstraintColumn { 62 62 get { return constraintColumn; } 63 63 set { 64 if ( value < 0 || value >= ((IStringConvertibleMatrix)ConstrainedValue).ColumnNames.Count())64 if (!((IStringConvertibleMatrix)ConstrainedValue).ColumnNames.Contains(value)) 65 65 throw new ArgumentException("Could not set ConstraintData to not existing column index."); 66 66 if (constraintColumn != value) { … … 77 77 if (handler != null) 78 78 handler(this, EventArgs.Empty); 79 } 80 81 protected override void OnConstrainedValueChanged() { 82 base.OnConstrainedValueChanged(); 83 IStringConvertibleMatrix matrix = (IStringConvertibleMatrix)ConstrainedValue; 84 if (constraintColumn == null && ConstrainedValue != null && matrix.Columns != 0) 85 constraintColumn = matrix.ColumnNames.ElementAt(0); 79 86 } 80 87 … … 108 115 IStringConvertibleMatrix matrix = ConstrainedValue; 109 116 if (matrix != null && matrix.ColumnNames.Count() != 0) 110 s += matrix.ColumnNames.ElementAt(constraintColumn)+ " ";117 s += constraintColumn + " "; 111 118 else 112 119 return "EqualityConstraint"; -
trunk/sources/HeuristicLab.Optimization/3.3/RunCollectionConstraints/RunCollectionTypeCompatiblityConstraint.cs
r3632 r3717 51 51 } 52 52 [Storable] 53 private intconstraintColumn;54 public intConstraintColumn {53 private string constraintColumn; 54 public string ConstraintColumn { 55 55 get { return constraintColumn; } 56 56 set { 57 if ( value < 0 || value >= ((IStringConvertibleMatrix)ConstrainedValue).ColumnNames.Count())57 if (!((IStringConvertibleMatrix)ConstrainedValue).ColumnNames.Contains(value)) 58 58 throw new ArgumentException("Could not set ConstraintData to not existing column index."); 59 59 if (constraintColumn != value) { … … 70 70 if (handler != null) 71 71 handler(this, EventArgs.Empty); 72 } 73 74 protected override void OnConstrainedValueChanged() { 75 base.OnConstrainedValueChanged(); 76 IStringConvertibleMatrix matrix = (IStringConvertibleMatrix)ConstrainedValue; 77 if (constraintColumn == null && ConstrainedValue != null && matrix.Columns != 0) 78 constraintColumn = matrix.ColumnNames.ElementAt(0); 72 79 } 73 80 … … 101 108 IStringConvertibleMatrix matrix = ConstrainedValue; 102 109 if (matrix != null && matrix.ColumnNames.Count() != 0) 103 s += matrix.ColumnNames.ElementAt(constraintColumn)+ " ";110 s += constraintColumn + " "; 104 111 else 105 112 return "TypeCompabitilityConstraint";
Note: See TracChangeset
for help on using the changeset viewer.