Skip to content

Commit

Permalink
fix for OBJSENSE and min/max on same card
Browse files Browse the repository at this point in the history
  • Loading branch information
jjhforrest committed Apr 13, 2023
1 parent 20a9d72 commit 720432c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions CoinUtils/src/CoinMpsIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1635,9 +1635,17 @@ int CoinMpsIO::readMps(int &numberSets, CoinSet **&sets)
cardReader_->nextField();
// Fudge for what ever code has OBJSENSE
if (!strncmp(cardReader_->card(), "OBJSENSE", 8)) {
// Correct format has min/max on next card
const char *thisCard = cardReader_->card();
char temp[80];
cardReader_->strcpyAndCompress(temp,cardReader_->card());
bool onSameCard = false;
if (strlen(temp)>10) {
onSameCard = true;
thisCard += 8; // move on
}
cardReader_->nextField();
int i;
const char *thisCard = cardReader_->card();
int direction = 0;
for (i = 0; i < 20; i++) {
if (thisCard[i] != ' ') {
Expand All @@ -1653,7 +1661,8 @@ int CoinMpsIO::readMps(int &numberSets, CoinSet **&sets)
else
printf("%s found after OBJSENSE - Coin ignores\n",
(direction > 0 ? "MIN" : "MAX"));
cardReader_->nextField();
if (!onSameCard)
cardReader_->nextField();
}
if (cardReader_->whichSection() != COIN_ROW_SECTION) {
handler_->message(COIN_MPS_BADIMAGE, messages_) << cardReader_->cardNumber()
Expand Down

0 comments on commit 720432c

Please sign in to comment.