[SCIP] how can I output my best solution using SCIPgetBestSol() to a file?

Melvin Shih melvinshih at gmail.com
Sun Sep 13 20:09:23 CEST 2020


Dear SCIP members,

I have tried functions of fstream and SCIP_FILE to open a file for
SCIPgetBestSol(), and they do not work.
Is there any example to define a file for  SCIPgetBestSol() or is there
another way to do so using C++?

Sincerely,

Melvin shih


Here are my codes:
.............
// fstream file;
// file.open("Reader.txt", ios::out | ios::trunc);       //not work

SCIP_FILE* schedulingfile;
char filename[255];
(void)SCIPsnprintf(filename, 255, "Sintex.txt");
schedulingfile = SCIPfopen(filename, "r");
if (schedulingfile == NULL)
{
SCIPerrorMessage("cannot open file <%s> for reading\n", filename);
SCIPprintSysError(filename);
return SCIP_NOFILE;
}
if (SCIPgetNSols(scip) > 0)
{
SCIPinfoMessage(scip, NULL, "\nSolution:\n");
SCIP_CALL(SCIPprintSol(scip, SCIPgetBestSol(scip), schedulingfile,
FALSE));   //SCIP_FILE is not accepted
}
SCIPfclose(schedulingfile);
..........
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.zib.de/pipermail/scip/attachments/20200914/6b830072/attachment.html>


More information about the Scip mailing list