Skip to content

Commit

Permalink
Merge pull request #124 from msakai/feature/wbo2ipinfo-no-weights
Browse files Browse the repository at this point in the history
Change WBO2IPInfo not to store weights
  • Loading branch information
msakai authored Nov 26, 2024
2 parents 2148879 + 14a1d2e commit 79456f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ToySolver/Converter/PB2IP.hs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ convVar x = MIP.toVar ("x" ++ show x)

-- -----------------------------------------------------------------------------

data WBO2IPInfo = WBO2IPInfo !Int [(MIP.Var, PBFile.SoftConstraint)]
data WBO2IPInfo = WBO2IPInfo !Int [(MIP.Var, PBFile.Constraint)]
deriving (Eq, Show)

instance Transformer WBO2IPInfo where
Expand All @@ -105,13 +105,13 @@ instance ForwardTransformer WBO2IPInfo where
transformForward (WBO2IPInfo _nv relaxVariables) m = Map.union m1 m2
where
m1 = Map.fromList $ [(convVar v, if val then 1 else 0) | (v,val) <- assocs m]
m2 = Map.fromList $ [(v, if SAT.evalPBConstraint m c then 0 else 1) | (v, (Just _, c)) <- relaxVariables]
m2 = Map.fromList $ [(v, if SAT.evalPBConstraint m c then 0 else 1) | (v, c) <- relaxVariables]

instance BackwardTransformer WBO2IPInfo where
transformBackward (WBO2IPInfo nv _relaxVariables) = mtrans nv

wbo2ip :: Bool -> PBFile.SoftFormula -> (MIP.Problem Integer, WBO2IPInfo)
wbo2ip useIndicator formula = (mip, WBO2IPInfo (PBFile.wboNumVars formula) relaxVariables)
wbo2ip useIndicator formula = (mip, WBO2IPInfo (PBFile.wboNumVars formula) [(r, c) | (r, (Just _, c)) <- relaxVariables])
where
mip = def
{ MIP.objectiveFunction = obj2
Expand Down

0 comments on commit 79456f7

Please sign in to comment.