Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBC MILP Solver returns "Infeasible" status, but lpsolve in R gives "feasible" #608

Open
tle4336 opened this issue Jul 11, 2023 · 17 comments

Comments

@tle4336
Copy link

tle4336 commented Jul 11, 2023

I am currently encountering a very weird issue with the PULP_CBC_CMD solver via pulp package in Python (CBC MILP Solver version 2.10.3). Despite playing around with the parameter options gapAbs and fracGap, I had no way to make the CBC MILP solver to avoid running into infeasible status. However, the optimization model is actually feasible (the model is an LP problem, with all variables being continuous between 0 and 1), as it was solved quickly and easily via lpsolve package in R. I then compared the two models and could confirm that they are identical (so, the part of building the model in 2 languages is fine). I am wondering if anyone could help me figure out how to fix this incorrect issue?

Attached is the model in .lp and .mps format, exported from both Python and R (you can see the filename to determine which one is exported from Python). I also include the .txt log file given by the CBC run. I also compute the values of the constraints as well as their corresponding slacks below:

constraint _C1 has value: -7.85e+02 and slack: 7.85e+02
constraint _C2 has value: -2.30e+01 and slack: 2.30e+01
constraint _C3 has value: 3.20e+01 and slack: -3.20e+01
constraint _C4 has value: -1.20e+01 and slack: 1.20e+01
constraint _C5 has value: 2.80e+01 and slack: -2.80e+01
constraint _C6 has value: 1.00e-08 and slack: -0.00e+00
constraint _C7 has value: 4.30e+01 and slack: -4.30e+01
constraint _C8 has value: -5.00e+00 and slack: 5.00e+00
constraint _C9 has value: 2.70e+01 and slack: -2.70e+01
constraint _C10 has value: -8.00e+00 and slack: 8.00e+00
constraint _C11 has value: 1.00e+01 and slack: -1.00e+01
constraint _C12 has value: -2.60e+01 and slack: 2.60e+01
constraint _C13 has value: 1.60e+01 and slack: -1.60e+01
constraint _C14 has value: -9.00e+00 and slack: 9.00e+00
constraint _C15 has value: 2.50e+01 and slack: -2.50e+01
constraint _C16 has value: -1.60e+01 and slack: 1.60e+01
constraint _C17 has value: 1.70e+01 and slack: -1.70e+01
constraint _C18 has value: -2.30e+01 and slack: 2.30e+01
constraint _C19 has value: 2.60e+01 and slack: -2.60e+01
constraint _C20 has value: -1.50e+01 and slack: 1.50e+01
constraint _C21 has value: 4.10e+01 and slack: -4.10e+01
constraint _C22 has value: -6.70e+01 and slack: 6.70e+01
constraint _C23 has value: 7.00e+00 and slack: -7.00e+00
constraint _C24 has value: -1.80e+01 and slack: 1.80e+01
constraint _C25 has value: 4.00e+00 and slack: -4.00e+00
constraint _C26 has value: -2.00e+00 and slack: 2.00e+00
constraint _C27 has value: 3.00e+01 and slack: -3.00e+01
constraint _C28 has value: -5.60e+01 and slack: 5.60e+01
constraint _C29 has value: 5.00e+00 and slack: -5.00e+00
constraint _C30 has value: -5.80e+01 and slack: 5.80e+01
constraint _C31 has value: 2.00e+00 and slack: -2.00e+00
constraint _C32 has value: -4.10e+01 and slack: 4.10e+01
constraint _C33 has value: 7.00e+00 and slack: -7.00e+00
constraint _C34 has value: -1.30e+01 and slack: 1.30e+01
constraint _C35 has value: 5.40e+01 and slack: -5.40e+01
constraint _C36 has value: -1.40e+01 and slack: 1.40e+01
constraint _C37 has value: 5.20e+01 and slack: -5.20e+01
constraint _C38 has value: 0.00e+00 and slack: -0.00e+00
constraint _C39 has value: 2.00e+00 and slack: -2.00e+00
constraint _C40 has value: -1.60e+01 and slack: 1.60e+01
constraint _C41 has value: 1.70e+01 and slack: -1.70e+01
constraint _C42 has value: -2.40e+01 and slack: 2.40e+01
constraint _C43 has value: 2.50e+01 and slack: -2.50e+01
constraint _C44 has value: -7.30e+01 and slack: 7.30e+01
constraint _C45 has value: 9.00e+00 and slack: -9.00e+00
constraint _C46 has value: 0.00e+00 and slack: -0.00e+00
constraint _C47 has value: 3.80e+01 and slack: -3.80e+01
constraint _C48 has value: -1.10e+01 and slack: 1.10e+01
constraint _C49 has value: 6.00e+01 and slack: -6.00e+01
constraint _C50 has value: -7.30e+01 and slack: 7.30e+01
constraint _C51 has value: 7.00e+00 and slack: -7.00e+00
constraint _C52 has value: -2.10e+01 and slack: 2.10e+01
constraint _C53 has value: 1.00e+00 and slack: -1.00e+00
constraint _C54 has value: -3.40e+01 and slack: 3.40e+01
constraint _C55 has value: 4.00e+00 and slack: -4.00e+00
constraint _C56 has value: -6.40e+01 and slack: 6.40e+01
constraint _C57 has value: 1.00e+00 and slack: -1.00e+00
constraint _C58 has value: -6.40e+01 and slack: 6.40e+01
constraint _C59 has value: 2.00e+00 and slack: -2.00e+00
constraint _C60 has value: -4.30e+01 and slack: 4.30e+01
constraint _C61 has value: 0.00e+00 and slack: -0.00e+00
constraint _C62 has value: -3.60e+01 and slack: 3.60e+01
constraint _C63 has value: 2.70e+01 and slack: -2.70e+01
constraint _C64 has value: 0.00e+00 and slack: -0.00e+00
constraint _C65 has value: -1.00e+00 and slack: 1.00e+00
constraint _C66 has value: 1.00e+00 and slack: -1.00e+00
constraint _C67 has value: 0.00e+00 and slack: -0.00e+00
constraint _C68 has value: 1.60e+01 and slack: -1.60e+01
constraint _C69 has value: 2.00e+00 and slack: -2.00e+00
constraint _C70 has value: 1.00e+00 and slack: -1.00e+00
constraint _C71 has value: 0.00e+00 and slack: -0.00e+00
constraint _C72 has value: 2.90e+01 and slack: -2.90e+01
constraint _C73 has value: 0.00e+00 and slack: -0.00e+00
constraint _C74 has value: 1.80e+01 and slack: -1.80e+01
constraint _C75 has value: 1.00e-08 and slack: -0.00e+00
constraint _C76 has value: 3.00e+00 and slack: -3.00e+00
constraint _C77 has value: 0.00e+00 and slack: -0.00e+00
constraint _C78 has value: 2.80e+01 and slack: -2.80e+01
constraint _C79 has value: 0.00e+00 and slack: -0.00e+00
constraint _C80 has value: 0.00e+00 and slack: -0.00e+00
constraint _C81 has value: 0.00e+00 and slack: -0.00e+00
constraint _C82 has value: 0.00e+00 and slack: -0.00e+00
constraint _C83 has value: 0.00e+00 and slack: -0.00e+00
constraint _C84 has value: 1.20e+01 and slack: -1.20e+01
constraint _C85 has value: -2.00e+00 and slack: 2.00e+00
constraint _C86 has value: 1.70e+01 and slack: -1.70e+01
constraint _C87 has value: -6.00e-08 and slack: -0.00e+00
constraint _C88 has value: 0.00e+00 and slack: -0.00e+00
constraint _C89 has value: 0.00e+00 and slack: -0.00e+00
constraint _C90 has value: 3.50e+01 and slack: -3.50e+01
constraint _C91 has value: 0.00e+00 and slack: -0.00e+00
constraint _C92 has value: 1.00e+00 and slack: -1.00e+00
constraint _C93 has value: 0.00e+00 and slack: -0.00e+00
constraint _C94 has value: 0.00e+00 and slack: -0.00e+00
constraint _C95 has value: 0.00e+00 and slack: -0.00e+00
constraint _C96 has value: 2.30e+01 and slack: -2.30e+01
constraint _C97 has value: 3.00e+00 and slack: -3.00e+00
constraint _C98 has value: 1.20e+01 and slack: -1.20e+01
constraint _C99 has value: 0.00e+00 and slack: -0.00e+00
constraint _C100 has value: 2.40e+01 and slack: -2.40e+01
constraint _C101 has value: -1.30e+01 and slack: 1.30e+01
constraint _C102 has value: 8.00e+00 and slack: -8.00e+00
constraint _C103 has value: 1.00e+00 and slack: -1.00e+00
constraint _C104 has value: 1.00e+00 and slack: -1.00e+00
constraint _C105 has value: 0.00e+00 and slack: -0.00e+00
constraint _C106 has value: 1.30e+01 and slack: -1.30e+01
constraint _C107 has value: 6.00e-08 and slack: -0.00e+00
constraint _C108 has value: 2.00e+00 and slack: -2.00e+00
constraint _C109 has value: 1.00e+00 and slack: -1.00e+00
constraint _C110 has value: 0.00e+00 and slack: -0.00e+00
constraint _C111 has value: -1.00e+00 and slack: 1.00e+00
constraint _C112 has value: 1.60e+01 and slack: -1.60e+01
constraint _C113 has value: 2.00e+00 and slack: -2.00e+00
constraint _C114 has value: 1.00e+00 and slack: -1.00e+00
constraint _C115 has value: 1.00e+00 and slack: -1.00e+00
constraint _C116 has value: 1.10e+01 and slack: -1.10e+01
constraint _C117 has value: -1.00e-07 and slack: -0.00e+00
constraint _C118 has value: 4.00e+00 and slack: -4.00e+00
constraint _C119 has value: 1.00e+00 and slack: -1.00e+00
constraint _C120 has value: 1.00e+00 and slack: -1.00e+00
constraint _C121 has value: -1.00e+00 and slack: 1.00e+00
constraint _C122 has value: 0.00e+00 and slack: -0.00e+00
constraint _C123 has value: 0.00e+00 and slack: -0.00e+00
constraint _C124 has value: 0.00e+00 and slack: -0.00e+00
constraint _C125 has value: -3.00e+00 and slack: 3.00e+00
constraint _C126 has value: 0.00e+00 and slack: -0.00e+00
constraint _C127 has value: 0.00e+00 and slack: -0.00e+00
constraint _C128 has value: 0.00e+00 and slack: -0.00e+00
constraint _C129 has value: 0.00e+00 and slack: -0.00e+00
constraint _C130 has value: 2.00e+01 and slack: -2.00e+01
constraint _C131 has value: -1.00e-07 and slack: -0.00e+00
constraint _C132 has value: 2.00e+00 and slack: -2.00e+00
constraint _C133 has value: 1.00e+00 and slack: -1.00e+00
constraint _C134 has value: 1.00e+00 and slack: -1.00e+00
constraint _C135 has value: -1.00e+00 and slack: 1.00e+00
constraint _C136 has value: 0.00e+00 and slack: -0.00e+00
constraint _C137 has value: 0.00e+00 and slack: -0.00e+00
constraint _C138 has value: 0.00e+00 and slack: -0.00e+00
constraint _C139 has value: 0.00e+00 and slack: -0.00e+00
constraint _C140 has value: 1.40e+01 and slack: -1.40e+01
constraint _C141 has value: 1.20e-07 and slack: -0.00e+00
constraint _C142 has value: 3.00e+00 and slack: -3.00e+00
constraint _C143 has value: 2.00e+00 and slack: -2.00e+00
constraint _C144 has value: 2.00e+00 and slack: -2.00e+00
constraint _C145 has value: 1.00e+00 and slack: -1.00e+00
constraint _C146 has value: 0.00e+00 and slack: -0.00e+00
constraint _C147 has value: 0.00e+00 and slack: -0.00e+00
constraint _C148 has value: 0.00e+00 and slack: -0.00e+00
constraint _C149 has value: 0.00e+00 and slack: -0.00e+00
constraint _C150 has value: 2.30e+01 and slack: -2.30e+01
constraint _C151 has value: 6.00e-08 and slack: -0.00e+00
constraint _C152 has value: 5.00e+00 and slack: -5.00e+00
constraint _C153 has value: 2.00e+00 and slack: -2.00e+00
constraint _C154 has value: 0.00e+00 and slack: -0.00e+00
constraint _C155 has value: 0.00e+00 and slack: -0.00e+00
constraint _C156 has value: 7.00e+00 and slack: -7.00e+00
constraint _C157 has value: 0.00e+00 and slack: -0.00e+00
constraint _C158 has value: 1.40e+01 and slack: -1.40e+01
constraint _C159 has value: 3.00e+00 and slack: -3.00e+00
constraint _C160 has value: 2.00e+00 and slack: -2.00e+00
constraint _C161 has value: 1.00e+00 and slack: -1.00e+00
constraint _C162 has value: 1.00e+00 and slack: -1.00e+00
constraint _C163 has value: 0.00e+00 and slack: -0.00e+00
constraint _C164 has value: 2.80e+01 and slack: -2.80e+01
constraint _C165 has value: -8.00e-08 and slack: -0.00e+00
constraint _C166 has value: 3.00e+00 and slack: -3.00e+00
constraint _C167 has value: 0.00e+00 and slack: -0.00e+00
constraint _C168 has value: 0.00e+00 and slack: -0.00e+00
constraint _C169 has value: 0.00e+00 and slack: -0.00e+00
constraint _C170 has value: 5.00e+00 and slack: -5.00e+00
constraint _C171 has value: 0.00e+00 and slack: -0.00e+00
constraint _C172 has value: 1.00e+00 and slack: -1.00e+00
constraint _C173 has value: 0.00e+00 and slack: -0.00e+00
constraint _C174 has value: 0.00e+00 and slack: -0.00e+00
constraint _C175 has value: 0.00e+00 and slack: -0.00e+00
constraint _C176 has value: 0.00e+00 and slack: -0.00e+00
constraint _C177 has value: 0.00e+00 and slack: -0.00e+00
constraint _C178 has value: 4.00e+00 and slack: -4.00e+00
constraint _C179 has value: 1.00e+00 and slack: -1.00e+00
constraint _C180 has value: 0.00e+00 and slack: -0.00e+00
constraint _C181 has value: 0.00e+00 and slack: -0.00e+00
constraint _C182 has value: 0.00e+00 and slack: -0.00e+00
constraint _C183 has value: 0.00e+00 and slack: -0.00e+00
constraint _C184 has value: 5.00e+00 and slack: -5.00e+00
constraint _C185 has value: 1.00e+00 and slack: -1.00e+00
constraint _C186 has value: 2.00e+00 and slack: -2.00e+00
constraint _C187 has value: 1.00e+00 and slack: -1.00e+00
constraint _C188 has value: 1.00e+00 and slack: -1.00e+00
constraint _C189 has value: 0.00e+00 and slack: -0.00e+00
constraint _C190 has value: 0.00e+00 and slack: -0.00e+00
constraint _C191 has value: 0.00e+00 and slack: -0.00e+00
constraint _C192 has value: 4.00e+00 and slack: -4.00e+00
constraint _C193 has value: 2.00e+00 and slack: -2.00e+00
constraint _C194 has value: 0.00e+00 and slack: -0.00e+00
constraint _C195 has value: 0.00e+00 and slack: -0.00e+00
constraint _C196 has value: 1.90e+01 and slack: -1.90e+01
constraint _C197 has value: -1.00e-07 and slack: -0.00e+00
constraint _C198 has value: 3.00e+00 and slack: -3.00e+00
constraint _C199 has value: 0.00e+00 and slack: -0.00e+00
constraint _C200 has value: 2.00e+00 and slack: -2.00e+00
constraint _C201 has value: 0.00e+00 and slack: -0.00e+00
constraint _C202 has value: 0.00e+00 and slack: -0.00e+00
constraint _C203 has value: 0.00e+00 and slack: -0.00e+00
constraint _C204 has value: 4.00e+00 and slack: -4.00e+00
constraint _C205 has value: 0.00e+00 and slack: -0.00e+00
constraint _C206 has value: 0.00e+00 and slack: -0.00e+00
constraint _C207 has value: 0.00e+00 and slack: -0.00e+00
constraint _C208 has value: 0.00e+00 and slack: -0.00e+00
constraint _C209 has value: 0.00e+00 and slack: -0.00e+00
constraint _C210 has value: 2.00e+00 and slack: -2.00e+00
constraint _C211 has value: 1.00e+00 and slack: -1.00e+00
constraint _C212 has value: 0.00e+00 and slack: -0.00e+00
constraint _C213 has value: 0.00e+00 and slack: -0.00e+00
constraint _C214 has value: 4.00e+00 and slack: -4.00e+00
constraint _C215 has value: 0.00e+00 and slack: -0.00e+00
constraint _C216 has value: 0.00e+00 and slack: -0.00e+00
constraint _C217 has value: 0.00e+00 and slack: -0.00e+00
constraint _C218 has value: 0.00e+00 and slack: -0.00e+00
constraint _C219 has value: 0.00e+00 and slack: -0.00e+00
constraint _C220 has value: 0.00e+00 and slack: -0.00e+00
constraint _C221 has value: 0.00e+00 and slack: -0.00e+00
constraint _C222 has value: 1.00e+00 and slack: -1.00e+00
constraint _C223 has value: 1.00e+00 and slack: -1.00e+00
constraint _C224 has value: 0.00e+00 and slack: -0.00e+00
constraint _C225 has value: 0.00e+00 and slack: -0.00e+00
constraint _C226 has value: 4.00e+00 and slack: -4.00e+00
constraint _C227 has value: 0.00e+00 and slack: -0.00e+00
constraint _C228 has value: 0.00e+00 and slack: -0.00e+00
constraint _C229 has value: 0.00e+00 and slack: -0.00e+00
constraint _C230 has value: 0.00e+00 and slack: -0.00e+00
constraint _C231 has value: 0.00e+00 and slack: -0.00e+00
constraint _C232 has value: 3.00e+00 and slack: -3.00e+00
constraint _C233 has value: -2.00e+01 and slack: 2.00e+01
constraint _C234 has value: 0.00e+00 and slack: -0.00e+00
constraint _C235 has value: 0.00e+00 and slack: -0.00e+00
constraint _C236 has value: 0.00e+00 and slack: -0.00e+00
constraint _C237 has value: 0.00e+00 and slack: -0.00e+00
constraint _C238 has value: 0.00e+00 and slack: -0.00e+00
constraint _C239 has value: 0.00e+00 and slack: -0.00e+00
constraint _C240 has value: 1.10e+01 and slack: -1.10e+01
constraint _C241 has value: 3.00e+00 and slack: -3.00e+00
constraint _C242 has value: 4.40e+01 and slack: -4.40e+01
constraint _C243 has value: 5.00e-08 and slack: -0.00e+00
constraint _C244 has value: 0.00e+00 and slack: -0.00e+00
constraint _C245 has value: 0.00e+00 and slack: -0.00e+00
constraint _C246 has value: 0.00e+00 and slack: -0.00e+00
constraint _C247 has value: 0.00e+00 and slack: -0.00e+00
constraint _C248 has value: 5.00e+00 and slack: -5.00e+00
constraint _C249 has value: 2.00e+00 and slack: -2.00e+00
constraint _C250 has value: 0.00e+00 and slack: -0.00e+00
constraint _C251 has value: 0.00e+00 and slack: -0.00e+00
constraint _C252 has value: 4.70e+01 and slack: -4.70e+01
constraint _C253 has value: 0.00e+00 and slack: -0.00e+00
constraint _C254 has value: 0.00e+00 and slack: -0.00e+00
constraint _C255 has value: 0.00e+00 and slack: -0.00e+00
constraint _C256 has value: 2.00e+00 and slack: -2.00e+00
constraint _C257 has value: -1.00e+00 and slack: 1.00e+00
constraint _C258 has value: 1.00e+00 and slack: -1.00e+00
constraint _C259 has value: -1.00e+00 and slack: 1.00e+00
constraint _C260 has value: 0.00e+00 and slack: -0.00e+00
constraint _C261 has value: 0.00e+00 and slack: -0.00e+00
constraint _C262 has value: 2.00e+00 and slack: -2.00e+00
constraint _C263 has value: -1.20e+01 and slack: 1.20e+01
constraint _C264 has value: 1.00e+00 and slack: -1.00e+00
constraint _C265 has value: 0.00e+00 and slack: -0.00e+00
constraint _C266 has value: 1.00e+00 and slack: -1.00e+00
constraint _C267 has value: 0.00e+00 and slack: -0.00e+00
constraint _C268 has value: 2.00e+01 and slack: -2.00e+01
constraint _C269 has value: 2.00e+00 and slack: -2.00e+00
constraint _C270 has value: 4.00e+00 and slack: -4.00e+00
constraint _C271 has value: 0.00e+00 and slack: -0.00e+00
constraint _C272 has value: 2.70e+01 and slack: -2.70e+01
constraint _C273 has value: -9.00e-08 and slack: -0.00e+00
constraint _C274 has value: 0.00e+00 and slack: -0.00e+00
constraint _C275 has value: 0.00e+00 and slack: -0.00e+00
constraint _C276 has value: 3.00e+00 and slack: -3.00e+00
constraint _C277 has value: 1.00e+00 and slack: -1.00e+00
constraint _C278 has value: 1.00e+00 and slack: -1.00e+00
constraint _C279 has value: 1.00e+00 and slack: -1.00e+00
constraint _C280 has value: 1.60e+01 and slack: -1.60e+01
constraint _C281 has value: 2.00e+00 and slack: -2.00e+00
constraint _C282 has value: 6.00e+00 and slack: -6.00e+00
constraint _C283 has value: 1.00e+00 and slack: -1.00e+00
constraint _C284 has value: 1.30e+01 and slack: -1.30e+01
constraint _C285 has value: 4.00e-08 and slack: -0.00e+00
constraint _C286 has value: 1.00e+00 and slack: -1.00e+00
constraint _C287 has value: 0.00e+00 and slack: -0.00e+00
constraint _C288 has value: 2.00e+00 and slack: -2.00e+00
constraint _C289 has value: 1.00e+00 and slack: -1.00e+00
constraint _C290 has value: 0.00e+00 and slack: -0.00e+00
constraint _C291 has value: 0.00e+00 and slack: -0.00e+00
constraint _C292 has value: 0.00e+00 and slack: -0.00e+00
constraint _C293 has value: 0.00e+00 and slack: -0.00e+00
constraint _C294 has value: 6.00e+00 and slack: -6.00e+00
constraint _C295 has value: 1.00e+00 and slack: -1.00e+00
constraint _C296 has value: 2.00e+00 and slack: -2.00e+00
constraint _C297 has value: 1.00e+00 and slack: -1.00e+00
constraint _C298 has value: 1.00e+00 and slack: -1.00e+00
constraint _C299 has value: -1.00e+00 and slack: 1.00e+00
constraint _C300 has value: 0.00e+00 and slack: -0.00e+00
constraint _C301 has value: 0.00e+00 and slack: -0.00e+00
constraint _C302 has value: 0.00e+00 and slack: -0.00e+00
constraint _C303 has value: -3.00e+00 and slack: 3.00e+00
constraint _C304 has value: 0.00e+00 and slack: -0.00e+00
constraint _C305 has value: 0.00e+00 and slack: -0.00e+00
constraint _C306 has value: 4.00e+01 and slack: -4.00e+01
constraint _C307 has value: -1.70e+01 and slack: 1.70e+01
constraint _C308 has value: 0.00e+00 and slack: -0.00e+00
constraint _C309 has value: 0.00e+00 and slack: -0.00e+00
constraint _C310 has value: 0.00e+00 and slack: -0.00e+00
constraint _C311 has value: 0.00e+00 and slack: -0.00e+00
constraint _C312 has value: 6.00e+00 and slack: -6.00e+00
constraint _C313 has value: 0.00e+00 and slack: -0.00e+00
constraint _C314 has value: 6.00e+00 and slack: -6.00e+00
constraint _C315 has value: 2.00e+00 and slack: -2.00e+00
constraint _C316 has value: 2.00e+00 and slack: -2.00e+00
constraint _C317 has value: 1.00e+00 and slack: -1.00e+00
constraint _C318 has value: 5.40e+01 and slack: -5.40e+01
constraint _C319 has value: 0.00e+00 and slack: -0.00e+00
constraint _C320 has value: 0.00e+00 and slack: -0.00e+00
constraint _C321 has value: 0.00e+00 and slack: -0.00e+00
constraint _C322 has value: 2.00e+00 and slack: -2.00e+00
constraint _C323 has value: 0.00e+00 and slack: -0.00e+00
constraint _C324 has value: 5.00e+00 and slack: -5.00e+00
constraint _C325 has value: 0.00e+00 and slack: -0.00e+00
constraint _C326 has value: 0.00e+00 and slack: -0.00e+00
constraint _C327 has value: 0.00e+00 and slack: -0.00e+00
constraint _C328 has value: 0.00e+00 and slack: -0.00e+00
constraint _C329 has value: 0.00e+00 and slack: -0.00e+00
constraint _C330 has value: 1.00e+00 and slack: -1.00e+00
constraint _C331 has value: 0.00e+00 and slack: -0.00e+00
constraint _C332 has value: 1.00e+00 and slack: -1.00e+00
constraint _C333 has value: 1.00e+00 and slack: -1.00e+00
constraint _C334 has value: 0.00e+00 and slack: -0.00e+00
constraint _C335 has value: 0.00e+00 and slack: -0.00e+00
constraint _C336 has value: 3.00e+00 and slack: -3.00e+00
constraint _C337 has value: 1.00e+00 and slack: -1.00e+00
constraint _C338 has value: 1.00e+00 and slack: -1.00e+00
constraint _C339 has value: 0.00e+00 and slack: -0.00e+00
constraint _C340 has value: 0.00e+00 and slack: -0.00e+00
constraint _C341 has value: 0.00e+00 and slack: -0.00e+00
constraint _C342 has value: 0.00e+00 and slack: -0.00e+00
constraint _C343 has value: 0.00e+00 and slack: -0.00e+00
constraint _C344 has value: 2.00e+00 and slack: -2.00e+00
constraint _C345 has value: 1.00e+00 and slack: -1.00e+00
constraint _C346 has value: 0.00e+00 and slack: -0.00e+00
constraint _C347 has value: 0.00e+00 and slack: -0.00e+00
constraint _C348 has value: 1.00e+00 and slack: -1.00e+00
constraint _C349 has value: 0.00e+00 and slack: -0.00e+00
constraint _C350 has value: 1.80e+01 and slack: -1.80e+01
constraint _C351 has value: 0.00e+00 and slack: -0.00e+00
constraint _C352 has value: 0.00e+00 and slack: -0.00e+00
constraint _C353 has value: 0.00e+00 and slack: -0.00e+00
constraint _C354 has value: 0.00e+00 and slack: -0.00e+00
constraint _C355 has value: 0.00e+00 and slack: -0.00e+00
constraint _C356 has value: 0.00e+00 and slack: -0.00e+00
constraint _C357 has value: 0.00e+00 and slack: -0.00e+00
constraint _C358 has value: 2.00e+00 and slack: -2.00e+00
constraint _C359 has value: 1.00e-08 and slack: -0.00e+00
constraint _C360 has value: 1.00e+00 and slack: -1.00e+00
constraint _C361 has value: 1.00e+00 and slack: -1.00e+00
constraint _C362 has value: 0.00e+00 and slack: -0.00e+00
constraint _C363 has value: 0.00e+00 and slack: -0.00e+00
constraint _C364 has value: 8.00e+00 and slack: -8.00e+00
constraint _C365 has value: 1.00e+00 and slack: -1.00e+00
constraint _C366 has value: 0.00e+00 and slack: -0.00e+00
constraint _C367 has value: 0.00e+00 and slack: -0.00e+00
constraint _C368 has value: 1.00e+00 and slack: -1.00e+00
constraint _C369 has value: 0.00e+00 and slack: -0.00e+00
constraint _C370 has value: 2.20e+01 and slack: -2.20e+01
constraint _C371 has value: 1.00e+00 and slack: -1.00e+00
constraint _C372 has value: 3.00e+00 and slack: -3.00e+00
constraint _C373 has value: -5.60e+01 and slack: 5.60e+01

