Search code examples
scip

SCIP write best feasible solution in automated test


Based on steps in http://scip.zib.de/doc/html/TEST.php, I have managed to set up an automated test using SCIP. However, I'd like to write the solution (best feasible solution) to a file, instead of just getting the objective value. Is there anyway to do it in the automated test?

I did a hack in check.sh by replacing

OPTCOMMAND=optimize; write solution myfilename.sol;

But too bad, it doesn't seem to work, when I tried to make TEST=mytest test, this line is observed from the output

 bash ./check.sh mytest bin/scip-3.1.0.linux.x86_64.gnu.opt.spx default scip-3.1.0.linux.x86_64.gnu.opt.spx 3600 2100000000 6144 1 default 10000 false false 3.1.0 spx false /tmp optimize;
 write: solution is not logged in on myfilename.sol

I know it is possible to write the solution via interactive shell, but I am trying to automate the test in order to retrieve both solution and obj value. Any help or clarification will be much appreciated!


Solution

  • You are getting an error because with the syntax you are using, you try to invoke a bash command called "write" because of the semicolon:

    The write utility allows you to communicate with other users, by copying lines from your terminal to theirs.

    Just try without semicolon ;)

    The cleaner solution would be to modify the file "check/configuration_tmpfile_setup_scip.sh" and add the line

    echo write solution /absolute/path/to/solutions/${INSTANCE}.sol >> $TMPFILE
    

    before the quit command. This configuration file sets up a batch file to feed SCIP with all commands that the interactive shell should execute, and you can model arbitrary user behavior.