Changeset 17768 for branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/IntervalConstraintsParser.cs
- Timestamp:
- 10/02/20 11:36:34 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/IntervalConstraintsParser.cs
r17765 r17768 93 93 if (match.Groups[10].Success) 94 94 { 95 I List<Region> regions = new List<Region>();95 IntervalCollection regions = new IntervalCollection(); 96 96 // option variables found 97 97 for(int idx = 0; idx < match.Groups[10].Captures.Count; ++idx) 98 98 { 99 Regionregion = ParseRegion(99 KeyValuePair<string, Interval> region = ParseRegion( 100 100 match.Groups[11].Captures[idx].Value, 101 101 match.Groups[13].Captures[idx].Value, 102 102 match.Groups[15].Captures[idx].Value); 103 if (!regions.Any(r => r.VariableName == region.VariableName))104 regions.Add (region);103 if (regions.GetReadonlyDictionary().All(r => r.Key != region.Key)) 104 regions.AddInterval(region.Key, region.Value); 105 105 else 106 106 throw new ArgumentException("A constraint cannot contain multiple regions of the same variable."); … … 184 184 if(match.Groups[17].Success) 185 185 { 186 I List<Region> regions = new List<Region>();186 IntervalCollection regions = new IntervalCollection(); 187 187 // option variables found 188 188 for (int idx = 0; idx < match.Groups[17].Captures.Count; ++idx) 189 189 { 190 Regionregion = ParseRegion(190 KeyValuePair<string, Interval> region = ParseRegion( 191 191 match.Groups[18].Captures[idx].Value, 192 192 match.Groups[20].Captures[idx].Value, 193 193 match.Groups[22].Captures[idx].Value); 194 if ( !regions.Any(r => r.VariableName == region.VariableName))195 regions.Add (region);194 if (regions.GetReadonlyDictionary().All(r => r.Key != region.Key)) 195 regions.AddInterval(region.Key, region.Value); 196 196 else 197 197 throw new ArgumentException("A constraint cannot contain multiple regions of the same variable."); … … 217 217 } 218 218 219 private static RegionParseRegion(string variable, string lb, string ub)219 private static KeyValuePair<string, Interval> ParseRegion(string variable, string lb, string ub) 220 220 { 221 221 var regionLb = ParseIntervalBounds(lb); 222 222 var regionUb = ParseIntervalBounds(ub); 223 return new Region(variable, new Interval(regionLb, regionUb)); 223 return new KeyValuePair<string, Interval>(variable, new Interval(regionLb, regionUb)); 224 //return new Region(variable, new Interval(regionLb, regionUb)); 224 225 } 225 226
Note: See TracChangeset
for help on using the changeset viewer.