Scippy

SCIP

Solving Constraint Integer Programs

relax.c
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2018 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file relax.c
17  * @brief methods and datastructures for relaxation handlers
18  * @author Tobias Achterberg
19  * @author Timo Berthold
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #include <assert.h>
25 #include <string.h>
26 
27 #include "scip/def.h"
28 #include "scip/set.h"
29 #include "scip/stat.h"
30 #include "scip/clock.h"
31 #include "scip/paramset.h"
32 #include "scip/scip.h"
33 #include "scip/sol.h"
34 #include "scip/var.h"
35 #include "scip/relax.h"
36 #include "scip/pub_message.h"
37 #include "scip/pub_misc.h"
38 
39 #include "scip/struct_relax.h"
40 
41 
42 
43 /** compares two relaxation handlers w. r. to their priority */
44 SCIP_DECL_SORTPTRCOMP(SCIPrelaxComp)
45 { /*lint --e{715}*/
46  return ((SCIP_RELAX*)elem2)->priority - ((SCIP_RELAX*)elem1)->priority;
47 }
48 
49 /** comparison method for sorting relaxators w.r.t. to their name */
50 SCIP_DECL_SORTPTRCOMP(SCIPrelaxCompName)
51 {
52  return strcmp(SCIPrelaxGetName((SCIP_RELAX*)elem1), SCIPrelaxGetName((SCIP_RELAX*)elem2));
53 }
54 
55 /** method to call, when the priority of a relaxation handler was changed */
56 static
57 SCIP_DECL_PARAMCHGD(paramChgdRelaxPriority)
58 { /*lint --e{715}*/
59  SCIP_PARAMDATA* paramdata;
60 
61  paramdata = SCIPparamGetData(param);
62  assert(paramdata != NULL);
63 
64  /* use SCIPsetRelaxPriority() to mark the relaxs unsorted */
65  SCIP_CALL( SCIPsetRelaxPriority(scip, (SCIP_RELAX*)paramdata, SCIPparamGetInt(param)) ); /*lint !e740*/
66 
67  return SCIP_OKAY;
68 }
69 
70 /** copies the given relaxation handler to a new scip */
72  SCIP_RELAX* relax, /**< relaxation handler */
73  SCIP_SET* set /**< SCIP_SET of SCIP to copy to */
74  )
75 {
76  assert(relax != NULL);
77  assert(set != NULL);
78  assert(set->scip != NULL);
79 
80  if( relax->relaxcopy != NULL )
81  {
82  SCIPsetDebugMsg(set, "including relaxation handler %s in subscip %p\n", SCIPrelaxGetName(relax), (void*)set->scip);
83  SCIP_CALL( relax->relaxcopy(set->scip, relax) );
84  }
85  return SCIP_OKAY;
86 }
87 
88 /** creates a relaxation handler */
90  SCIP_RELAX** relax, /**< pointer to relaxation handler data structure */
91  SCIP_SET* set, /**< global SCIP settings */
92  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
93  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
94  const char* name, /**< name of relaxation handler */
95  const char* desc, /**< description of relaxation handler */
96  int priority, /**< priority of the relaxation handler (negative: after LP, non-negative: before LP) */
97  int freq, /**< frequency for calling relaxation handler */
98  SCIP_DECL_RELAXCOPY ((*relaxcopy)), /**< copy method of relaxation handler or NULL if you don't want to copy your plugin into sub-SCIPs */
99  SCIP_DECL_RELAXFREE ((*relaxfree)), /**< destructor of relaxation handler */
100  SCIP_DECL_RELAXINIT ((*relaxinit)), /**< initialize relaxation handler */
101  SCIP_DECL_RELAXEXIT ((*relaxexit)), /**< deinitialize relaxation handler */
102  SCIP_DECL_RELAXINITSOL((*relaxinitsol)), /**< solving process initialization method of relaxation handler */
103  SCIP_DECL_RELAXEXITSOL((*relaxexitsol)), /**< solving process deinitialization method of relaxation handler */
104  SCIP_DECL_RELAXEXEC ((*relaxexec)), /**< execution method of relaxation handler */
105  SCIP_RELAXDATA* relaxdata /**< relaxation handler data */
106  )
107 {
108  char paramname[SCIP_MAXSTRLEN];
109  char paramdesc[SCIP_MAXSTRLEN];
110 
111  assert(relax != NULL);
112  assert(name != NULL);
113  assert(desc != NULL);
114  assert(freq >= -1);
115  assert(relaxexec != NULL);
116 
117  SCIP_ALLOC( BMSallocMemory(relax) );
118  SCIP_ALLOC( BMSduplicateMemoryArray(&(*relax)->name, name, strlen(name)+1) );
119  SCIP_ALLOC( BMSduplicateMemoryArray(&(*relax)->desc, desc, strlen(desc)+1) );
120  (*relax)->priority = priority;
121  (*relax)->freq = freq;
122  (*relax)->relaxcopy = relaxcopy;
123  (*relax)->relaxfree = relaxfree;
124  (*relax)->relaxinit = relaxinit;
125  (*relax)->relaxexit = relaxexit;
126  (*relax)->relaxinitsol = relaxinitsol;
127  (*relax)->relaxexitsol = relaxexitsol;
128  (*relax)->relaxexec = relaxexec;
129  (*relax)->relaxdata = relaxdata;
130  SCIP_CALL( SCIPclockCreate(&(*relax)->setuptime, SCIP_CLOCKTYPE_DEFAULT) );
131  SCIP_CALL( SCIPclockCreate(&(*relax)->relaxclock, SCIP_CLOCKTYPE_DEFAULT) );
132  (*relax)->ncalls = 0;
133  (*relax)->lastsolvednode = -1;
134  (*relax)->initialized = FALSE;
135 
136  /* add parameters */
137  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "relaxing/%s/priority", name);
138  (void) SCIPsnprintf(paramdesc, SCIP_MAXSTRLEN, "priority of relaxation handler <%s>", name);
139  SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname, paramdesc,
140  &(*relax)->priority, FALSE, priority, INT_MIN/4, INT_MAX/4,
141  paramChgdRelaxPriority, (SCIP_PARAMDATA*)(*relax)) ); /*lint !e740*/
142  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "relaxing/%s/freq", name);
143  (void) SCIPsnprintf(paramdesc, SCIP_MAXSTRLEN, "frequency for calling relaxation handler <%s> (-1: never, 0: only in root node)", name);
144  SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname, paramdesc,
145  &(*relax)->freq, FALSE, freq, -1, SCIP_MAXTREEDEPTH, NULL, NULL) );
146 
147  return SCIP_OKAY;
148 }
149 
150 /** calls destructor and frees memory of relaxation handler */
152  SCIP_RELAX** relax, /**< pointer to relaxation handler data structure */
153  SCIP_SET* set /**< global SCIP settings */
154  )
155 {
156  assert(relax != NULL);
157  assert(*relax != NULL);
158  assert(!(*relax)->initialized);
159  assert(set != NULL);
160 
161  /* call destructor of relaxation handler */
162  if( (*relax)->relaxfree != NULL )
163  {
164  SCIP_CALL( (*relax)->relaxfree(set->scip, *relax) );
165  }
166 
167  SCIPclockFree(&(*relax)->relaxclock);
168  SCIPclockFree(&(*relax)->setuptime);
169  BMSfreeMemoryArray(&(*relax)->name);
170  BMSfreeMemoryArray(&(*relax)->desc);
171  BMSfreeMemory(relax);
172 
173  return SCIP_OKAY;
174 }
175 
176 /** initializes relaxation handler */
178  SCIP_RELAX* relax, /**< relaxation handler */
179  SCIP_SET* set /**< global SCIP settings */
180  )
181 {
182  assert(relax != NULL);
183  assert(set != NULL);
184 
185  if( relax->initialized )
186  {
187  SCIPerrorMessage("relaxation handler <%s> already initialized\n", relax->name);
188  return SCIP_INVALIDCALL;
189  }
190 
191  if( set->misc_resetstat )
192  {
193  SCIPclockReset(relax->setuptime);
194  SCIPclockReset(relax->relaxclock);
195  relax->ncalls = 0;
196  relax->lastsolvednode = -1;
197  }
198 
199  if( relax->relaxinit != NULL )
200  {
201  /* start timing */
202  SCIPclockStart(relax->setuptime, set);
203 
204  SCIP_CALL( relax->relaxinit(set->scip, relax) );
205 
206  /* stop timing */
207  SCIPclockStop(relax->setuptime, set);
208  }
209  relax->initialized = TRUE;
210 
211  return SCIP_OKAY;
212 }
213 
214 /** calls exit method of relaxation handler */
216  SCIP_RELAX* relax, /**< relaxation handler */
217  SCIP_SET* set /**< global SCIP settings */
218  )
219 {
220  assert(relax != NULL);
221  assert(set != NULL);
222 
223  if( !relax->initialized )
224  {
225  SCIPerrorMessage("relaxation handler <%s> not initialized\n", relax->name);
226  return SCIP_INVALIDCALL;
227  }
228 
229  if( relax->relaxexit != NULL )
230  {
231  /* start timing */
232  SCIPclockStart(relax->setuptime, set);
233 
234  SCIP_CALL( relax->relaxexit(set->scip, relax) );
235 
236  /* stop timing */
237  SCIPclockStop(relax->setuptime, set);
238  }
239  relax->initialized = FALSE;
240 
241  return SCIP_OKAY;
242 }
243 
244 /** informs relaxation handler that the branch and bound process is being started */
246  SCIP_RELAX* relax, /**< relaxation handler */
247  SCIP_SET* set /**< global SCIP settings */
248  )
249 {
250  assert(relax != NULL);
251  assert(set != NULL);
252 
253  /* call solving process initialization method of relaxation handler */
254  if( relax->relaxinitsol != NULL )
255  {
256  /* start timing */
257  SCIPclockStart(relax->setuptime, set);
258 
259  SCIP_CALL( relax->relaxinitsol(set->scip, relax) );
260 
261  /* stop timing */
262  SCIPclockStop(relax->setuptime, set);
263  }
264 
265  return SCIP_OKAY;
266 }
267 
268 /** informs relaxation handler that the branch and bound process data is being freed */
270  SCIP_RELAX* relax, /**< relaxation handler */
271  SCIP_SET* set /**< global SCIP settings */
272  )
273 {
274  assert(relax != NULL);
275  assert(set != NULL);
276 
277  /* call solving process deinitialization method of relaxation handler */
278  if( relax->relaxexitsol != NULL )
279  {
280  /* start timing */
281  SCIPclockStart(relax->setuptime, set);
282 
283  SCIP_CALL( relax->relaxexitsol(set->scip, relax) );
284 
285  /* stop timing */
286  SCIPclockStop(relax->setuptime, set);
287  }
288 
289  return SCIP_OKAY;
290 }
291 
292 /** calls execution method of relaxation handler */
294  SCIP_RELAX* relax, /**< relaxation handler */
295  SCIP_SET* set, /**< global SCIP settings */
296  SCIP_STAT* stat, /**< dynamic problem statistics */
297  int depth, /**< depth of current node */
298  SCIP_Real* lowerbound, /**< pointer to lower bound computed by the relaxation handler */
299  SCIP_RESULT* result /**< pointer to store the result of the callback method */
300  )
301 {
302  assert(relax != NULL);
303  assert(relax->relaxexec != NULL);
304  assert(relax->freq >= -1);
305  assert(set != NULL);
306  assert(set->scip != NULL);
307  assert(depth >= 0);
308  assert(result != NULL);
309 
310  *result = SCIP_DIDNOTRUN;
311 
312  /* check, if the relaxation is already solved */
313  if( relax->lastsolvednode == stat->ntotalnodes && ! SCIPinProbing(set->scip) )
314  return SCIP_OKAY;
315 
316  relax->lastsolvednode = stat->ntotalnodes;
317 
318  if( (depth == 0 && relax->freq == 0) || (relax->freq > 0 && depth % relax->freq == 0) )
319  {
320  SCIPsetDebugMsg(set, "executing relaxation handler <%s>\n", relax->name);
321 
322  /* start timing */
323  SCIPclockStart(relax->relaxclock, set);
324 
325  /* call external relaxation method */
326  SCIP_CALL( relax->relaxexec(set->scip, relax, lowerbound, result) );
327 
328  /* stop timing */
329  SCIPclockStop(relax->relaxclock, set);
330 
331  /* evaluate result */
332  if( *result != SCIP_CUTOFF
333  && *result != SCIP_CONSADDED
334  && *result != SCIP_REDUCEDDOM
335  && *result != SCIP_SEPARATED
336  && *result != SCIP_SUCCESS
337  && *result != SCIP_SUSPENDED
338  && *result != SCIP_DIDNOTRUN )
339  {
340  SCIPerrorMessage("execution method of relaxation handler <%s> returned invalid result <%d>\n",
341  relax->name, *result);
342  return SCIP_INVALIDRESULT;
343  }
344  if( *result != SCIP_DIDNOTRUN )
345  {
346  relax->ncalls++;
347  stat->relaxcount++;
348  if( *result == SCIP_SUSPENDED )
349  SCIPrelaxMarkUnsolved(relax);
350  }
351  }
352 
353  return SCIP_OKAY;
354 }
355 
356 /** gets user data of relaxation handler */
358  SCIP_RELAX* relax /**< relaxation handler */
359  )
360 {
361  assert(relax != NULL);
362 
363  return relax->relaxdata;
364 }
365 
366 /** sets user data of relaxation handler; user has to free old data in advance! */
368  SCIP_RELAX* relax, /**< relaxation handler */
369  SCIP_RELAXDATA* relaxdata /**< new relaxation handler user data */
370  )
371 {
372  assert(relax != NULL);
373 
374  relax->relaxdata = relaxdata;
375 }
376 
377 /** set copy method of relaxation handler */
379  SCIP_RELAX* relax, /**< relaxation handler */
380  SCIP_DECL_RELAXCOPY ((*relaxcopy)) /**< copy method of relaxation handler */
381  )
382 {
383  assert(relax != NULL);
384 
385  relax->relaxcopy = relaxcopy;
386 }
387 
388 /** set destructor of relaxation handler */
390  SCIP_RELAX* relax, /**< relaxation handler */
391  SCIP_DECL_RELAXFREE ((*relaxfree)) /**< destructor of relaxation handler */
392  )
393 {
394  assert(relax != NULL);
395 
396  relax->relaxfree = relaxfree;
397 }
398 
399 /** set initialization method of relaxation handler */
401  SCIP_RELAX* relax, /**< relaxation handler */
402  SCIP_DECL_RELAXINIT ((*relaxinit)) /**< initialize relaxation handler */
403  )
404 {
405  assert(relax != NULL);
406 
407  relax->relaxinit = relaxinit;
408 }
409 
410 /** set deinitialization method of relaxation handler */
412  SCIP_RELAX* relax, /**< relaxation handler */
413  SCIP_DECL_RELAXEXIT ((*relaxexit)) /**< deinitialize relaxation handler */
414  )
415 {
416  assert(relax != NULL);
417 
418  relax->relaxexit = relaxexit;
419 }
420 
421 /** set solving process initialization method of relaxation handler */
423  SCIP_RELAX* relax, /**< relaxation handler */
424  SCIP_DECL_RELAXINITSOL((*relaxinitsol)) /**< solving process initialization method of relaxation handler */
425  )
426 {
427  assert(relax != NULL);
428 
429  relax->relaxinitsol = relaxinitsol;
430 }
431 
432 /** set solving process deinitialization method of relaxation handler */
434  SCIP_RELAX* relax, /**< relaxation handler */
435  SCIP_DECL_RELAXEXITSOL((*relaxexitsol)) /**< solving process deinitialization relaxation handler */
436  )
437 {
438  assert(relax != NULL);
439 
440  relax->relaxexitsol = relaxexitsol;
441 }
442 
443 /** gets name of relaxation handler */
444 const char* SCIPrelaxGetName(
445  SCIP_RELAX* relax /**< relaxation handler */
446  )
447 {
448  assert(relax != NULL);
449 
450  return relax->name;
451 }
452 
453 /** gets description of relaxation handler */
454 const char* SCIPrelaxGetDesc(
455  SCIP_RELAX* relax /**< relaxation handler */
456  )
457 {
458  assert(relax != NULL);
459 
460  return relax->desc;
461 }
462 
463 /** gets priority of relaxation handler */
465  SCIP_RELAX* relax /**< relaxation handler */
466  )
467 {
468  assert(relax != NULL);
469 
470  return relax->priority;
471 }
472 
473 /** sets priority of relaxation handler */
475  SCIP_RELAX* relax, /**< relaxation handler */
476  SCIP_SET* set, /**< global SCIP settings */
477  int priority /**< new priority of the relaxation handler */
478  )
479 {
480  assert(relax != NULL);
481  assert(set != NULL);
482 
483  relax->priority = priority;
484  set->relaxssorted = FALSE;
485 }
486 
487 /** gets frequency of relaxation handler */
489  SCIP_RELAX* relax /**< relaxation handler */
490  )
491 {
492  assert(relax != NULL);
493 
494  return relax->freq;
495 }
496 
497 /** gets time in seconds used in this relaxator for setting up for next stages */
499  SCIP_RELAX* relax /**< relaxator */
500  )
501 {
502  assert(relax != NULL);
503 
504  return SCIPclockGetTime(relax->setuptime);
505 }
506 
507 /** enables or disables all clocks of \p relax, depending on the value of the flag */
509  SCIP_RELAX* relax, /**< the relaxation handler for which all clocks should be enabled or disabled */
510  SCIP_Bool enable /**< should the clocks of the relaxation handler be enabled? */
511  )
512 {
513  assert(relax != NULL);
514 
515  SCIPclockEnableOrDisable(relax->setuptime, enable);
516  SCIPclockEnableOrDisable(relax->relaxclock, enable);
517 }
518 
519 /** gets time in seconds used in this relaxation handler */
521  SCIP_RELAX* relax /**< relaxation handler */
522  )
523 {
524  assert(relax != NULL);
525 
526  return SCIPclockGetTime(relax->relaxclock);
527 }
528 
529 /** gets the total number of times, the relaxation handler was called */
531  SCIP_RELAX* relax /**< relaxation handler */
532  )
533 {
534  assert(relax != NULL);
535 
536  return relax->ncalls;
537 }
538 
539 /** is relaxation handler initialized? */
541  SCIP_RELAX* relax /**< relaxation handler */
542  )
543 {
544  assert(relax != NULL);
545 
546  return relax->initialized;
547 }
548 
549 /** returns whether the relaxation was completely solved at the current node */
551  SCIP_RELAX* relax, /**< relaxation handler */
552  SCIP_STAT* stat /**< dynamic problem statistics */
553  )
554 {
555  assert(relax != NULL);
556  assert(stat != NULL);
557 
558  return (relax->lastsolvednode == stat->ntotalnodes);
559 }
560 
561 /** marks the current relaxation unsolved, s.t. the relaxation handler is called again in the next solving round */
563  SCIP_RELAX* relax /**< relaxation handler */
564  )
565 {
566  assert(relax != NULL);
567 
568  relax->lastsolvednode = -1;
569 }
570 
571 /*
572  * methods for the global relaxation data
573  */
574 
575 /** creates global relaxation data */
577  SCIP_RELAXATION** relaxation, /**< global relaxation data */
578  BMS_BLKMEM* blkmem, /**< block memory */
579  SCIP_SET* set, /**< global SCIP settings */
580  SCIP_STAT* stat, /**< problem statistics data */
581  SCIP_PRIMAL* primal, /**< primal data */
582  SCIP_TREE* tree /**< branch and bound tree */
583  )
584 {
585  assert(relaxation != NULL);
586  assert(blkmem != NULL);
587  assert(set != NULL);
588  assert(stat != NULL);
589  assert(primal != NULL);
590  assert(tree != NULL);
591 
592  SCIP_ALLOC( BMSallocMemory(relaxation) );
593 
594  (*relaxation)->relaxsolobjval = 0.0;
595  (*relaxation)->relaxsolvalid = FALSE;
596  (*relaxation)->relaxsolincludeslp = FALSE;
597  (*relaxation)->relaxsolzero = TRUE;
598 
599  return SCIP_OKAY;
600 }
601 
602 /** frees global relaxation data */
604  SCIP_RELAXATION** relaxation /**< global relaxation data */
605  )
606 {
607  assert(relaxation != NULL);
608 
609  BMSfreeMemory(relaxation);
610 
611  return SCIP_OKAY;
612 }
613 
614 /** sets the relaxsolzero flag in the relaxation data to the given value */
616  SCIP_RELAXATION* relaxation, /**< global relaxation data */
617  SCIP_Bool iszero /**< are all values of the relaxation solution set to zero? */
618  )
619 {
620  assert(relaxation != NULL);
621 
622  relaxation->relaxsolzero = iszero;
623 }
624 
625 /** returns whether the global relaxation solution is cleared and all values are set to zero */
627  SCIP_RELAXATION* relaxation /**< global relaxation data */
628  )
629 {
630  assert(relaxation != NULL);
631 
632  return relaxation->relaxsolzero;
633 }
634 
635 /** sets the relaxsolvalid and includeslp flags in the relaxation data to the given values */
637  SCIP_RELAXATION* relaxation, /**< global relaxation data */
638  SCIP_Bool isvalid, /**< is the stored solution valid? */
639  SCIP_Bool includeslp /**< does the relaxator contain all cuts in the LP? */
640  )
641 {
642  assert(relaxation != NULL);
643 
644  relaxation->relaxsolvalid = isvalid;
645  relaxation->relaxsolincludeslp = includeslp;
646 }
647 
648 /** returns whether the global relaxation solution is valid */
650  SCIP_RELAXATION* relaxation /**< global relaxation data */
651  )
652 {
653  assert(relaxation != NULL);
654 
655  return relaxation->relaxsolvalid;
656 }
657 
658 /** returns whether the global relaxation solution was computed by a relaxator which included all LP cuts */
660  SCIP_RELAXATION* relaxation /**< global relaxation data */
661  )
662 {
663  assert(relaxation != NULL);
664 
665  return relaxation->relaxsolincludeslp;
666 }
667 
668 /** sets the objective value of the global relaxation solution */
670  SCIP_RELAXATION* relaxation, /**< global relaxation data */
671  SCIP_Real obj /**< objective value */
672  )
673 {
674  assert(relaxation != NULL);
675 
676  relaxation->relaxsolobjval = obj;
677 }
678 
679 /** returns the objective value of the global relaxation solution w.r.t. the transformed problem */
681  SCIP_RELAXATION* relaxation /**< global relaxation data */
682  )
683 {
684  assert(relaxation != NULL);
685 
686  return relaxation->relaxsolobjval;
687 }
688 
689 /** adds the given value to the global relaxation solution's objective value */
691  SCIP_RELAXATION* relaxation, /**< global relaxation data */
692  SCIP_Real val /**< value to add to the objective value */
693  )
694 {
695  assert(relaxation != NULL);
696 
697  relaxation->relaxsolobjval += val;
698 }
699 
700 /** updates objective value of current relaxation solution after change of objective coefficient */
702  SCIP_RELAXATION* relaxation, /**< global relaxation data */
703  SCIP_SET* set, /**< global SCIP settings */
704  SCIP_VAR* var, /**< variable with changed objective coefficient */
705  SCIP_Real oldobj, /**< old objective coefficient */
706  SCIP_Real newobj /**< new objective coefficient */
707  )
708 {
709  SCIP_Real relaxsolval;
710 
711  assert(relaxation != NULL);
712  assert(set != NULL);
713  assert(var != NULL);
714  assert(SCIPvarGetStatus(var) == SCIP_VARSTATUS_COLUMN);
715 
716  relaxsolval = SCIPvarGetRelaxSol(var, set);
717  relaxation->relaxsolobjval += (newobj - oldobj) * relaxsolval;
718 }
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
#define SCIP_DECL_RELAXFREE(x)
Definition: type_relax.h:55
void SCIPrelaxationUpdateVarObj(SCIP_RELAXATION *relaxation, SCIP_SET *set, SCIP_VAR *var, SCIP_Real oldobj, SCIP_Real newobj)
Definition: relax.c:701
internal methods for storing primal CIP solutions
SCIP_Real SCIPrelaxationGetSolObj(SCIP_RELAXATION *relaxation)
Definition: relax.c:680
char * desc
Definition: struct_relax.h:42
SCIP_DECL_SORTPTRCOMP(SCIPrelaxComp)
Definition: relax.c:44
SCIP_Longint relaxcount
Definition: struct_stat.h:172
SCIP_RETCODE SCIPrelaxInit(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:177
SCIP_PARAMDATA * SCIPparamGetData(SCIP_PARAM *param)
Definition: paramset.c:661
#define SCIP_MAXSTRLEN
Definition: def.h:259
internal methods for clocks and timing issues
SCIP_Longint ntotalnodes
Definition: struct_stat.h:76
struct SCIP_ParamData SCIP_PARAMDATA
Definition: type_paramset.h:76
void SCIPrelaxSetPriority(SCIP_RELAX *relax, SCIP_SET *set, int priority)
Definition: relax.c:474
void SCIPclockStop(SCIP_CLOCK *clck, SCIP_SET *set)
Definition: clock.c:350
#define FALSE
Definition: def.h:64
#define SCIP_DECL_RELAXINIT(x)
Definition: type_relax.h:63
#define SCIP_DECL_RELAXINITSOL(x)
Definition: type_relax.h:82
void SCIPclockStart(SCIP_CLOCK *clck, SCIP_SET *set)
Definition: clock.c:280
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10011
#define TRUE
Definition: def.h:63
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
void SCIPrelaxSetCopy(SCIP_RELAX *relax, SCIP_DECL_RELAXCOPY((*relaxcopy)))
Definition: relax.c:378
SCIP_RETCODE SCIPrelaxFree(SCIP_RELAX **relax, SCIP_SET *set)
Definition: relax.c:151
void SCIPrelaxationSetSolValid(SCIP_RELAXATION *relaxation, SCIP_Bool isvalid, SCIP_Bool includeslp)
Definition: relax.c:636
internal methods for handling parameter settings
SCIP_Bool SCIPrelaxationIsSolValid(SCIP_RELAXATION *relaxation)
Definition: relax.c:649
void SCIPclockEnableOrDisable(SCIP_CLOCK *clck, SCIP_Bool enable)
Definition: clock.c:250
#define BMSfreeMemory(ptr)
Definition: memory.h:127
SCIP_Longint SCIPrelaxGetNCalls(SCIP_RELAX *relax)
Definition: relax.c:530
SCIP_Real SCIPrelaxGetTime(SCIP_RELAX *relax)
Definition: relax.c:520
#define SCIP_DECL_RELAXEXIT(x)
Definition: type_relax.h:71
SCIP_RELAXDATA * relaxdata
Definition: struct_relax.h:50
void SCIPrelaxSetFree(SCIP_RELAX *relax, SCIP_DECL_RELAXFREE((*relaxfree)))
Definition: relax.c:389
SCIP_CLOCK * relaxclock
Definition: struct_relax.h:52
SCIP_RETCODE SCIPrelaxCreate(SCIP_RELAX **relax, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int priority, int freq, SCIP_DECL_RELAXCOPY((*relaxcopy)), SCIP_DECL_RELAXFREE((*relaxfree)), SCIP_DECL_RELAXINIT((*relaxinit)), SCIP_DECL_RELAXEXIT((*relaxexit)), SCIP_DECL_RELAXINITSOL((*relaxinitsol)), SCIP_DECL_RELAXEXITSOL((*relaxexitsol)), SCIP_DECL_RELAXEXEC((*relaxexec)), SCIP_RELAXDATA *relaxdata)
Definition: relax.c:89
#define BMSfreeMemoryArray(ptr)
Definition: memory.h:129
#define SCIPerrorMessage
Definition: pub_message.h:45
SCIP_RETCODE SCIPrelaxExit(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:215
SCIP_Bool relaxsolincludeslp
Definition: struct_relax.h:63
SCIP_Bool SCIPrelaxationIsSolZero(SCIP_RELAXATION *relaxation)
Definition: relax.c:626
void SCIPclockReset(SCIP_CLOCK *clck)
Definition: clock.c:199
SCIP_Real relaxsolobjval
Definition: struct_relax.h:61
int SCIPrelaxGetPriority(SCIP_RELAX *relax)
Definition: relax.c:464
SCIP_Real SCIPclockGetTime(SCIP_CLOCK *clck)
Definition: clock.c:428
#define SCIP_DECL_RELAXCOPY(x)
Definition: type_relax.h:47
void SCIPrelaxSetInitsol(SCIP_RELAX *relax, SCIP_DECL_RELAXINITSOL((*relaxinitsol)))
Definition: relax.c:422
void SCIPrelaxSetExitsol(SCIP_RELAX *relax, SCIP_DECL_RELAXEXITSOL((*relaxexitsol)))
Definition: relax.c:433
const char * SCIPrelaxGetName(SCIP_RELAX *relax)
Definition: relax.c:444
SCIP_RELAXDATA * SCIPrelaxGetData(SCIP_RELAX *relax)
Definition: relax.c:357
SCIP_Bool relaxsolvalid
Definition: struct_relax.h:62
internal methods for global SCIP settings
#define SCIP_CALL(x)
Definition: def.h:350
SCIP_RETCODE SCIPrelaxCopyInclude(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:71
SCIP_CLOCK * setuptime
Definition: struct_relax.h:51
void SCIPrelaxMarkUnsolved(SCIP_RELAX *relax)
Definition: relax.c:562
SCIP_RETCODE SCIPrelaxationCreate(SCIP_RELAXATION **relaxation, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree)
Definition: relax.c:576
internal methods for relaxators
SCIP_RETCODE SCIPsetAddIntParam(SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: set.c:2813
int SCIPrelaxGetFreq(SCIP_RELAX *relax)
Definition: relax.c:488
SCIP_RETCODE SCIPsetRelaxPriority(SCIP *scip, SCIP_RELAX *relax, int priority)
Definition: scip.c:7316
SCIP_Real SCIPrelaxGetSetupTime(SCIP_RELAX *relax)
Definition: relax.c:498
#define BMSduplicateMemoryArray(ptr, source, num)
Definition: memory.h:125
SCIP_RETCODE SCIPclockCreate(SCIP_CLOCK **clck, SCIP_CLOCKTYPE clocktype)
Definition: clock.c:160
internal methods for problem variables
char * name
Definition: struct_relax.h:41
public data structures and miscellaneous methods
SCIP_RETCODE SCIPrelaxationFree(SCIP_RELAXATION **relaxation)
Definition: relax.c:603
#define SCIP_Bool
Definition: def.h:61
SCIP_Bool SCIPrelaxIsSolved(SCIP_RELAX *relax, SCIP_STAT *stat)
Definition: relax.c:550
SCIP_RETCODE SCIPrelaxInitsol(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:245
void SCIPclockFree(SCIP_CLOCK **clck)
Definition: clock.c:175
SCIP_Bool initialized
Definition: struct_relax.h:55
const char * SCIPrelaxGetDesc(SCIP_RELAX *relax)
Definition: relax.c:454
#define SCIPsetDebugMsg
Definition: set.h:1913
static SCIP_DECL_PARAMCHGD(paramChgdRelaxPriority)
Definition: relax.c:57
SCIP_Longint lastsolvednode
Definition: struct_relax.h:40
void SCIPrelaxEnableOrDisableClocks(SCIP_RELAX *relax, SCIP_Bool enable)
Definition: relax.c:508
void SCIPrelaxSetData(SCIP_RELAX *relax, SCIP_RELAXDATA *relaxdata)
Definition: relax.c:367
SCIP_Real SCIPvarGetRelaxSol(SCIP_VAR *var, SCIP_SET *set)
Definition: var.c:13329
void SCIPrelaxationSetSolObj(SCIP_RELAXATION *relaxation, SCIP_Real obj)
Definition: relax.c:669
#define SCIP_MAXTREEDEPTH
Definition: def.h:286
SCIP_Bool SCIPinProbing(SCIP *scip)
Definition: scip.c:35836
int SCIPparamGetInt(SCIP_PARAM *param)
Definition: paramset.c:716
SCIP_Longint ncalls
Definition: struct_relax.h:39
void SCIPrelaxationSetSolZero(SCIP_RELAXATION *relaxation, SCIP_Bool iszero)
Definition: relax.c:615
struct SCIP_RelaxData SCIP_RELAXDATA
Definition: type_relax.h:38
#define SCIP_DECL_RELAXEXEC(x)
Definition: type_relax.h:118
void SCIPrelaxationSolObjAdd(SCIP_RELAXATION *relaxation, SCIP_Real val)
Definition: relax.c:690
SCIP_Bool relaxsolzero
Definition: struct_relax.h:64
public methods for message output
SCIP_Bool SCIPrelaxIsInitialized(SCIP_RELAX *relax)
Definition: relax.c:540
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
Definition: var.c:16781
#define SCIP_Real
Definition: def.h:149
internal methods for problem statistics
#define BMSallocMemory(ptr)
Definition: memory.h:101
#define SCIP_Longint
Definition: def.h:134
data structures for relaxators
#define SCIP_DECL_RELAXEXITSOL(x)
Definition: type_relax.h:93
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:419
void SCIPrelaxSetExit(SCIP_RELAX *relax, SCIP_DECL_RELAXEXIT((*relaxexit)))
Definition: relax.c:411
#define SCIP_ALLOC(x)
Definition: def.h:361
SCIP_RETCODE SCIPrelaxExec(SCIP_RELAX *relax, SCIP_SET *set, SCIP_STAT *stat, int depth, SCIP_Real *lowerbound, SCIP_RESULT *result)
Definition: relax.c:293
SCIP_Bool SCIPrelaxationIsLpIncludedForSol(SCIP_RELAXATION *relaxation)
Definition: relax.c:659
SCIP callable library.
void SCIPrelaxSetInit(SCIP_RELAX *relax, SCIP_DECL_RELAXINIT((*relaxinit)))
Definition: relax.c:400
SCIP_RETCODE SCIPrelaxExitsol(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:269