- Timestamp:
- 08/28/20 17:29:31 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/IntervalConstraintsParser.cs
r17728 r17736 97 97 for(int idx = 0; idx < match.Groups[10].Captures.Count; ++idx) 98 98 { 99 var inputVar = match.Groups[11].Captures[idx].Value;100 var regionLb = ParseIntervalBounds(match.Groups[13].Captures[idx].Value);101 var regionUb = ParseIntervalBounds(match.Groups[15].Captures[idx].Value);102 pairs.Add(inputVar, new Interval(regionLb, regionUb));99 AddRegion(pairs, 100 match.Groups[11].Captures[idx].Value, 101 match.Groups[13].Captures[idx].Value, 102 match.Groups[15].Captures[idx].Value); 103 103 } 104 104 yield return new IntervalConstraint(expression, variable, parsedTarget, numberOfDerivation, interval, pairs, weight, isEnabled); … … 184 184 for (int idx = 0; idx < match.Groups[17].Captures.Count; ++idx) 185 185 { 186 var inputVar = match.Groups[18].Captures[idx].Value;187 var regionLb = ParseIntervalBounds(match.Groups[20].Captures[idx].Value);188 var regionUb = ParseIntervalBounds(match.Groups[22].Captures[idx].Value);189 pairs.Add(inputVar, new Interval(regionLb, regionUb));186 AddRegion(pairs, 187 match.Groups[18].Captures[idx].Value, 188 match.Groups[20].Captures[idx].Value, 189 match.Groups[22].Captures[idx].Value); 190 190 } 191 191 yield return new IntervalConstraint(expression, variable, parsedTarget, numberOfDerivation, interval, pairs, weight, isEnabled); … … 207 207 } 208 208 } 209 } 210 211 private static void AddRegion(IDictionary<string, Interval> dict, string variable, string lb, string ub) 212 { 213 var regionLb = ParseIntervalBounds(lb); 214 var regionUb = ParseIntervalBounds(ub); 215 if (dict.ContainsKey(variable)) 216 throw new ArgumentException("A constraint cannot contain multiple regions of the same variable."); 217 dict.Add(variable, new Interval(regionLb, regionUb)); 209 218 } 210 219
Note: See TracChangeset
for help on using the changeset viewer.