Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v9-minor'
Browse files Browse the repository at this point in the history
  • Loading branch information
scip-ci committed Jan 13, 2025
2 parents 11d9afd + 8f85891 commit d9331d5
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Miscellaneous
-------------

- the output precision for writing CIP/OPB files has been increased at several places for nonlinear constraints
- the solchecker tool now also supports SCIP solution format
- the solchecker tool now also supports SCIP solutions without unknown or infinite values

Known bugs
----------
Expand Down
12 changes: 2 additions & 10 deletions check/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,8 @@ fi

if test -e "${SOLFILE}"
then
# translate SCIP solution format into format for solution checker. The
# SOLFILE format is a very simple format where in each line we have a
# <variable, value> pair, separated by spaces. A variable name of
# =obj= is used to store the objective value of the solution, as
# computed by the solver. A variable name of =infeas= can be used to
# indicate that an instance is infeasible.
sed ' /solution status:/d;
s/objective value:/=obj=/g;
s/infinity/1e+20/g;
s/no solution available//g' "${SOLFILE}" > "${TMPFILE}"
# workaround infinite values for solution checker
sed 's/infinity/1e+20/g' "${SOLFILE}" > "${TMPFILE}"
mv "${TMPFILE}" "${SOLFILE}"

# check if the link to the solution checker exists
Expand Down
14 changes: 4 additions & 10 deletions check/run_fscip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,10 @@ echo >> "${OUTFILE}"

if test -e "${SOLFILE}"
then
# translate SCIP solution format into format for solution checker. The
# SOLFILE format is a very simple format where in each line we have a
# <variable, value> pair, separated by spaces. A variable name of
# =obj= is used to store the objective value of the solution, as
# computed by the solver. A variable name of =infeas= can be used to
# indicate that an instance is infeasible.
sed ' /solution status:/d;
/\[ Final Solution \]/d;
s/objective value:/=obj=/g;
s/No Solution//g' "${SOLFILE}" > "${TMPFILE}"
# translate FiberSCIP solution format into SCIP solution format and workaround infinite values for solution checker
sed ' /\[ Final Solution \]/d;
s/No Solution/no solution available/g;
s/infinity/1e+20/g' "${SOLFILE}" > "${TMPFILE}"
mv "${TMPFILE}" "${SOLFILE}"

# check if the link to the solution checker exists
Expand Down
6 changes: 5 additions & 1 deletion check/solchecker/src/gmputils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ bool Rational::isZero() const
return (mpq_sgn(number) == 0);
}

void Rational::fromString(const char* num)
bool Rational::fromString(const char* num)
{
char* tmp = &buffer[0];
int exponent = 0;
Expand Down Expand Up @@ -202,6 +202,8 @@ void Rational::fromString(const char* num)
exponent += atoi(&num[i + 1]);
break;
}
else
return false;
}
while( exponent > 0 )
{
Expand All @@ -220,6 +222,8 @@ void Rational::fromString(const char* num)

mpq_set_str(number, tmp, 10);
mpq_canonicalize(number);

return true;
}

std::string Rational::toString() const
Expand Down
3 changes: 2 additions & 1 deletion check/solchecker/src/gmputils.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ class Rational
* This functions essentially parses a number of the form
* [+|-]?[0-9]*.[0-9]+[[e|E][+|-][0-9]+]?
* and generates the corresponding fraction.
* Returns true if reading successful.
*/
void fromString(const char* str);
bool fromString(const char* str);

/**
* Convert a rational number to a string representation.
Expand Down
17 changes: 15 additions & 2 deletions check/solchecker/src/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,13 @@ bool Model::readSol(const char* filename)
{
// read objective value
hasObjectiveValue = true;
objectiveValue.fromString(valuep);

if( !objectiveValue.fromString(valuep) )
{
std::cerr << "unexpected objective <" << valuep << "> in solution file" << std::endl;
isSolFeas = false;
break;
}
}
else
{
Expand All @@ -476,7 +482,14 @@ bool Model::readSol(const char* filename)
}

Rational value;
value.fromString(valuep);

if( !value.fromString(valuep) )
{
std::cerr << "unexpected value <" << valuep << "> in solution file" << std::endl;
isSolFeas = false;
break;
}

var->value = value;
}
}
Expand Down

0 comments on commit d9331d5

Please sign in to comment.