Changeset 5144 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations
- Timestamp:
- 12/21/10 01:13:49 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations/ValueConfiguration.cs
r5112 r5144 9 9 using HeuristicLab.Encodings.IntegerVectorEncoding; 10 10 using HeuristicLab.PluginInfrastructure; 11 using System.Collections.Generic; 12 using System.Text; 11 13 12 14 namespace HeuristicLab.Problems.MetaOptimization { … … 89 91 this.IsOptimizable = true; 90 92 if (actualValue.ValueDataType == typeof(IntValue)) { 91 rangeConstraint = new IntValueRange(new IntValue(0), (IntValue)value, new IntValue(1));93 RangeConstraint = new IntValueRange(new IntValue(0), (IntValue)value, new IntValue(1)); 92 94 } else if (actualValue.ValueDataType == typeof(DoubleValue)) { 93 rangeConstraint = new DoubleValueRange(new DoubleValue(0), (DoubleValue)value, new DoubleValue(0.01));95 RangeConstraint = new DoubleValueRange(new DoubleValue(0), (DoubleValue)value, new DoubleValue(0.01)); 94 96 } else if (actualValue.ValueDataType == typeof(PercentValue)) { 95 rangeConstraint = new PercentValueRange(new PercentValue(0), new PercentValue(1), new PercentValue(0.001));97 RangeConstraint = new PercentValueRange(new PercentValue(0), new PercentValue(1), new PercentValue(0.001)); 96 98 } else if (actualValue.ValueDataType == typeof(BoolValue)) { 97 99 this.IsOptimizable = false; // there is nothing to configure for bools 98 100 } else { 99 rangeConstraint = null; 100 } 101 RegisterRangeConstraintEvents(); 101 RangeConstraint = null; 102 } 102 103 } 103 104 … … 155 156 } 156 157 #endregion 157 158 158 159 #region IItem Members 159 160 public override string ItemDescription { … … 169 170 } 170 171 #endregion 171 172 172 173 #region Event Handlers 173 174 public virtual event EventHandler ValueChanged; … … 208 209 return base.ToString(); 209 210 } 211 } 212 213 public string ToParameterInfoString() { 214 StringBuilder sb = new StringBuilder(); 215 if (this.Optimize) { 216 if (this.ParameterConfigurations.Count > 0) { 217 var parameterInfos = new List<string>(); 218 foreach (var pc in this.ParameterConfigurations) { 219 if (pc.Optimize) parameterInfos.Add(pc.ToParameterInfoString()); 220 } 221 sb.Append(string.Join(", ", parameterInfos.ToArray())); 222 } 223 } 224 return sb.ToString(); 210 225 } 211 226
Note: See TracChangeset
for help on using the changeset viewer.