Repository navigation
LpSolveStats - #942
LpSolveStats#942
Conversation
|
pchtsp seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
Working for me. Claude found one issue that I can only relay verbatim (feel free to ignore): best_bound sign flipped for maximize problems on COIN_CMD COIN_CMD writes maximize problems as a negated-objective MPS with no OBJSENSE and no -max. CBC's log is therefore in minimize sense. LpSolver.buildStats copies orloge's best_bound and best_solution without flipping them for lp.sense. Minimal repro: Same model as minimize gives best_bound -18.0, gap_rel 0.0. Fix location: buildStats (or COIN_CMD.actualSolve) must negate log-derived bound and objective when lp.sense == LpMaximize. Other CMD solvers that write LP files with a Maximize section are not affected by this path. |
|
thank you. Claude is correct about the error detection. orloge is parsing correctly the CBC logs but pulp needs to flip those values when sense == LpMaximize |
|
Globally a better idea to return an object after solve instead of changing the LpProblem attributes. Pure frozen dataclasses should be used to be close to a DDD architecture. Some minor notes: Try to avoid repeating string literals "Optimal" etc.: use constants instead or enum.StrEnum (as you did for StrInt Method naming conventions in Python is snakecase, e.g. prefer using Do you want to let users adding their own solver Pulp API (plugin system)? If not, prefer using StrEnum, constants or solver services' class attributes as dictionary keys in LOG_DIALECTS dictionary. This will enforce typing verification. |
|
thanks for the comments @vepain
I'm not sure where do you see these. Can you give me an example?
I agree, I'm usually conflicted between following python convention and this repo's convention (which precedes me and has "toJson" convention for the most part) for new methods. I never know what to follow.
Ideally, yes: there is even some minor functionality that allows users to plug-in specific solvers (see https://github.com/coin-or/pulp/blob/master/pulp/apis/__init__.py#L103). This doesn't happen very often but someone did ask for this method this year to do exactly that. |
Never mind, I get confused while reading. The comment concerned the API but because it is specified only once, it is overkill to create a constant or a StrEnum. |
Adopt master's import_optional/@requires handling of optional solver libraries while keeping the LpSolveStats changes of this branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No description provided.