log.txt
Downloads.zip

@jjhforrest
Copy link
Contributor

Does not look like an error in Cbc - but in the pulp interface. Have you tried a more recent version of pulp?

Running cbc 2.10.3 on python_1.mps looks fine

bin/cbc /tmp/python_1.mps -ratiogap 0.05 -allowablegap 0.05 -maximize -solve
Welcome to the CBC MILP Solver
Version: 2.10.3
Build Date: Jun 14 2019

command line - ../bin/cbc /tmp/eeeeee/python_1.mps -ratiogap 0.05 -allowablegap 0.05 -maximize -solve (default strategy 1)
At line 2 NAME Optimization_Problem
At line 3 ROWS
At line 378 COLUMNS
At line 2851 RHS
At line 3225 BOUNDS
At line 3638 ENDATA
Problem Optimization_Problem has 373 rows, 412 columns and 2060 elements
Coin0008I Optimization_Problem read with 0 errors
ratioGap was changed from 0 to 0.05
allowableGap was changed from 1e-10 to 0.05
Presolve 195 (-178) rows, 289 (-123) columns and 1031 (-1029) elements
0 Obj 31561.643 Primal inf 146.96956 (107) Dual inf 81713.138 (289)
78 Obj 113919.69 Primal inf 7.1017596 (21)
99 Obj 112268.35
Optimal - objective value 112268.35
After Postsolve, objective 112268.35, infeasibilities - dual 0 (0), primal 0 (0)
Optimal objective 112268.3456 - 99 iterations time 0.002, Presolve 0.00
Total time (CPU seconds): 0.01 (Wallclock seconds): 0.01

