@@ -141,11 +141,9 @@ where
141
141
return Err ( conjunction. into ( ) ) ;
142
142
}
143
143
144
- for ( i, x_i) in self . x . iter ( ) . enumerate ( ) {
145
- let bound = match TryInto :: < i32 > :: try_into ( self . lower_bound_left_hand_side ) {
146
- Ok ( lower_bound_left_hand_side) => {
147
- self . c - ( lower_bound_left_hand_side - context. lower_bound ( x_i) )
148
- }
144
+ let lower_bound_left_hand_side =
145
+ match TryInto :: < i32 > :: try_into ( self . lower_bound_left_hand_side ) {
146
+ Ok ( bound) => bound,
149
147
Err ( _) if self . lower_bound_left_hand_side . is_positive ( ) => {
150
148
// We cannot fit the `lower_bound_left_hand_side` into an i32 due to an
151
149
// overflow (hence the check that the lower-bound on the left-hand side is
@@ -165,6 +163,9 @@ where
165
163
}
166
164
} ;
167
165
166
+ for ( i, x_i) in self . x . iter ( ) . enumerate ( ) {
167
+ let bound = self . c - ( lower_bound_left_hand_side - context. lower_bound ( x_i) ) ;
168
+
168
169
if context. upper_bound ( x_i) > bound {
169
170
let reason: PropositionalConjunction = self
170
171
. x
@@ -196,29 +197,30 @@ where
196
197
. map ( |var| context. lower_bound ( var) as i64 )
197
198
. sum :: < i64 > ( ) ;
198
199
200
+ let lower_bound_left_hand_side = match TryInto :: < i32 > :: try_into ( lower_bound_left_hand_side)
201
+ {
202
+ Ok ( bound) => bound,
203
+ Err ( _) if self . lower_bound_left_hand_side . is_positive ( ) => {
204
+ // We cannot fit the `lower_bound_left_hand_side` into an i32 due to an
205
+ // overflow (hence the check that the lower-bound on the left-hand side is
206
+ // positive)
207
+ //
208
+ // This means that the lower-bounds of the current variables will always be
209
+ // higher than the right-hand side (with a maximum value of i32). We thus
210
+ // return a conflict
211
+ return Err ( self . create_conflict_reason ( context. as_readonly ( ) ) . into ( ) ) ;
212
+ }
213
+ Err ( _) => {
214
+ // We cannot fit the `lower_bound_left_hand_side` into an i32 due to an
215
+ // underflow
216
+ //
217
+ // This means that the constraint is always satisfied
218
+ return Ok ( ( ) ) ;
219
+ }
220
+ } ;
221
+
199
222
for ( i, x_i) in self . x . iter ( ) . enumerate ( ) {
200
- let bound = match TryInto :: < i32 > :: try_into ( lower_bound_left_hand_side) {
201
- Ok ( lower_bound_left_hand_side) => {
202
- self . c - ( lower_bound_left_hand_side - context. lower_bound ( x_i) )
203
- }
204
- Err ( _) if lower_bound_left_hand_side. is_positive ( ) => {
205
- // We cannot fit the `lower_bound_left_hand_side` into an i32 due to an
206
- // overflow (hence the check that the lower-bound on the left-hand side is
207
- // positive)
208
- //
209
- // This means that the lower-bounds of the current variables will always be
210
- // higher than the right-hand side (with a maximum value of i32). We thus
211
- // return a conflict
212
- return Err ( self . create_conflict_reason ( context. as_readonly ( ) ) . into ( ) ) ;
213
- }
214
- Err ( _) => {
215
- // We cannot fit the `lower_bound_left_hand_side` into an i32 due to an
216
- // underflow
217
- //
218
- // This means that the constraint is always satisfied
219
- return Ok ( ( ) ) ;
220
- }
221
- } ;
223
+ let bound = self . c - ( lower_bound_left_hand_side - context. lower_bound ( x_i) ) ;
222
224
223
225
if context. upper_bound ( x_i) > bound {
224
226
let reason: PropositionalConjunction = self
0 commit comments