From 03ef5d23bab312f21d67318fcadb506885d4cb7d Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Thu, 7 Feb 2008 15:37:56 +0000 Subject: [PATCH] A patch recording the fix for modulo in replication that got the test passing, that properly detects whether a replicated variable is featured anywhere in the problem --- checks/ArrayUsageCheck.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/checks/ArrayUsageCheck.hs b/checks/ArrayUsageCheck.hs index 7b64e0a..0380573 100644 --- a/checks/ArrayUsageCheck.hs +++ b/checks/ArrayUsageCheck.hs @@ -350,12 +350,14 @@ makeEquations otherInfo accesses bound (A.Variable, Int, EqualityConstraintEquation, EqualityConstraintEquation) -> StateT (VarMap) (Either String) (EqualityConstraintEquation, EqualityProblem, InequalityProblem) addPossibleRepBound (item,eq,ineq) (var,index,lower,upper) - = do index <- varIndex (Scale 1 vi) - let boundEqs = if arrayLookupWithDefault 0 item index /= 0 - then [add (index,1) $ amap negate lower,add (index,-1) upper] + = do vindex <- varIndex (Scale 1 vi) + let boundEqs = if elemPresent vindex item || any (elemPresent vindex) eq || any (elemPresent vindex) ineq + then [add (vindex,1) $ amap negate lower,add (vindex,-1) upper] else [] return (item,eq,ineq ++ boundEqs) where + elemPresent index item = arrayLookupWithDefault 0 item index /= 0 + vi = (var,index) add :: (Int,Integer) -> Array Int Integer -> Array Int Integer