@tle4336
Copy link
Author

tle4336 commented Jul 11, 2023

@jjhforrest Thank you very much for your quick reply, Dr. Forrest. My pulp version is 2.7.0, which is the latest one I believe. Could you retry the .mp file above without changing the ratiogap and allowablegap (so, let's switch them back to their default values)? I was searching on this github exhaustively to try fixing the above issue myself, but the pulp.PULP_CBC_CMD() does not give options to change either primalTolerance or dualTolerance, and I have no idea what else to try.

One minor information - I ran cbc via the python code in Pycharm, not via the command line option like you did (I don't know how to run it through command line in Pycharm though).

@jjhforrest
Copy link
Contributor

I know very little about pulp, but I downloaded pulp.

Ran it from pulp as

var2,prob2=pulp.LpProblem.fromMPS("python_1.mps",pulp.LpMaximize)
prob2.solve()
and it still looks fine

Output -
Welcome to the CBC MILP Solver
Version: 2.10.3
Build Date: Dec 15 2019

command line - /home/john/pulp/pulp/apis/../solverdir/cbc/linux/64/cbc /tmp/c3527ebbb1414f418780894de32fc856-pulp.mps max basisin /tmp/lp.bas timeMode elapsed branch basisout /tmp/lp.bas printingOptions all solution /tmp/c3527ebbb1414f418780894de32fc856-pulp.sol (default strategy 1)
At line 2 NAME MODEL
At line 3 ROWS
At line 378 COLUMNS
At line 2851 RHS
At line 3225 BOUNDS
At line 3638 ENDATA
Problem MODEL has 373 rows, 412 columns and 2060 elements
Coin0008I MODEL read with 0 errors
At line 1 NAME MODEL VALUES
At line 255 ENDATA
Option for timeMode changed from cpu to elapsed
Presolve 195 (-178) rows, 289 (-123) columns and 1031 (-1029) elements
0 Obj 59981.313 Primal inf 3.3289825 (3) Dual inf 20884.355 (253)
0 Obj 59981.313 Primal inf 3.3289825 (3) Dual inf 9.6897901e+10 (246)
110 Obj 105036.31 Dual inf 7632.5281 (129)
249 Obj 112268.35
Optimal - objective value 112268.35
After Postsolve, objective 112268.35, infeasibilities - dual 0 (0), primal 0 (0)
Optimal objective 112268.3456 - 249 iterations time 0.002, Presolve 0.00
Option for printingOptions changed from normal to all
Total time (CPU seconds): 0.01 (Wallclock seconds): 0.01

1

@tle4336
Copy link
Author

tle4336 commented Jul 11, 2023

@jjhforrest Thank you so much. It is indeed weird, because I replicated your step and still got Infeasible. It always stops at the 55th iteration...

var2, prob2 = pulp.LpProblem.fromMPS("/Users/MyName/Downloads/python_1.mps",pulp.LpMaximize)
prob2.solve()
Welcome to the CBC MILP Solver
Version: 2.10.3
Build Date: Dec 15 2019
command line - C:\Users[Name]\lib\site-packages\pulp\solverdir\cbc\win\64\cbc.exe C:\Users\MYNAME1\AppData\Local\Temp\0cc2907b024549d8bfc512c207f4076d-pulp.mps max timeMode elapsed branch printingOptions all solution C:\Users\MYNAME1\AppData\Local\Temp\0cc2907b024549d8bfc512c207f4076d-pulp.sol (default strategy 1)
At line 2 NAME MODEL
At line 3 ROWS
At line 378 COLUMNS
At line 2851 RHS
At line 3225 BOUNDS
At line 3638 ENDATA
Problem MODEL has 373 rows, 412 columns and 2060 elements
Coin0008I MODEL read with 0 errors
Option for timeMode changed from cpu to elapsed
Presolve 193 (-180) rows, 289 (-123) columns and 1011 (-1049) elements
0 Obj 31829.833 Primal inf 153.86618 (105) Dual inf 81713.138 (289)
55 Obj 115959.85 Primal inf 22.794851 (43)
Primal infeasible - objective value 115959.85
Presolved problem not optimal, resolve after postsolve
After Postsolve, objective 115959.85, infeasibilities - dual 0 (0), primal 54.149996 (42)
PrimalInfeasible objective 115959.8501 - 55 iterations time 0.002, Presolve 0.00
Result - Linear relaxation infeasible
Enumerated nodes: 0
Total iterations: 0
Time (CPU seconds): 0.01
Time (Wallclock Seconds): 0.01
Option for printingOptions changed from normal to all
Total time (CPU seconds): 0.01 (Wallclock seconds): 0.01

@tle4336
Copy link
Author

tle4336 commented Jul 11, 2023

The differences start at the Presolve step of CBC. Mine was

Presolve 193 (-180) rows, 289 (-123) columns and 1011 (-1049) elements

compared to yours: Presolve 195 (-178) rows, 289 (-123) columns and 1031 (-1029) elements

The 0th iteration showed a huge discrepancy in terms of result. So weird.

Is this due to the FACT that you ran 'cbc' on Linux, while I ran it on Windows 10 (64-bit)?

@tle4336
Copy link
Author

tle4336 commented Jul 11, 2023

@jjhforrest Hi Dr. Forrest, I am wondering if you have some time to think about the potential sources of the discrepancy? I tried turning off the presolve option using this link (https://or.stackexchange.com/questions/8285/how-do-i-turn-off-preprocessing-in-pulp) but it did not work.

@jjhforrest
Copy link
Contributor

It seems to me that fromMPS is broken. If I do writeMPS on a small miplib problem like enigma, I can see that some of RHS values are missing. If I edit file so that only one RHS value per line it works. With MARKER INTORG in file pulp thinks problem is integer - if BV in bounds then it thinks it is a continuous problem.

@tle4336
Copy link
Author

tle4336 commented Jul 12, 2023

@jjhforrest Good morning, thank you very much for your further investigation. Didn't your second test above with var2,prob2=pulp.LpProblem.fromMPS("python_1.mps",pulp.LpMaximize) give the same, correct result as the first test? I think the presolve step is somehow broken, but I am not sure if it is ONLY the problem with Windows 10 (64-bit). I went through the above .mps file but I don't see any missing RHS NOR the MARKET INTORG . Something else must have gone wrong in the presolve capability?

Please help give the below .mps files a run, as both of them are currently seen as "Infeasible" in the pre-solve and post-solve step. They are all feasible problems)
2InfeasibleProbs.zip

@tle4336
Copy link
Author

tle4336 commented Jul 13, 2023

@jjhforrest @dpo @chmduquesne Could either of you help give these problems (
InfeasibleProblems.zip) a run on your machine in Linux. I am wondering whether the presolve step of CBC solver behaved differently on Linux versus Windows, which would then require a serious fix from the Development team of CBC solver? All these 3 problems failed at presolve step with the logs below:

Infeasible1.mps file - Output from CBC

At line 2 NAME MODEL
At line 3 ROWS
At line 1576 COLUMNS
At line 23405 RHS
At line 24977 BOUNDS
At line 28616 ENDATA
Problem MODEL has 1571 rows, 3638 columns and 18190 elements
Coin0008I MODEL read with 0 errors
Option for timeMode changed from cpu to elapsed
Presolve 990 (-581) rows, 3055 (-583) columns and 14847 (-3343) elements
0 Obj 317849.66 Primal inf 1583.772 (539) Dual inf 4529047.1 (3055)
94 Obj 4148089.4 Primal inf 167.31494 (277)
103 Obj 4146366.3 Primal inf 144.05725 (274)
Primal infeasible - objective value 4146366.3
Presolved problem not optimal, resolve after postsolve
After Postsolve, objective 4146366.3, infeasibilities - dual 0 (0), primal 1008.173 (274)
PrimalInfeasible objective 4146366.288 - 103 iterations time 0.012, Presolve 0.00
Result - Linear relaxation infeasible
Enumerated nodes: 0
Total iterations: 0
Time (CPU seconds): 0.02
Time (Wallclock Seconds): 0.02
Option for printingOptions changed from normal to all
Total time (CPU seconds): 0.03 (Wallclock seconds): 0.03

Infeasible2.mps file - Output from CBC:

At line 2 NAME MODEL
At line 3 ROWS
At line 1346 COLUMNS
At line 22455 RHS
At line 23797 BOUNDS
At line 27316 ENDATA
Problem MODEL has 1341 rows, 3518 columns and 17590 elements
Coin0008I MODEL read with 0 errors
Option for timeMode changed from cpu to elapsed
Presolve determined that the problem was infeasible with tolerance of 1e-08
Analysis indicates model infeasible or unbounded

0 Obj -0 Primal inf 1693.7166 (641) Dual inf 4490588.9 (3518)
101 Obj 3588287.6 Primal inf 250.09876 (346)
202 Obj 3551472.8 Primal inf 130.91826 (270)
220 Obj 3548817.9 Primal inf 95.447883 (251)
Primal infeasible - objective value 3548817.9
PrimalInfeasible objective 3548817.892 - 220 iterations time 0.012
Result - Linear relaxation infeasible
Enumerated nodes: 0
Total iterations: 0
Time (CPU seconds): 0.02
Time (Wallclock Seconds): 0.02
Option for printingOptions changed from normal to all
Total time (CPU seconds): 0.03 (Wallclock seconds): 0.03

Infeasible3.mps file - Output from CBC solver

At line 2 NAME MODEL
At line 3 ROWS
At line 1288 COLUMNS
At line 20639 RHS
At line 21923 BOUNDS
At line 25149 ENDATA
Problem MODEL has 1283 rows, 3225 columns and 16125 elements
Coin0008I MODEL read with 0 errors
Option for timeMode changed from cpu to elapsed
Presolve 954 (-329) rows, 2804 (-421) columns and 13093 (-3032) elements
0 Obj 288960.24 Primal inf 1344.4765 (520) Dual inf 3648671.9 (2804)
94 Obj 3768335.7 Primal inf 228.64093 (277)
188 Obj 3707134.9 Primal inf 100.93063 (233)
282 Obj 3667195.5 Primal inf 45.82908 (161)
323 Obj 3658292.6 Primal inf 27.469666 (125)
Primal infeasible - objective value 3658292.6
Presolved problem not optimal, resolve after postsolve
After Postsolve, objective 3658292.6, infeasibilities - dual 389.14423 (2), primal 183.49188 (125)
0 Obj 3658606.1 Primal inf 31.181091 (126) Dual inf 1427.2373 (2)
2 Obj 3658866.1 Primal inf 31.246957 (129)
Primal infeasible - objective value 3658866.1
PrimalInfeasible objective 3658866.106 - 325 iterations time 0.012, Presolve 0.00
Result - Linear relaxation infeasible
Enumerated nodes: 0
Total iterations: 0
Time (CPU seconds): 0.02
Time (Wallclock Seconds): 0.02
Option for printingOptions changed from normal to all
Total time (CPU seconds): 0.03 (Wallclock seconds): 0.03

If I use lpsolve package in R, all 3 problems are feasible with the corresponding optimal values = [4093513, 3518700, 3644587].

@jjhforrest
Copy link
Contributor

I have tried several solvers which all say infeasible. Take Infeasible2.mps - if I look at rows _C29 and _C585

G _C29 L _C585
x1335 _C29 6.000000000000e+00 x1335 _C585 6.000000000000e+00
x1336 _C29 1.100000000000e+01 x1336 _C585 1.100000000000e+01
x2208 _C29 2.920000000000e+02 x2208 _C585 2.920000000000e+02
x2209 _C29 4.180000000000e+02 x2209 _C585 4.180000000000e+02
x2758 _C29 7.000000000000e+00 x2758 _C585 7.000000000000e+00
x2759 _C29 3.000000000000e+00 x2759 _C585 3.000000000000e+00
x306 _C29 1.800000000000e+01 x306 _C585 1.800000000000e+01
x307 _C29 1.200000000000e+01 x307 _C585 1.200000000000e+01
x43 _C29 3.400000000000e+01 x43 _C585 3.400000000000e+01
x44 _C29 8.000000000000e+00 x44 _C585 8.000000000000e+00
x767 _C29 1.000000000000e+01 x767 _C585 1.000000000000e+01
x898 _C29 7.000000000000e+00 x898 _C585 7.000000000000e+00
x899 _C29 7.000000000000e+00 x899 _C585 7.000000000000e+00
RHS _C29 7.360000000000e+02 RHS _C585 7.100000000000e+02
The two rows are identical but _C29 says >= 736 while _C585 says <= 710
which is obviously infeasible

@tle4336
Copy link
Author

tle4336 commented Jul 13, 2023

@jjhforrest Thank you so much for your help on trying different solvers. Did you still get 'Infeasible' status with Infeasible1.mps AND Infeasible3.mps files with those different solvers? Because if that is the case, the problem now is actually with the lpsolve package in R. I will check the two above mentioned constraints in R to ensure this is the case.

Another question though: how were you able to identify those two identical constraints? Going through the .mps file to carve out such identical constraints seems not feasible to me, so I guess we have to look at the .lp file?

@jjhforrest
Copy link
Contributor

Other solvers say infeasible. On Infeasible2.mps clp with loglevel 3 gives

Problem is infeasible due to row 584, -1.797693134862316e+308 710
and debugging gave other row

@tle4336
Copy link
Author

tle4336 commented Jul 13, 2023

Do the other solvers say the same thing for Infeasible1.mps and Infeasible3.mps? I am trying to reinforce why the two packages lpsolve and CBC came to different conclusions on the same optimization problem (still verifying on the lpsolve side now on those 2 constraints that you pointed out!!)

@tle4336
Copy link
Author

tle4336 commented Jul 13, 2023

@jjhforrest Do you have any ways to read this '.lp' file into Python and call CBC solver to solve it? This '.lp' file is generated by R, but my thorough inspection shows that it is mathematically equivalent to the LP in 'Infeasible2.mps' file.
ProblemR.zip

@tkralphs
Copy link
Member

tkralphs commented Jul 13, 2023

CyLP will read in MPS files and solve them in Cbc (but not LP, unfortunately). See here.

@tle4336
Copy link
Author

tle4336 commented Jul 14, 2023

@tkralphs Thank you.
@jjhforrest I have a quick question: how do we invoke the loglevel 3 message to display which constraint is violated in an infeasible problem? That would be super helpful for me to know why the problem in the OP is still infeasible by CBC solver on my local machine.

@tle4336
Copy link
Author

tle4336 commented Jul 19, 2023

@jjhforrest Hi Dr. Forrest, I figured out the above problem by turning off the presolve thanks to the help of @chmduquesne . I have another question though: is the bug that you found for .fromMPS() function fixed? I meant, should I trust that function to work properly if I need to read an .mps file into Python? Or should I opt for the CyLP package introduced by @tkralphs ?

@tkralphs Have you ever tested your .primal() solver to see if it gives the same result as CbC? I know you mentioned that it used CbC, but I failed to see it on the github page of CyLP. Any assistance you could offer would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants