/** dialog execution method for writing all known decompositions */ static SCIP_DECL_DIALOGEXEC(GCGdialogExecWriteAllDecompositions) { SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) ); if( SCIPgetStage(scip) >= SCIP_STAGE_PROBLEM ) { SCIP_CALL( writeAllDecompositions(scip, dialog, dialoghdlr, nextdialog) ); } else SCIPdialogMessage(scip, NULL, "no problem available\n"); *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr); return SCIP_OKAY; }
/** execution method of dialog */ static SCIP_DECL_DIALOGEXEC(dialogExecXyz) { /*lint --e{715}*/ SCIPerrorMessage("method of xyz dialog not implemented yet\n"); SCIPABORT(); /*lint --e{827}*/ /* add your dialog to history of dialogs that have been executed */ SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) ); /* TODO: Implement execution of your dialog here. */ /* next dialog will be root dialog again */ *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr); return SCIP_OKAY; }
/** writes out all decompositions currently known to cons_decomp */ static SCIP_RETCODE writeAllDecompositions( SCIP* scip, /**< SCIP data structure */ SCIP_DIALOG* dialog, /**< dialog menu */ SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */ SCIP_DIALOG** nextdialog /**< pointer to store next dialog to execute */ ) { char* filename; SCIP_Bool endoffile; SCIP_RETCODE retcode; SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter extension: ", &filename, &endoffile) ); if( endoffile ) { *nextdialog = NULL; return SCIP_OKAY; } if( filename[0] != '\0' ) { char* extension; extension = filename; SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, extension, TRUE) ); do { retcode = DECwriteAllDecomps(scip, extension); if( retcode == SCIP_FILECREATEERROR ) { SCIPdialogMessage(scip, NULL, "error creating files\n"); SCIPdialoghdlrClearBuffer(dialoghdlr); break; } else if( retcode == SCIP_WRITEERROR ) { SCIPdialogMessage(scip, NULL, "error writing files\n"); SCIPdialoghdlrClearBuffer(dialoghdlr); break; } else if( retcode == SCIP_PLUGINNOTFOUND ) { /* ask user once for a suitable reader */ if( extension == NULL ) { SCIPdialogMessage(scip, NULL, "no reader for requested output format\n"); SCIPdialogMessage(scip, NULL, "following readers are avaliable for writing:\n"); displayReaders(scip, FALSE, TRUE); SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "select a suitable reader by extension (or return): ", &extension, &endoffile) ); if( extension[0] == '\0' ) break; } else { SCIPdialogMessage(scip, NULL, "no reader for output in <%s> format\n", extension); extension = NULL; } } else { /* check for unexpected errors */ SCIP_CALL( retcode ); /* print result message if writing was successful */ SCIPdialogMessage(scip, NULL, "written all decompositions %s\n", extension); break; } } while (extension != NULL ); } return SCIP_OKAY; }