params_visu.c
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program */
4 /* GCG --- Generic Column Generation */
5 /* a Dantzig-Wolfe decomposition based extension */
6 /* of the branch-cut-and-price framework */
7 /* SCIP --- Solving Constraint Integer Programs */
8 /* */
9 /* Copyright (C) 2010-2018 Operations Research, RWTH Aachen University */
10 /* Zuse Institute Berlin (ZIB) */
11 /* */
12 /* This program is free software; you can redistribute it and/or */
13 /* modify it under the terms of the GNU Lesser General Public License */
14 /* as published by the Free Software Foundation; either version 3 */
15 /* of the License, or (at your option) any later version. */
16 /* */
17 /* This program is distributed in the hope that it will be useful, */
18 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
19 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
20 /* GNU Lesser General Public License for more details. */
21 /* */
22 /* You should have received a copy of the GNU Lesser General Public License */
23 /* along with this program; if not, write to the Free Software */
24 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.*/
25 /* */
26 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 #include "params_visu.h"
37 #include "type_decomp.h"
38 #include "cons_decomp.h"
39 
40 #include <limits.h>
41 
42 
43 /* color defaults to build default color layout with */
44 #define COLOR_WHITE "#FFFFFF"
45 #define COLOR_BLUE1 "#ACBCE9"
46 #define COLOR_BLUE2 "#718CDB"
47 #define COLOR_BLUE3 "#3C64DD"
48 #define COLOR_BLUE4 "#1340C7"
49 #define COLOR_BLUE5 "#1F377D"
50 #define COLOR_ORANGE1 "#FFD88F"
51 #define COLOR_ORANGE2 "#FFCB69"
52 #define COLOR_ORANGE3 "#FFB72D"
53 #define COLOR_BROWN1 "#B38208"
54 #define COLOR_BROWN2 "#886100"
55 #define COLOR_BROWN3 "#443000"
56 #define COLOR_BLACK "#000000"
58 /* default colors (use defines above for changes) */
59 #define DEFAULT_COLOR_MASTERVARS COLOR_BLUE4
60 #define DEFAULT_COLOR_MASTERCONSS COLOR_BLUE4
61 #define DEFAULT_COLOR_LINKING COLOR_ORANGE3
62 #define DEFAULT_COLOR_STAIRLINKING COLOR_BROWN2
63 #define DEFAULT_COLOR_BLOCK COLOR_BLUE2
64 #define DEFAULT_COLOR_OPEN COLOR_ORANGE1
65 #define DEFAULT_COLOR_NONZERO COLOR_BLACK
66 #define DEFAULT_COLOR_LINE COLOR_BLACK
68 /* 8 shades of grey */
69 #define GREY_COLOR_MASTERVARS "#323232"
70 #define GREY_COLOR_MASTERCONS "#666666"
71 #define GREY_COLOR_LINKING "#4C4C4C"
72 #define GREY_COLOR_STAIRLINKING "#191919"
73 #define GREY_COLOR_BLOCK "#d3d3d3"
74 #define GREY_COLOR_OPEN "#7F7F7F"
75 #define GREY_COLOR_NONZERO COLOR_BLACK
76 #define GREY_COLOR_LINE COLOR_BLACK
78 /* visualization imaging defaults */
79 #define DEFAULT_VISU_DRAFTMODE FALSE
80 #define DEFAULT_VISU_COLORSCHEME COLORSCHEME_DEFAULT
81 #define DEFAULT_VISU_RADIUS 2
82 #define DEFAULT_VISU_USEGP FALSE
85 /* pdf reader default */
86 #define DEFAULT_PDFREADER "evince"
88 /* report parameter defaults */
89 #define DEFAULT_REPORT_MAXNDECOMPS 20
90 #define DEFAULT_REPORT_SHOWTYPE 0
92 #define DEFAULT_REPORT_SHOWTITLEPAGE TRUE
93 #define DEFAULT_REPORT_SHOWTOC TRUE
94 #define DEFAULT_REPORT_SHOWSTATISTICS TRUE
96 /* familytree parameter defaults */
97 #define DEFAULT_FAMTREE_MAXNDECOMPS 5
100 struct GCG_VisualizationData
101 {
102  SCIP_Bool visudraftmode;
103  VISU_COLORSCHEME visucolorscheme;
104  int visuradius;
105  SCIP_Bool visuusegp;
107  char* mancolormastervars;
108  char* mancolormasterconss;
109  char* mancolorlinking;
110  char* mancolorstairlinking;
111  char* mancolorblock;
112  char* mancoloropen;
113  char* mancolornonzero;
114  char* mancolorline;
116  char* greycolormastervars;
117  char* greycolormasterconss;
118  char* greycolorlinking;
119  char* greycolorstairlinking;
120  char* greycolorblock;
121  char* greycoloropen;
122  char* greycolornonzero;
123  char* greycolorline;
125  char* pdfreader;
127  int rep_maxndecomps;
128  DEC_DECTYPE rep_showtype;
129  SCIP_Bool rep_showtitle;
130  SCIP_Bool rep_showtoc;
131  SCIP_Bool rep_statistics;
133  int fam_maxndecomps;
134  int nmaxdecompstowrite;
135 };
139 
142 SCIP_RETCODE SCIPincludeParamsVisu(
143  SCIP* scip
144  )
145 {
146  visudata = NULL;
147  SCIP_CALL( SCIPallocMemory(scip, &visudata) );
148 
149  /* init string params with NULL pointer */
150  visudata->pdfreader = NULL;
151  visudata->mancolormastervars = NULL;
152  visudata->mancolormasterconss = NULL;
153  visudata->mancolorlinking = NULL;
154  visudata->mancolorstairlinking = NULL;
155  visudata->mancolorblock = NULL;
156  visudata->mancoloropen = NULL;
157  visudata->mancolornonzero = NULL;
158  visudata->mancolorline = NULL;
159 
160  /* add general parameters */
161 
162  SCIP_CALL( SCIPaddBoolParam(scip,
163  "visual/draftmode", "if true no nonzeros are shown (may improve performance)",
164  &visudata->visudraftmode, FALSE, DEFAULT_VISU_DRAFTMODE, NULL, NULL) );
165 
166  SCIP_CALL( SCIPaddIntParam(scip,
167  "visual/colorscheme", "type number: 0=default, 1=black and white, 2=manual",
168  (int*) &visudata->visucolorscheme, FALSE, DEFAULT_VISU_COLORSCHEME, 0, 2, NULL, NULL) );
169 
170  SCIP_CALL( SCIPaddIntParam(scip,
171  "visual/nonzeroradius", "integer value to scale points on range 1-10",
172  &visudata->visuradius, FALSE, DEFAULT_VISU_RADIUS, 1, 10, NULL, NULL) );
173 
174  SCIP_CALL( SCIPaddIntParam(scip,
175  "visual/nmaxdecompstowrite", "maximum number of decompositions to write (-1: no limit)",
176  &visudata->nmaxdecompstowrite, FALSE, -1, -1, INT_MAX, NULL, NULL) );
177 
178  SCIP_CALL( SCIPaddStringParam(scip,
179  "visual/pdfreader", "pdf reader that opens visualizations in decomposition explorer",
180  &visudata->pdfreader, FALSE,
182  NULL, NULL) );
183 
184  /* add parameters for manual colors */
185 
186  SCIP_CALL( SCIPaddStringParam(scip,
187  "visual/colors/colormastervars", "color for master variables in hex code",
188  &visudata->mancolormastervars, FALSE, DEFAULT_COLOR_MASTERVARS, NULL, NULL) );
189 
190  SCIP_CALL( SCIPaddStringParam(scip,
191  "visual/colors/colormasterconss", "color for master constraints in hex code",
192  &visudata->mancolormasterconss, FALSE, DEFAULT_COLOR_MASTERCONSS, NULL, NULL) );
193 
194  SCIP_CALL( SCIPaddStringParam(scip,
195  "visual/colors/colorlinking", "color for linking variables in hex code",
196  &visudata->mancolorlinking, FALSE, DEFAULT_COLOR_LINKING, NULL, NULL) );
197 
198  SCIP_CALL( SCIPaddStringParam(scip,
199  "visual/colors/colorstairlinking", "color for stairlinking variables in hex code",
200  &visudata->mancolorstairlinking, FALSE, DEFAULT_COLOR_STAIRLINKING, NULL, NULL) );
201 
202  SCIP_CALL( SCIPaddStringParam(scip,
203  "visual/colors/colorblock", "color for found blocks in hex code",
204  &visudata->mancolorblock, FALSE, DEFAULT_COLOR_BLOCK, NULL, NULL) );
205 
206  SCIP_CALL( SCIPaddStringParam(scip,
207  "visual/colors/coloropen", "color for open areas in hex code",
208  &visudata->mancoloropen, FALSE, DEFAULT_COLOR_OPEN, NULL, NULL) );
209 
210  SCIP_CALL( SCIPaddStringParam(scip,
211  "visual/colors/colornonzeros", "color for nonzeros in hex code",
212  &visudata->mancolornonzero, FALSE, DEFAULT_COLOR_NONZERO, NULL, NULL) );
213 
214  SCIP_CALL( SCIPaddStringParam(scip,
215  "visual/colors/colorlines", "color for lines in hex code",
216  &visudata->mancolorline, FALSE, DEFAULT_COLOR_LINE, NULL, NULL) );
217 
218  /* add parameters for report */
219 
220  SCIP_CALL( SCIPaddIntParam(scip,
221  "visual/report/maxndecomps", "maximum number of decompositions shown in report (best scores first)",
222  &visudata->rep_maxndecomps, FALSE, DEFAULT_REPORT_MAXNDECOMPS, 1, INT_MAX, NULL, NULL) );
223 
224  SCIP_CALL( SCIPaddIntParam(scip,
225  "visual/report/showtype",
226  "only decompositions of type: 0=all types, 1=arrowhead, 2=staircase, 3=diagonal, 4=bordered",
227  (int*) &visudata->rep_showtype, FALSE, DEFAULT_REPORT_SHOWTYPE, 0, 4, NULL, NULL) );
228 
229  SCIP_CALL( SCIPaddBoolParam(scip,
230  "visual/report/showtitle", "if true a title page is included",
231  &visudata->rep_showtitle, FALSE, DEFAULT_REPORT_SHOWTITLEPAGE, NULL, NULL) );
232 
233  SCIP_CALL( SCIPaddBoolParam(scip,
234  "visual/report/showtoc", "if true a table of contents is included",
235  &visudata->rep_showtoc, FALSE, DEFAULT_REPORT_SHOWTOC, NULL, NULL) );
236 
237  SCIP_CALL( SCIPaddBoolParam(scip,
238  "visual/report/showstatistics", "if true statistics are included for each decomp",
239  &visudata->rep_statistics, FALSE, DEFAULT_REPORT_SHOWSTATISTICS, NULL, NULL) );
240 
241  SCIP_CALL( SCIPaddBoolParam(scip,
242  "visual/report/usegp", "if true gnuplot is used for sub-visualizations in report, otherwise LaTeX/Tikz",
243  &visudata->visuusegp, FALSE, DEFAULT_VISU_USEGP, NULL, NULL) );
244 
245  /* add parameters for family tree */
246 
247  SCIP_CALL( SCIPaddIntParam(scip,
248  "visual/famtree/maxndecomps", "maximum number of finished decompositions in family tree",
249  &visudata->fam_maxndecomps, FALSE, DEFAULT_FAMTREE_MAXNDECOMPS, 1, INT_MAX, NULL, NULL) );
250 
251  /* initialize black and white color scheme */
252 
253  visudata->greycolormastervars = (char*) GREY_COLOR_MASTERVARS;
254  visudata->greycolormasterconss = (char*) GREY_COLOR_MASTERCONS;
255  visudata->greycolorlinking = (char*) GREY_COLOR_LINKING;
257  visudata->greycolorblock = (char*) GREY_COLOR_BLOCK;
258  visudata->greycoloropen = (char*) GREY_COLOR_OPEN;
259  visudata->greycolornonzero = (char*) GREY_COLOR_NONZERO;
260  visudata->greycolorline = (char*) GREY_COLOR_LINE;
261 
262  return SCIP_OKAY;
263 }
264 
265 /* getter & setter */
266 
267 
270 SCIP_Bool SCIPvisuGetDraftmode()
271 {
272  return visudata->visudraftmode;
273 }
274 
275 
279  SCIP_Bool setmode
280  )
281 {
282  visudata->visudraftmode = setmode;
283 }
284 
285 
288 {
289  return visudata->visucolorscheme;
290 }
291 
292 
295  VISU_COLORSCHEME newscheme
296  )
297 {
298  visudata->visucolorscheme = newscheme;
299 }
300 
301 
304 {
306  {
307  case COLORSCHEME_GREY:
308  return visudata->greycolormasterconss;
309  break;
310  case COLORSCHEME_MANUAL:
311  return visudata->mancolormasterconss;
312  default:
313  return (char*) DEFAULT_COLOR_MASTERCONSS;
314  }
315 }
316 
317 
320 {
322  {
323  case COLORSCHEME_GREY:
324  return visudata->greycolormastervars;
325  break;
326  case COLORSCHEME_MANUAL:
327  return visudata->mancolormastervars;
328  default:
329  return (char*) DEFAULT_COLOR_MASTERVARS;
330  }
331 }
332 
333 
336 {
338  {
339  case COLORSCHEME_GREY:
340  return visudata->greycolorlinking;
341  break;
342  case COLORSCHEME_MANUAL:
343  return visudata->mancolorlinking;
344  default:
345  return (char*) DEFAULT_COLOR_LINKING;
346  }
347 }
348 
349 
352 {
354  {
355  case COLORSCHEME_GREY:
356  return visudata->greycolorstairlinking;
357  break;
358  case COLORSCHEME_MANUAL:
359  return visudata->mancolorstairlinking;
360  default:
361  return (char*) DEFAULT_COLOR_STAIRLINKING;
362  }
363 }
364 
365 
367 char* SCIPvisuGetColorBlock()
368 {
370  {
371  case COLORSCHEME_GREY:
372  return visudata->greycolorblock;
373  break;
374  case COLORSCHEME_MANUAL:
375  return visudata->mancolorblock;
376  default:
377  return (char*) DEFAULT_COLOR_BLOCK;
378  }
379 }
380 
381 
383 char* SCIPvisuGetColorOpen()
384 {
386  {
387  case COLORSCHEME_GREY:
388  return visudata->greycoloropen;
389  break;
390  case COLORSCHEME_MANUAL:
391  return visudata->mancoloropen;
392  default:
393  return (char*) DEFAULT_COLOR_OPEN;
394  }
395 }
396 
397 
400 {
402  {
403  case COLORSCHEME_GREY:
404  return visudata->greycolornonzero;
405  break;
406  case COLORSCHEME_MANUAL:
407  return visudata->mancolornonzero;
408  default:
409  return (char*) DEFAULT_COLOR_NONZERO;
410  }
411 }
412 
413 
415 char* SCIPvisuGetColorLine()
416 {
418  {
419  case COLORSCHEME_GREY:
420  return visudata->greycolorline;
421  break;
422  case COLORSCHEME_MANUAL:
423  return visudata->mancolorline;
424  default:
425  return (char*) DEFAULT_COLOR_LINE;
426  }
427 }
428 
429 
432  char* newcolor
433  )
434 {
435  visudata->mancolormasterconss = newcolor;
436 }
437 
438 
441  char* newcolor
442  )
443 {
444  visudata->mancolormastervars = newcolor;
445 }
446 
447 
450  char* newcolor
451  )
452 {
453  visudata->mancolorlinking = newcolor;
454 }
455 
456 
459  char* newcolor
460  )
461 {
462  visudata->mancolorstairlinking = newcolor;
463 }
464 
465 
468  char* newcolor
469  )
470 {
471  visudata->mancolorblock = newcolor;
472 }
473 
474 
477  char* newcolor
478  )
479 {
480  visudata->mancoloropen = newcolor;
481 }
482 
483 
486  char* newcolor
487  )
488 {
489  visudata->mancolornonzero = newcolor;
490 }
491 
492 
495  char* newcolor
496  )
497 {
498  visudata->mancolorline = newcolor;
499 }
500 
501 
505  int maxindx,
506  int maxindy,
507  float scalingfactor
508  )
509 {
510  int maxind = 0;
511 
512  /* the max indices must be at least one to be compatible with division */
513  if(maxindx <= 0)
514  maxindx = 1;
515 
516  if(maxindy <= 0)
517  maxindy = 1;
518 
519  /* determine the highest index */
520  if(maxindx > maxindy)
521  maxind = maxindx;
522  else
523  maxind = maxindy;
524 
525  /* scale by coordinate system size and given factor */
526  return ( (float) visudata->visuradius / (float) maxind) * scalingfactor;
527 }
528 
529 
531 SCIP_Bool GCGgetUseGp()
532 {
533  return visudata->visuusegp;
534 }
535 
536 
538 char* GCGVisuGetPdfReader()
539 {
540  return visudata->pdfreader;
541 }
542 
543 
546 {
547  return visudata->rep_maxndecomps;
548 }
549 
550 
553 {
554  return visudata->rep_showtype;
555 }
556 
557 
559 SCIP_Bool GCGreportGetShowTitlepage()
560 {
561  return visudata->rep_showtitle;
562 }
563 
564 
566 SCIP_Bool GCGreportGetShowToc()
567 {
568  return visudata->rep_showtoc;
569 }
570 
571 
573 SCIP_Bool GCGreportGetShowStatistics()
574 {
575  return visudata->rep_statistics;
576 }
577 
578 
581 {
582  return visudata->fam_maxndecomps;
583 }
584 
585 
587 void GCGVisuFreeParams(
588  SCIP* scip
589  )
590 {
591  if ( visudata != NULL )
592  SCIPfreeMemory(scip, &visudata);
593 }
#define DEFAULT_VISU_USEGP
Definition: params_visu.c:82
void SCIPvisuSetColorManStairlinking(char *newcolor)
Definition: params_visu.c:460
#define GREY_COLOR_NONZERO
Definition: params_visu.c:75
void SCIPvisuSetColorManNonzero(char *newcolor)
Definition: params_visu.c:487
char * SCIPvisuGetColorNonzero()
Definition: params_visu.c:401
SCIP_Bool GCGreportGetShowTitlepage()
Definition: params_visu.c:561
char * SCIPvisuGetColorLinking()
Definition: params_visu.c:337
#define DEFAULT_VISU_RADIUS
Definition: params_visu.c:81
void SCIPvisuSetColorManLinking(char *newcolor)
Definition: params_visu.c:451
char * SCIPvisuGetColorLine()
Definition: params_visu.c:417
#define DEFAULT_COLOR_LINE
Definition: params_visu.c:66
#define DEFAULT_FAMTREE_MAXNDECOMPS
Definition: params_visu.c:99
#define GREY_COLOR_MASTERCONS
Definition: params_visu.c:70
enum Colorscheme VISU_COLORSCHEME
Definition: params_visu.h:56
#define DEFAULT_COLOR_MASTERCONSS
Definition: params_visu.c:60
void GCGVisuFreeParams(SCIP *scip)
Definition: params_visu.c:589
DEC_DECTYPE rep_showtype
Definition: params_visu.c:130
VISU_COLORSCHEME visucolorscheme
Definition: params_visu.c:105
void SCIPvisuSetColorManLine(char *newcolor)
Definition: params_visu.c:496
#define DEFAULT_PDFREADER
Definition: params_visu.c:87
#define DEFAULT_COLOR_LINKING
Definition: params_visu.c:61
SCIP_Bool GCGgetUseGp()
Definition: params_visu.c:533
#define DEFAULT_REPORT_SHOWTYPE
Definition: params_visu.c:91
void SCIPvisuSetColorscheme(VISU_COLORSCHEME newscheme)
Definition: params_visu.c:296
#define GREY_COLOR_LINE
Definition: params_visu.c:76
DEC_DECTYPE GCGreportGetDecompTypeToShow()
Definition: params_visu.c:554
SCIP_Bool GCGreportGetShowStatistics()
Definition: params_visu.c:575
type definitions for decomposition information in GCG projects
#define GREY_COLOR_OPEN
Definition: params_visu.c:74
#define DEFAULT_VISU_DRAFTMODE
Definition: params_visu.c:79
void SCIPvisuSetColorManMasterconss(char *newcolor)
Definition: params_visu.c:433
enum Dectype DEC_DECTYPE
Definition: type_decomp.h:55
#define DEFAULT_VISU_COLORSCHEME
Definition: params_visu.c:80
char * SCIPvisuGetColorOpen()
Definition: params_visu.c:385
#define DEFAULT_REPORT_SHOWSTATISTICS
Definition: params_visu.c:96
char * SCIPvisuGetColorStairlinking()
Definition: params_visu.c:353
SCIP_Bool SCIPvisuGetDraftmode()
Definition: params_visu.c:272
SCIP_RETCODE SCIPincludeParamsVisu(SCIP *scip)
Definition: params_visu.c:144
float SCIPvisuGetNonzeroRadius(int maxindx, int maxindy, float scalingfactor)
Definition: params_visu.c:506
#define DEFAULT_REPORT_MAXNDECOMPS
Definition: params_visu.c:90
#define DEFAULT_COLOR_STAIRLINKING
Definition: params_visu.c:62
#define GREY_COLOR_MASTERVARS
Definition: params_visu.c:69
void SCIPvisuSetColorManOpen(char *newcolor)
Definition: params_visu.c:478
char * SCIPvisuGetColorBlock()
Definition: params_visu.c:369
SCIP_Bool rep_statistics
Definition: params_visu.c:133
#define DEFAULT_REPORT_SHOWTITLEPAGE
Definition: params_visu.c:94
#define DEFAULT_COLOR_MASTERVARS
Definition: params_visu.c:59
#define GREY_COLOR_BLOCK
Definition: params_visu.c:73
#define GREY_COLOR_STAIRLINKING
Definition: params_visu.c:72
int GCGfamtreeGetMaxNDecomps()
Definition: params_visu.c:582
char * GCGVisuGetPdfReader()
Definition: params_visu.c:540
void SCIPvisuSetColorManMastervars(char *newcolor)
Definition: params_visu.c:442
VISU_COLORSCHEME SCIPvisuGetColorscheme()
Definition: params_visu.c:289
#define DEFAULT_COLOR_NONZERO
Definition: params_visu.c:65
SCIP_Bool GCGreportGetShowToc()
Definition: params_visu.c:568
#define DEFAULT_REPORT_SHOWTOC
Definition: params_visu.c:95
void SCIPvisuSetDraftmode(SCIP_Bool setmode)
Definition: params_visu.c:280
char * SCIPvisuGetColorMastervars()
Definition: params_visu.c:321
#define GREY_COLOR_LINKING
Definition: params_visu.c:71
void SCIPvisuSetColorManBlock(char *newcolor)
Definition: params_visu.c:469
int GCGreportGetMaxNDecomps()
Definition: params_visu.c:547
constraint handler for structure detection
#define DEFAULT_COLOR_OPEN
Definition: params_visu.c:64
#define DEFAULT_COLOR_BLOCK
Definition: params_visu.c:63
struct GCG_VisualizationData * visudata
Definition: params_visu.c:140
char * SCIPvisuGetColorMasterconss()
Definition: params_visu.c:305