Loading...
Searching...
No Matches
dialog_explore.cpp
Go to the documentation of this file.
36 * The explore menu gives the user detailed information about all decompositions and a possibility to edit such.
39/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
65const char* DEFAULT_COLUMNS[] {"nr", "id", "nbloc", "nmacon", "nlivar", "nmavar", "nstlva", "score", "history", "pre", "nopcon", "nopvar", "sel"};
106 Column(const char* columnHeader, const char* columnDesc, std::function<T(PARTIALDECOMP&)>&& columnCallback, RETTYPE columnType) :
194 std::stable_sort(partialdeclist.begin(), partialdeclist.end(), [&](PARTIALDECOMP* const a, PARTIALDECOMP* const b) { return column->compareValues(a, b) < 0; });
196 std::stable_sort(partialdeclist.begin(), partialdeclist.end(), [&](PARTIALDECOMP* const a, PARTIALDECOMP* const b) { return column->compareValues(b, a) < 0; });
223 SCIPdialogMessage(scip, NULL, "Please specify the amount of entries to be shown in this menu:\n");
281 SCIPdialogMessage(scip, NULL, "Note: Sets the detection/scores/selected parameter to the score\'s shortname.\n");
297 SCIP_CALL( SCIPsetStringParam(scip, "detection/scores/selected", GCGscoreGetShortname(score)) );
347 /* update partialdec list in case it changed (in which case the amount of partialdecs should have changed)*/
350 /* sort partialdec ids by score, descending (in case score was changed or id list was updated)*/
511 SCIPdialogMessage(scip, NULL, "%30s %4c\n", GCGdetectorGetName(detector), GCGdetectorGetChar(detector));
517 SCIPdialogMessage(scip, NULL, "=================================================================================================== \n");
542 SCIPdialogMessage(scip, NULL, "%30s %s\n", GCGscoreGetShortname(score), GCGscoreGetDesc(score));
546 SCIPdialogMessage(scip, NULL, "\n=================================================================================================== \n");
565 SCIPdialogMessage(scip, NULL, "=================================================================================================== \n");
572 SCIPdialogMessage(scip, NULL, "%30s %s\n", "legend", "displays the legend for table header and history abbreviations");
573 SCIPdialogMessage(scip, NULL, "%30s %s\n", "select", "selects/unselects decomposition with given nr");
574 SCIPdialogMessage(scip, NULL, "%30s %s\n", "previous", "displays the preceding decompositions (if there are any)");
575 SCIPdialogMessage(scip, NULL, "%30s %s\n", "next", "displays the subsequent decompositions (if there are any)");
578 SCIPdialogMessage(scip, NULL, "%30s %s\n", "entries", "modifies the number of decompositions to display per page");
579 SCIPdialogMessage(scip, NULL, "%30s %s\n", "export", "generates visualization of the specified decomposition in gnuplot format");
580 SCIPdialogMessage(scip, NULL, "%30s %s\n", "visualize", "generates visualization and opens it (requires gnuplot)");
581 SCIPdialogMessage(scip, NULL, "%30s %s\n", "inspect", "displays detailed information for the specified decomposition");
582 SCIPdialogMessage(scip, NULL, "%30s %s\n", "score", "sets the score by which the quality of decompositions is evaluated");
583 SCIPdialogMessage(scip, NULL, "%30s %s\n", "sort", "sets the column by which the decompositions are sorted (default: by score)");
584 SCIPdialogMessage(scip, NULL, "%30s %s\n", "ascending", "sort decompositions in ascending (true) or descending (false) order");
585 SCIPdialogMessage(scip, NULL, "%30s %s\n", "list", "specify whether all decompositions should be listed");
588 SCIPdialogMessage(scip, NULL, "\n=================================================================================================== \n");
616 SCIPdialogMessage(scip, NULL, "Please specify the nr of the decomposition to be visualized:\n");
669 SCIPdialogMessage( scip, NULL, "Please specify the nr of the decomposition to be inspected:\n");
733 SCIPdialogMessage(scip, NULL, "\nPlease specify the nr of the decomposition to be selected:\n");
778 SCIPdialogMessage(scip, NULL, "\nPlease enter \"true\"/\"1\" for ascending or \"false\"/\"0\" for descending order:\n");
840 SCIPdialogMessage(scip, NULL, "\nPlease enter the table header of the column by which you would like to sort:\n");
880 SCIPdialogMessage(scip, NULL, "\nShould incomplete decompositions be listed? Please enter \"true\" or \"false\":\n");
939 else if( strncmp( command, "quit", commandlen) == 0 || strncmp( command, "..", commandlen) == 0 )
956 SCIP_CALL( GCGdialogSetNEntires(gcg, dialoghdlr, dialog, (int) partialdeclist.size(), menulength) );
1012 std::string sortby = DEFAULT_SORT_HEADER; /**< table header, identifies by which column to sort by */
1016 unsigned int npartialdecs = 0; /**< stores the last known number of partialdecs, is handed down to check for changes in partialdec number */
1022 SCIPdialogMessage(GCGgetOrigprob(gcg), NULL, "There are no decompositions to explore yet, please detect first.\n");
1027 /* the column information has the header, a getter for the column info and the return type of the getter */
1037 /* special case: "nr" represents the position in the menu table and is determined by the menu */
1049 "id of the decomposition (identifies the decomposition in reports/statistics/visualizations/etc.)",
1157 GCGdialogShowMenu(gcg, columns, npartialdecs, startindex, menulength, partialdeclist, sortasc, sortby, listopenpartialdecs);
1162 GCGdialogExecCommand(gcg, dialoghdlr, dialog, columns, command, startindex, menulength, finished, partialdeclist, sortasc, sortby, listopenpartialdecs);
SCIP_VAR * a
SCIP_VAR ** b
SCIP_VAR ** x
class storing (potentially incomplete) decompositions
Definition dialog_explore.cpp:82
AbstractColumn(const char *columnHeader, const char *columnDesc, RETTYPE columnType)
Definition dialog_explore.cpp:84
virtual ~AbstractColumn()=default
virtual int compareValues(PARTIALDECOMP *firstdec, PARTIALDECOMP *seconddec)=0
virtual std::string getValueAsString(PARTIALDECOMP *partialdec)=0
Definition dialog_explore.cpp:104
int compareValues(PARTIALDECOMP *firstdec, PARTIALDECOMP *seconddec) override
Definition dialog_explore.cpp:120
Column(const char *columnHeader, const char *columnDesc, std::function< T(PARTIALDECOMP &)> &&columnCallback, RETTYPE columnType)
Definition dialog_explore.cpp:106
~Column() override=default
std::string getValueAsString(PARTIALDECOMP *partialdec) override
Definition dialog_explore.cpp:113
GCG_EXPORT int getNMasterconss()
Gets size of the vector containing master conss.
Definition class_partialdecomp.cpp:4481
GCG_EXPORT SCIP_Real getScore(GCG_SCORE *score)
returns the score of the partialdec
Definition class_partialdecomp.cpp:4347
GCG_EXPORT void setSelected(bool selected)
set the selection status of this partialdecs
Definition class_partialdecomp.cpp:5395
GCG_EXPORT void exportVisualization()
generates a gp visualization of the partialdec without compilation or opening
Definition class_partialdecomp.cpp:5789
GCG_EXPORT bool isAssignedToPresolvedProb()
Gets whether the partialdec is from the presolved problem.
Definition class_partialdecomp.cpp:4841
GCG_EXPORT int getNOpenvars()
Gets size of vector containing variables not assigned yet.
Definition class_partialdecomp.cpp:4509
GCG_EXPORT void displayInfo(int detailLevel)
displays the relevant information of the partialdec
Definition class_partialdecomp.cpp:3163
GCG_EXPORT void buildDecChainString(char *buffer)
creates a detector chain short string for this partialdec, is built from detector chain
Definition class_partialdecomp.cpp:5842
GCG_EXPORT int getNOpenconss()
Gets size of vector containing constraints not assigned yet.
Definition class_partialdecomp.cpp:4503
GCG_EXPORT int getNLinkingvars()
Gets size of the vector containing linking vars.
Definition class_partialdecomp.cpp:4459
GCG_EXPORT int getNTotalStairlinkingvars()
Gets total number of stairlinking vars.
Definition class_partialdecomp.cpp:4493
GCG_EXPORT int getNMastervars()
Gets size of the vector containing master vars.
Definition class_partialdecomp.cpp:4487
GCG_EXPORT void showVisualization()
generates and opens a gp visualization of the partialdec
Definition class_partialdecomp.cpp:5715
GCG_EXPORT int getID()
returns the unique id of the partialdec
Definition class_partialdecomp.cpp:4255
std::vector< PARTIALDECOMP * > * GCGconshdlrDecompGetPartialdecs(GCG *gcg)
gets vector of all partialdecs
Definition cons_decomp.cpp:4397
const char * GCGdetectorGetName(GCG_DETECTOR *detector)
returns the name of the provided detector
Definition cons_decomp.cpp:2084
GCG_SCORE ** GCGconshdlrDecompGetScores(GCG *gcg)
Gets an array of all scores.
Definition cons_decomp.cpp:3928
int GCGconshdlrDecompGetNDetectors(GCG *gcg)
Gets the number of all detectors.
Definition cons_decomp.cpp:4061
GCG_SCORE * GCGgetCurrentScore(GCG *gcg)
Gets the currently enabled score.
Definition cons_decomp.cpp:2796
char GCGdetectorGetChar(GCG_DETECTOR *detector)
Gets the character of the detector.
Definition cons_decomp.cpp:2064
int GCGconshdlrDecompGetNScores(GCG *gcg)
Gets the number of all scores.
Definition cons_decomp.cpp:4091
GCG_DETECTOR ** GCGconshdlrDecompGetDetectors(GCG *gcg)
Gets an array of all detectors.
Definition cons_decomp.cpp:3917
unsigned int GCGconshdlrDecompGetNPartialdecs(GCG *gcg)
Gets the number of all partialdecs.
Definition cons_decomp.cpp:4347
constraint handler for structure detection
C++ interface of cons_decomp.
#define SCIP_Bool
#define SCIP_Real
#define TRUE
#define FALSE
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
void SCIPdialogMessage(SCIP *scip, FILE *file, const char *formatstr,...)
SCIP_RETCODE SCIPsetStringParam(SCIP *scip, const char *name, const char *value)
SCIP_RETCODE SCIPdialoghdlrGetWord(SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, const char *prompt, char **inputword, SCIP_Bool *endoffile)
GCG_EXPORT const char * GCGscoreGetShortname(GCG_SCORE *score)
Definition score.c:155
static assert(heur !=NULL)
SCIP_CALL(SCIPgetExternBranchCands(origprob, &lpcands, &lpcandssol, NULL, &nlpcands, NULL, NULL, NULL, NULL))
#define NULL
Definition class_conspartition.cpp:44
bool updatePartialdecList(GCG *gcg, std::vector< PARTIALDECOMP * > &partialdeclist, unsigned int &npartialdecs, bool includeopenpartialdecs)
Definition dialog_explore.cpp:143
static SCIP_RETCODE GCGdialogChangeListMode(GCG *gcg, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, bool &listopenpartialdecs)
Definition dialog_explore.cpp:863
static SCIP_RETCODE GCGdialogInspectPartialdec(GCG *gcg, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, std::vector< PARTIALDECOMP * > &partialdeclist)
Definition dialog_explore.cpp:648
static SCIP_RETCODE GCGdialogChangeScore(GCG *gcg, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog)
Definition dialog_explore.cpp:261
SCIP_RETCODE GCGdialogExecExplore(GCG *gcg, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog)
Definition dialog_explore.cpp:1002
static SCIP_RETCODE GCGdialogSortBy(GCG *gcg, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, std::vector< AbstractColumn * > &columns, std::string &sortby)
Definition dialog_explore.cpp:822
static SCIP_RETCODE outputCharXTimes(SCIP *scip, const char letter, int x)
Definition dialog_explore.cpp:311
static SCIP_RETCODE GCGdialogSortAsc(GCG *gcg, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, bool &asc)
Definition dialog_explore.cpp:761
static bool isHeader(std::string &header, std::vector< AbstractColumn * > &columns)
Definition dialog_explore.cpp:802
static SCIP_RETCODE GCGdialogShowLegend(GCG *gcg, std::vector< AbstractColumn * > &columns)
Definition dialog_explore.cpp:486
static SCIP_RETCODE GCGdialogExecCommand(GCG *gcg, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, std::vector< AbstractColumn * > &columns, char *command, int &startindex, int &menulength, bool &finished, std::vector< PARTIALDECOMP * > &partialdeclist, bool &sortasc, std::string &sortby, bool &listopenpartialdecs)
Definition dialog_explore.cpp:899
static SCIP_RETCODE GCGdialogShowMenu(GCG *gcg, std::vector< AbstractColumn * > &columns, unsigned int &npartialdecs, const int startindex, int menulength, std::vector< PARTIALDECOMP * > &partialdeclist, bool sortasc, std::string sortby, bool listopenpartialdecs)
show current menu containing partialdec information
Definition dialog_explore.cpp:330
static SCIP_RETCODE GCGdialogSelectVisualize(GCG *gcg, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, std::vector< PARTIALDECOMP * > &partialdeclist, SCIP_Bool open)
Definition dialog_explore.cpp:598
static void sortPartialdecList(std::vector< PARTIALDECOMP * > &partialdeclist, std::string &header, std::vector< AbstractColumn * > &columns, bool asc)
local sorting function for partialdec id vectors
Definition dialog_explore.cpp:177
static SCIP_RETCODE GCGdialogShowHelp(GCG *gcg)
Shows help section of explore menu.
Definition dialog_explore.cpp:556
static SCIP_RETCODE GCGdialogSelect(GCG *gcg, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, std::vector< PARTIALDECOMP * > &partialdeclist)
Definition dialog_explore.cpp:714
static SCIP_RETCODE GCGdialogSetNEntires(GCG *gcg, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, int listlength, int &menulength)
Definition dialog_explore.cpp:207
internal methods for scores
struct SCIP_Dialog SCIP_DIALOG
struct SCIP_Dialoghdlr SCIP_DIALOGHDLR
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP