[SCIP] SCIP 8 can read AMPL NL-file but how to write AMPL SOL-file ?

Stefan Vigerske svigerske at gams.com
Mon Mar 14 09:42:30 CET 2022


Hi,

On 3/13/22 23:41, Vladimir V. Voloshinov wrote:
> Sorry,
> when I read the Section 7.1 of "The SCIP Optimization Suite 8.0" again I
> understood that I did not follow your instructions.
> I erroneously have run SCIP by interactive shell:
> "SCIP> read problem.nl optimize write/solution"...
> 
> The command
> $ scip problem.nl -AMPL
> gave the AMPL SOL-file as I expected.
> 
> And still the question remains: is it possible to get AMPL SOL via SCIP
> interactive shell?
> I see the function SCIPwriteSolutionNl() in SCIP API (
> https://scipopt.org/doc/html/reader__nl_8h.php)...

No.

There is no shell command that would trigger SCIPwriteSolutionNl(). I 
also think it isn't a good idea to have this in general, as we can write 
AMPL .sol files only when the problem has been read from an AMPL .nl 
file. If the problem was read from somewhere else, bad things could 
happen when attempting to write an AMPL .sol file.

I don't know (or better, I forgot) what you need the interactive shell 
for when running from Pyomo.
With this change, you will get a shell when running scip problem -AMPL:
--- a/src/scip/scipshell.c
+++ b/src/scip/scipshell.c
@@ -192,7 +192,7 @@ SCIP_RETCODE fromAmpl(
     SCIPinfoMessage(scip, NULL, "\nsolve problem\n");
     SCIPinfoMessage(scip, NULL, "=============\n\n");

-   SCIP_CALL( SCIPsolve(scip) );
+   SCIP_CALL( SCIPstartInteraction(scip) );

     SCIP_CALL( SCIPgetBoolParam(scip, "display/statistics", &printstat) );
     if( printstat )


The shell would be called after the .nl file has been read. After the 
shell is closed, SCIPwriteSolutionNl() is called. If you used the shell 
to read a problem from a different file format in the meanwhile, things 
may crash.
But I think we can bring back the -i option to switch between 
SCIPsolve() and SCIPstartInteraction() at this point.

Stefan

> 
> Yours, Vladimir.
> 
> On Sun, Mar 13, 2022 at 10:36 PM Vladimir V. Voloshinov <
> vladimir.voloshinov at gmail.com> wrote:
> 
>> Hi,
>> I tried SCIP-application (v8) with some AMPL NL-file as input problem
>> data. It was accepted, the problem has been solved.
>> But the command "write/solution" wrote the solution in CIP-format !
>> Is it possible to get the solution in AMPL SOL-format ? (We use Python
>> Pyomo package to write NL-files and read solutions in AMPL SOL-formats)
>> I can not find the "write/amplsol" command in SCIP v8 (as it was in
>> SCIPAMPL application in previous versions)...
>>
>> Sincerely yours,
>> Vladimir
>>
> 
> 
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> https://listserv.zib.de/mailman/listinfo/scip



More information about the Scip mailing list