Scippy

SCIP

Solving Constraint Integer Programs

pricer.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-2019 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 visit scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file pricer.c
17  * @brief methods for variable pricers
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/clock.h"
30 #include "scip/paramset.h"
31 #include "scip/lp.h"
32 #include "scip/prob.h"
33 #include "scip/pricestore.h"
34 #include "scip/scip.h"
35 #include "scip/pricer.h"
36 #include "scip/pub_message.h"
37 #include "scip/pub_misc.h"
38 
39 #include "scip/struct_pricer.h"
40 
41 
42 
43 /** compares two pricers w. r. to their activity and their priority */
44 SCIP_DECL_SORTPTRCOMP(SCIPpricerComp)
45 { /*lint --e{715}*/
46  if( ((SCIP_PRICER*)elem1)->active != ((SCIP_PRICER*)elem2)->active )
47  return ((SCIP_PRICER*)elem1)->active ? -1 : +1;
48  else
49  return ((SCIP_PRICER*)elem2)->priority - ((SCIP_PRICER*)elem1)->priority;
50 }
51 
52 /** comparison method for sorting pricers w.r.t. to their name */
53 SCIP_DECL_SORTPTRCOMP(SCIPpricerCompName)
54 {
55  if( ((SCIP_PRICER*)elem1)->active != ((SCIP_PRICER*)elem2)->active )
56  return ((SCIP_PRICER*)elem1)->active ? -1 : +1;
57  else
58  return strcmp(SCIPpricerGetName((SCIP_PRICER*)elem1), SCIPpricerGetName((SCIP_PRICER*)elem2));
59 }
60 
61 /** method to call, when the priority of a pricer was changed */
62 static
63 SCIP_DECL_PARAMCHGD(paramChgdPricerPriority)
64 { /*lint --e{715}*/
65  SCIP_PARAMDATA* paramdata;
66 
67  paramdata = SCIPparamGetData(param);
68  assert(paramdata != NULL);
69 
70  /* use SCIPsetPricerPriority() to mark the pricers unsorted */
71  SCIP_CALL( SCIPsetPricerPriority(scip, (SCIP_PRICER*)paramdata, SCIPparamGetInt(param)) ); /*lint !e740*/
72 
73  return SCIP_OKAY;
74 }
75 
76 /** copies the given pricer to a new scip */
78  SCIP_PRICER* pricer, /**< pricer */
79  SCIP_SET* set, /**< SCIP_SET of SCIP to copy to */
80  SCIP_Bool* valid /**< was the copying process valid? */
81  )
82 {
83  assert(pricer != NULL);
84  assert(set != NULL);
85  assert(valid != NULL);
86  assert(set->scip != NULL);
87 
88  if( pricer->pricercopy != NULL )
89  {
90  SCIPsetDebugMsg(set, "including pricer %s in subscip %p\n", SCIPpricerGetName(pricer), (void*)set->scip);
91  SCIP_CALL( pricer->pricercopy(set->scip, pricer, valid) );
92  }
93  return SCIP_OKAY;
94 }
95 
96 /** internal method creating a variable pricer */
97 static
99  SCIP_PRICER** pricer, /**< pointer to variable pricer data structure */
100  SCIP_SET* set, /**< global SCIP settings */
101  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
102  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
103  const char* name, /**< name of variable pricer */
104  const char* desc, /**< description of variable pricer */
105  int priority, /**< priority of the variable pricer */
106  SCIP_Bool delay, /**< should the pricer be delayed until no other pricers or already existing
107  * problem variables with negative reduced costs are found */
108  SCIP_DECL_PRICERCOPY ((*pricercopy)), /**< copy method of pricer or NULL if you don't want to copy your plugin into sub-SCIPs */
109  SCIP_DECL_PRICERFREE ((*pricerfree)), /**< destructor of variable pricer */
110  SCIP_DECL_PRICERINIT ((*pricerinit)), /**< initialize variable pricer */
111  SCIP_DECL_PRICEREXIT ((*pricerexit)), /**< deinitialize variable pricer */
112  SCIP_DECL_PRICERINITSOL((*pricerinitsol)),/**< solving process initialization method of variable pricer */
113  SCIP_DECL_PRICEREXITSOL((*pricerexitsol)),/**< solving process deinitialization method of variable pricer */
114  SCIP_DECL_PRICERREDCOST((*pricerredcost)),/**< reduced cost pricing method of variable pricer for feasible LPs */
115  SCIP_DECL_PRICERFARKAS((*pricerfarkas)), /**< Farkas pricing method of variable pricer for infeasible LPs */
116  SCIP_PRICERDATA* pricerdata /**< variable pricer data */
117  )
118 {
119  char paramname[SCIP_MAXSTRLEN];
120  char paramdesc[SCIP_MAXSTRLEN];
121 
122  assert(pricer != NULL);
123  assert(name != NULL);
124  assert(desc != NULL);
125  assert(pricerredcost != NULL);
126 
127  SCIP_ALLOC( BMSallocMemory(pricer) );
128  BMSclearMemory(*pricer);
129 
130  SCIP_ALLOC( BMSduplicateMemoryArray(&(*pricer)->name, name, strlen(name)+1) );
131  SCIP_ALLOC( BMSduplicateMemoryArray(&(*pricer)->desc, desc, strlen(desc)+1) );
132  (*pricer)->priority = priority;
133  (*pricer)->pricercopy = pricercopy;
134  (*pricer)->pricerfree = pricerfree;
135  (*pricer)->pricerinit = pricerinit;
136  (*pricer)->pricerexit = pricerexit;
137  (*pricer)->pricerinitsol = pricerinitsol;
138  (*pricer)->pricerexitsol = pricerexitsol;
139  (*pricer)->pricerredcost = pricerredcost;
140  (*pricer)->pricerfarkas = pricerfarkas;
141  (*pricer)->pricerdata = pricerdata;
142  SCIP_CALL( SCIPclockCreate(&(*pricer)->setuptime, SCIP_CLOCKTYPE_DEFAULT) );
143  SCIP_CALL( SCIPclockCreate(&(*pricer)->pricerclock, SCIP_CLOCKTYPE_DEFAULT) );
144  (*pricer)->ncalls = 0;
145  (*pricer)->nvarsfound = 0;
146  (*pricer)->delay = delay;
147  (*pricer)->active = FALSE;
148  (*pricer)->initialized = FALSE;
149 
150  /* add parameters */
151  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "pricers/%s/priority", name);
152  (void) SCIPsnprintf(paramdesc, SCIP_MAXSTRLEN, "priority of pricer <%s>", name);
153  SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname, paramdesc,
154  &(*pricer)->priority, FALSE, priority, INT_MIN/4, INT_MAX/4,
155  paramChgdPricerPriority, (SCIP_PARAMDATA*)(*pricer)) ); /*lint !e740*/
156 
157  return SCIP_OKAY;
158 }
159 
160 /** creates a variable pricer
161  * To use the variable pricer for solving a problem, it first has to be activated with a call to SCIPactivatePricer().
162  */
164  SCIP_PRICER** pricer, /**< pointer to variable pricer data structure */
165  SCIP_SET* set, /**< global SCIP settings */
166  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
167  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
168  const char* name, /**< name of variable pricer */
169  const char* desc, /**< description of variable pricer */
170  int priority, /**< priority of the variable pricer */
171  SCIP_Bool delay, /**< should the pricer be delayed until no other pricers or already existing
172  * problem variables with negative reduced costs are found */
173  SCIP_DECL_PRICERCOPY ((*pricercopy)), /**< copy method of pricer or NULL if you don't want to copy your plugin into sub-SCIPs */
174  SCIP_DECL_PRICERFREE ((*pricerfree)), /**< destructor of variable pricer */
175  SCIP_DECL_PRICERINIT ((*pricerinit)), /**< initialize variable pricer */
176  SCIP_DECL_PRICEREXIT ((*pricerexit)), /**< deinitialize variable pricer */
177  SCIP_DECL_PRICERINITSOL((*pricerinitsol)),/**< solving process initialization method of variable pricer */
178  SCIP_DECL_PRICEREXITSOL((*pricerexitsol)),/**< solving process deinitialization method of variable pricer */
179  SCIP_DECL_PRICERREDCOST((*pricerredcost)),/**< reduced cost pricing method of variable pricer for feasible LPs */
180  SCIP_DECL_PRICERFARKAS((*pricerfarkas)), /**< Farkas pricing method of variable pricer for infeasible LPs */
181  SCIP_PRICERDATA* pricerdata /**< variable pricer data */
182  )
183 {
184  assert(pricer != NULL);
185  assert(name != NULL);
186  assert(desc != NULL);
187  assert(pricerredcost != NULL);
188 
189  SCIP_CALL_FINALLY( doPricerCreate(pricer, set, messagehdlr, blkmem, name, desc, priority, delay, pricercopy,
190  pricerfree, pricerinit, pricerexit, pricerinitsol, pricerexitsol, pricerredcost, pricerfarkas, pricerdata),
191  (void) SCIPpricerFree(pricer ,set) );
192 
193  return SCIP_OKAY;
194 }
195 
196 /** calls destructor and frees memory of variable pricer */
198  SCIP_PRICER** pricer, /**< pointer to variable pricer data structure */
199  SCIP_SET* set /**< global SCIP settings */
200  )
201 {
202  assert(pricer != NULL);
203  if( *pricer == NULL )
204  return SCIP_OKAY;
205  assert(!(*pricer)->initialized);
206  assert(set != NULL);
207 
208  /* call destructor of variable pricer */
209  if( (*pricer)->pricerfree != NULL )
210  {
211  SCIP_CALL( (*pricer)->pricerfree(set->scip, *pricer) );
212  }
213 
214  SCIPclockFree(&(*pricer)->pricerclock);
215  SCIPclockFree(&(*pricer)->setuptime);
216  BMSfreeMemoryArrayNull(&(*pricer)->name);
217  BMSfreeMemoryArrayNull(&(*pricer)->desc);
218  BMSfreeMemory(pricer);
219 
220  return SCIP_OKAY;
221 }
222 
223 /** initializes variable pricer */
225  SCIP_PRICER* pricer, /**< variable pricer */
226  SCIP_SET* set /**< global SCIP settings */
227  )
228 {
229  assert(pricer != NULL);
230  assert(pricer->active);
231  assert(set != NULL);
232 
233  if( pricer->initialized )
234  {
235  SCIPerrorMessage("variable pricer <%s> already initialized\n", pricer->name);
236  return SCIP_INVALIDCALL;
237  }
238 
239  if( set->misc_resetstat )
240  {
241  SCIPclockReset(pricer->setuptime);
242  SCIPclockReset(pricer->pricerclock);
243 
244  pricer->ncalls = 0;
245  pricer->nvarsfound = 0;
246  }
247 
248  if( pricer->pricerinit != NULL )
249  {
250  /* start timing */
251  SCIPclockStart(pricer->setuptime, set);
252 
253  SCIP_CALL( pricer->pricerinit(set->scip, pricer) );
254 
255  /* stop timing */
256  SCIPclockStop(pricer->setuptime, set);
257  }
258  pricer->initialized = TRUE;
259 
260  return SCIP_OKAY;
261 }
262 
263 /** calls exit method of variable pricer */
265  SCIP_PRICER* pricer, /**< variable pricer */
266  SCIP_SET* set /**< global SCIP settings */
267  )
268 {
269  assert(pricer != NULL);
270  assert(pricer->active);
271  assert(set != NULL);
272 
273  if( !pricer->initialized )
274  {
275  SCIPerrorMessage("variable pricer <%s> not initialized\n", pricer->name);
276  return SCIP_INVALIDCALL;
277  }
278 
279  if( pricer->pricerexit != NULL )
280  {
281  /* start timing */
282  SCIPclockStart(pricer->setuptime, set);
283 
284  SCIP_CALL( pricer->pricerexit(set->scip, pricer) );
285 
286  /* stop timing */
287  SCIPclockStop(pricer->setuptime, set);
288  }
289  pricer->initialized = FALSE;
290 
291  return SCIP_OKAY;
292 }
293 
294 /** informs variable pricer that the branch and bound process is being started */
296  SCIP_PRICER* pricer, /**< variable pricer */
297  SCIP_SET* set /**< global SCIP settings */
298  )
299 {
300  assert(pricer != NULL);
301  assert(set != NULL);
302 
303  /* call solving process initialization method of variable pricer */
304  if( pricer->pricerinitsol != NULL )
305  {
306  /* start timing */
307  SCIPclockStart(pricer->setuptime, set);
308 
309  SCIP_CALL( pricer->pricerinitsol(set->scip, pricer) );
310 
311  /* stop timing */
312  SCIPclockStop(pricer->setuptime, set);
313  }
314 
315  return SCIP_OKAY;
316 }
317 
318 /** informs variable pricer that the branch and bound process data is being freed */
320  SCIP_PRICER* pricer, /**< variable pricer */
321  SCIP_SET* set /**< global SCIP settings */
322  )
323 {
324  assert(pricer != NULL);
325  assert(set != NULL);
326 
327  /* call solving process deinitialization method of variable pricer */
328  if( pricer->pricerexitsol != NULL )
329  {
330  /* start timing */
331  SCIPclockStart(pricer->setuptime, set);
332 
333  SCIP_CALL( pricer->pricerexitsol(set->scip, pricer) );
334 
335  /* stop timing */
336  SCIPclockStop(pricer->setuptime, set);
337  }
338 
339  return SCIP_OKAY;
340 }
341 
342 /** activates pricer such that it is called in LP solving loop */
344  SCIP_PRICER* pricer, /**< variable pricer */
345  SCIP_SET* set /**< global SCIP settings */
346  )
347 {
348  assert(pricer != NULL);
349  assert(set != NULL);
350  assert(set->stage == SCIP_STAGE_PROBLEM);
351 
352  if( !pricer->active )
353  {
354  pricer->active = TRUE;
355  set->nactivepricers++;
356  set->pricerssorted = FALSE;
357  }
358 
359  return SCIP_OKAY;
360 }
361 
362 /** deactivates pricer such that it is no longer called in LP solving loop */
364  SCIP_PRICER* pricer, /**< variable pricer */
365  SCIP_SET* set /**< global SCIP settings */
366  )
367 {
368  assert(pricer != NULL);
369  assert(set != NULL);
370  assert(set->stage == SCIP_STAGE_PROBLEM);
371 
372  if( pricer->active )
373  {
374  pricer->active = FALSE;
375  set->nactivepricers--;
376  set->pricerssorted = FALSE;
377  }
378 
379  return SCIP_OKAY;
380 }
381 
382 /** calls reduced cost pricing method of variable pricer */
384  SCIP_PRICER* pricer, /**< variable pricer */
385  SCIP_SET* set, /**< global SCIP settings */
386  SCIP_PROB* prob, /**< transformed problem */
387  SCIP_Real* lowerbound, /**< local lower bound computed by the pricer */
388  SCIP_Bool* stopearly, /**< should pricing be stopped, although new variables were added? */
389  SCIP_RESULT* result /**< result of the pricing process */
390  )
391 {
392  int oldnvars;
393 
394  assert(pricer != NULL);
395  assert(pricer->active);
396  assert(pricer->pricerredcost != NULL);
397  assert(set != NULL);
398  assert(prob != NULL);
399  assert(lowerbound != NULL);
400  assert(result != NULL);
401 
402  SCIPsetDebugMsg(set, "executing reduced cost pricing of variable pricer <%s>\n", pricer->name);
403 
404  oldnvars = prob->nvars;
405 
406  /* start timing */
407  SCIPclockStart(pricer->pricerclock, set);
408 
409  /* call external method */
410  SCIP_CALL( pricer->pricerredcost(set->scip, pricer, lowerbound, stopearly, result) );
411 
412  /* stop timing */
413  SCIPclockStop(pricer->pricerclock, set);
414 
415  /* evaluate result */
416  pricer->ncalls++;
417  pricer->nvarsfound += prob->nvars - oldnvars;
418 
419  return SCIP_OKAY;
420 }
421 
422 /** calls Farkas pricing method of variable pricer */
424  SCIP_PRICER* pricer, /**< variable pricer */
425  SCIP_SET* set, /**< global SCIP settings */
426  SCIP_PROB* prob, /**< transformed problem */
427  SCIP_RESULT* result /**< result of the pricing process */
428  )
429 {
430  int oldnvars;
431 
432  assert(pricer != NULL);
433  assert(pricer->active);
434  assert(set != NULL);
435  assert(prob != NULL);
436 
437  /* check, if pricer implemented a Farkas pricing algorithm */
438  if( pricer->pricerfarkas == NULL )
439  return SCIP_OKAY;
440 
441  SCIPsetDebugMsg(set, "executing Farkas pricing of variable pricer <%s>\n", pricer->name);
442 
443  oldnvars = prob->nvars;
444 
445  /* start timing */
446  SCIPclockStart(pricer->pricerclock, set);
447 
448  /* call external method */
449  SCIP_CALL( pricer->pricerfarkas(set->scip, pricer, result) );
450 
451  /* stop timing */
452  SCIPclockStop(pricer->pricerclock, set);
453 
454  /* evaluate result */
455  pricer->ncalls++;
456  pricer->nvarsfound += prob->nvars - oldnvars;
457 
458  return SCIP_OKAY;
459 }
460 
461 /** depending on the LP's solution status, calls reduced cost or Farkas pricing method of variable pricer */
463  SCIP_PRICER* pricer, /**< variable pricer */
464  SCIP_SET* set, /**< global SCIP settings */
465  SCIP_PROB* prob, /**< transformed problem */
466  SCIP_LP* lp, /**< LP data */
467  SCIP_PRICESTORE* pricestore, /**< pricing storage */
468  SCIP_Real* lowerbound, /**< local lower bound computed by the pricer */
469  SCIP_Bool* stopearly, /**< should pricing be stopped, although new variables were added? */
470  SCIP_RESULT* result /**< result of the pricing process */
471  )
472 {
473  assert(pricer != NULL);
474  assert(lowerbound != NULL);
475  assert(stopearly != NULL);
476  assert(result != NULL);
477 
478  /* set lowerbound, stopearly, and result pointer */
479  *lowerbound = - SCIPsetInfinity(set);
480  *stopearly = FALSE;
481  *result = SCIP_SUCCESS;
482 
483  /* check if pricer should be delayed */
484  if( pricer->delay && SCIPpricestoreGetNVars(pricestore) > 0 )
485  return SCIP_OKAY;
486 
488  {
489  SCIP_CALL( SCIPpricerFarkas(pricer, set, prob, result) );
490  }
491  else
492  {
493  *result = SCIP_DIDNOTRUN;
494  SCIP_CALL( SCIPpricerRedcost(pricer, set, prob, lowerbound, stopearly, result) );
495  }
496 
497  return SCIP_OKAY;
498 }
499 
500 /** gets user data of variable pricer */
502  SCIP_PRICER* pricer /**< variable pricer */
503  )
504 {
505  assert(pricer != NULL);
506 
507  return pricer->pricerdata;
508 }
509 
510 /** sets user data of variable pricer; user has to free old data in advance! */
512  SCIP_PRICER* pricer, /**< variable pricer */
513  SCIP_PRICERDATA* pricerdata /**< new variable pricer user data */
514  )
515 {
516  assert(pricer != NULL);
517 
518  pricer->pricerdata = pricerdata;
519 }
520 
521 /** sets copy callback of pricer */
523  SCIP_PRICER* pricer, /**< variable pricer */
524  SCIP_DECL_PRICERCOPY ((*pricercopy)) /**< copy callback of pricer */
525  )
526 {
527  assert(pricer != NULL);
528 
529  pricer->pricercopy = pricercopy;
530 }
531 
532 /** sets destructor callback of pricer */
534  SCIP_PRICER* pricer, /**< pricer */
535  SCIP_DECL_PRICERFREE ((*pricerfree)) /**< destructor of pricer */
536  )
537 {
538  assert(pricer != NULL);
539 
540  pricer->pricerfree = pricerfree;
541 }
542 
543 /** sets initialization callback of pricer */
545  SCIP_PRICER* pricer, /**< pricer */
546  SCIP_DECL_PRICERINIT ((*pricerinit)) /**< initialize pricer */
547  )
548 {
549  assert(pricer != NULL);
550 
551  pricer->pricerinit = pricerinit;
552 }
553 
554 /** sets deinitialization callback of pricer */
556  SCIP_PRICER* pricer, /**< pricer */
557  SCIP_DECL_PRICEREXIT ((*pricerexit)) /**< deinitialize pricer */
558  )
559 {
560  assert(pricer != NULL);
561 
562  pricer->pricerexit = pricerexit;
563 }
564 
565 /** sets solving process initialization callback of pricer */
567  SCIP_PRICER* pricer, /**< pricer */
568  SCIP_DECL_PRICERINITSOL ((*pricerinitsol))/**< solving process initialization callback of pricer */
569  )
570 {
571  assert(pricer != NULL);
572 
573  pricer->pricerinitsol = pricerinitsol;
574 }
575 
576 /** sets solving process deinitialization callback of pricer */
578  SCIP_PRICER* pricer, /**< pricer */
579  SCIP_DECL_PRICEREXITSOL ((*pricerexitsol))/**< solving process deinitialization callback of pricer */
580  )
581 {
582  assert(pricer != NULL);
583 
584  pricer->pricerexitsol = pricerexitsol;
585 }
586 
587 /** gets name of variable pricer */
588 const char* SCIPpricerGetName(
589  SCIP_PRICER* pricer /**< variable pricer */
590  )
591 {
592  assert(pricer != NULL);
593 
594  return pricer->name;
595 }
596 
597 /** gets description of variable pricer */
598 const char* SCIPpricerGetDesc(
599  SCIP_PRICER* pricer /**< variable pricer */
600  )
601 {
602  assert(pricer != NULL);
603 
604  return pricer->desc;
605 }
606 
607 /** gets priority of variable pricer */
609  SCIP_PRICER* pricer /**< variable pricer */
610  )
611 {
612  assert(pricer != NULL);
613 
614  return pricer->priority;
615 }
616 
617 /** sets priority of variable pricer */
619  SCIP_PRICER* pricer, /**< variable pricer */
620  SCIP_SET* set, /**< global SCIP settings */
621  int priority /**< new priority of the variable pricer */
622  )
623 {
624  assert(pricer != NULL);
625  assert(set != NULL);
626 
627  pricer->priority = priority;
628  set->pricerssorted = FALSE;
629 }
630 
631 /** gets the number of times, the pricer was called and tried to find a variable with negative reduced costs */
633  SCIP_PRICER* pricer /**< variable pricer */
634  )
635 {
636  assert(pricer != NULL);
637 
638  return pricer->ncalls;
639 }
640 
641 /** gets the number of variables with negative reduced costs found by this pricer */
643  SCIP_PRICER* pricer /**< variable pricer */
644  )
645 {
646  assert(pricer != NULL);
647 
648  return pricer->nvarsfound;
649 }
650 
651 /** gets time in seconds used in this pricer for setting up for next stages */
653  SCIP_PRICER* pricer /**< variable pricer */
654  )
655 {
656  assert(pricer != NULL);
657 
658  return SCIPclockGetTime(pricer->setuptime);
659 }
660 
661 /** gets time in seconds used in this pricer */
663  SCIP_PRICER* pricer /**< variable pricer */
664  )
665 {
666  assert(pricer != NULL);
667 
668  return SCIPclockGetTime(pricer->pricerclock);
669 }
670 
671 /** enables or disables all clocks of \p pricer, depending on the value of the flag */
673  SCIP_PRICER* pricer, /**< the pricer for which all clocks should be enabled or disabled */
674  SCIP_Bool enable /**< should the clocks of the pricer be enabled? */
675  )
676 {
677  assert(pricer != NULL);
678 
679  SCIPclockEnableOrDisable(pricer->setuptime, enable);
680  SCIPclockEnableOrDisable(pricer->pricerclock, enable);
681 }
682 
683 /** returns whether the given pricer is in use in the current problem */
685  SCIP_PRICER* pricer /**< variable pricer */
686  )
687 {
688  assert(pricer != NULL);
689 
690  return pricer->active;
691 }
692 
693 /** returns whether the pricer should be delayed until no other pricer finds a new variable */
695  SCIP_PRICER* pricer /**< variable pricer */
696  )
697 {
698  assert(pricer != NULL);
699 
700  return pricer->delay;
701 }
702 
703 /** is variable pricer initialized? */
705  SCIP_PRICER* pricer /**< variable pricer */
706  )
707 {
708  assert(pricer != NULL);
709 
710  return pricer->initialized;
711 }
712 
713 
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
void SCIPpricerEnableOrDisableClocks(SCIP_PRICER *pricer, SCIP_Bool enable)
Definition: pricer.c:672
SCIP_RETCODE SCIPpricerInit(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:224
SCIP_RETCODE SCIPpricerDeactivate(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:363
#define NULL
Definition: def.h:253
void SCIPpricerSetInit(SCIP_PRICER *pricer, SCIP_DECL_PRICERINIT((*pricerinit)))
Definition: pricer.c:544
void SCIPpricerSetExitsol(SCIP_PRICER *pricer, SCIP_DECL_PRICEREXITSOL((*pricerexitsol)))
Definition: pricer.c:577
#define BMSfreeMemoryArrayNull(ptr)
Definition: memory.h:138
SCIP_Real SCIPpricerGetSetupTime(SCIP_PRICER *pricer)
Definition: pricer.c:652
int SCIPpricestoreGetNVars(SCIP_PRICESTORE *pricestore)
Definition: pricestore.c:602
SCIP_Bool SCIPpricerIsActive(SCIP_PRICER *pricer)
Definition: pricer.c:684
SCIP_PARAMDATA * SCIPparamGetData(SCIP_PARAM *param)
Definition: paramset.c:661
#define SCIP_MAXSTRLEN
Definition: def.h:274
internal methods for clocks and timing issues
int SCIPpricerGetNVarsFound(SCIP_PRICER *pricer)
Definition: pricer.c:642
struct SCIP_ParamData SCIP_PARAMDATA
Definition: type_paramset.h:76
static SCIP_DECL_PARAMCHGD(paramChgdPricerPriority)
Definition: pricer.c:63
#define SCIP_CALL_FINALLY(x, y)
Definition: def.h:407
SCIP_Real SCIPsetInfinity(SCIP_SET *set)
Definition: set.c:5813
#define SCIP_DECL_PRICEREXIT(x)
Definition: type_pricer.h:70
void SCIPclockStop(SCIP_CLOCK *clck, SCIP_SET *set)
Definition: clock.c:350
#define FALSE
Definition: def.h:73
SCIP_RETCODE SCIPpricerInitsol(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:295
void SCIPclockStart(SCIP_CLOCK *clck, SCIP_SET *set)
Definition: clock.c:280
#define TRUE
Definition: def.h:72
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_RETCODE SCIPpricerRedcost(SCIP_PRICER *pricer, SCIP_SET *set, SCIP_PROB *prob, SCIP_Real *lowerbound, SCIP_Bool *stopearly, SCIP_RESULT *result)
Definition: pricer.c:383
void SCIPpricerSetFree(SCIP_PRICER *pricer, SCIP_DECL_PRICERFREE((*pricerfree)))
Definition: pricer.c:533
int SCIPpricerGetPriority(SCIP_PRICER *pricer)
Definition: pricer.c:608
static GRAPHNODE ** active
#define SCIP_DECL_PRICEREXITSOL(x)
Definition: type_pricer.h:92
internal methods for handling parameter settings
void SCIPclockEnableOrDisable(SCIP_CLOCK *clck, SCIP_Bool enable)
Definition: clock.c:250
#define BMSfreeMemory(ptr)
Definition: memory.h:135
#define SCIP_DECL_PRICERCOPY(x)
Definition: type_pricer.h:46
SCIP_Bool delay
Definition: struct_pricer.h:55
SCIP_RETCODE SCIPpricerCopyInclude(SCIP_PRICER *pricer, SCIP_SET *set, SCIP_Bool *valid)
Definition: pricer.c:77
SCIP_LPSOLSTAT SCIPlpGetSolstat(SCIP_LP *lp)
Definition: lp.c:12902
internal methods for LP management
void SCIPpricerSetPriority(SCIP_PRICER *pricer, SCIP_SET *set, int priority)
Definition: pricer.c:618
SCIP_RETCODE SCIPpricerExit(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:264
SCIP_DECL_SORTPTRCOMP(SCIPpricerComp)
Definition: pricer.c:44
void SCIPpricerSetCopy(SCIP_PRICER *pricer, SCIP_DECL_PRICERCOPY((*pricercopy)))
Definition: pricer.c:522
internal methods for storing and manipulating the main problem
#define SCIPerrorMessage
Definition: pub_message.h:45
void SCIPclockReset(SCIP_CLOCK *clck)
Definition: clock.c:199
SCIP_CLOCK * setuptime
Definition: struct_pricer.h:50
SCIP_RETCODE SCIPpricerFree(SCIP_PRICER **pricer, SCIP_SET *set)
Definition: pricer.c:197
SCIP_Real SCIPclockGetTime(SCIP_CLOCK *clck)
Definition: clock.c:428
static SCIP_RETCODE doPricerCreate(SCIP_PRICER **pricer, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int priority, SCIP_Bool delay, SCIP_DECL_PRICERCOPY((*pricercopy)), SCIP_DECL_PRICERFREE((*pricerfree)), SCIP_DECL_PRICERINIT((*pricerinit)), SCIP_DECL_PRICEREXIT((*pricerexit)), SCIP_DECL_PRICERINITSOL((*pricerinitsol)), SCIP_DECL_PRICEREXITSOL((*pricerexitsol)), SCIP_DECL_PRICERREDCOST((*pricerredcost)), SCIP_DECL_PRICERFARKAS((*pricerfarkas)), SCIP_PRICERDATA *pricerdata)
Definition: pricer.c:98
SCIP_DECL_PRICERINIT(ObjPricerVRP::scip_init)
Definition: pricer_vrp.cpp:74
internal methods for variable pricers
internal methods for global SCIP settings
#define SCIP_CALL(x)
Definition: def.h:365
SCIP_CLOCK * pricerclock
Definition: struct_pricer.h:51
internal methods for storing priced variables
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:2879
SCIP_PRICERDATA * pricerdata
Definition: struct_pricer.h:49
SCIP_DECL_PRICERFARKAS(ObjPricerVRP::scip_farkas)
Definition: pricer_vrp.cpp:237
#define BMSduplicateMemoryArray(ptr, source, num)
Definition: memory.h:133
SCIP_RETCODE SCIPclockCreate(SCIP_CLOCK **clck, SCIP_CLOCKTYPE clocktype)
Definition: clock.c:160
SCIP_RETCODE SCIPpricerFarkas(SCIP_PRICER *pricer, SCIP_SET *set, SCIP_PROB *prob, SCIP_RESULT *result)
Definition: pricer.c:423
SCIP_Bool SCIPpricerIsInitialized(SCIP_PRICER *pricer)
Definition: pricer.c:704
SCIP_Bool initialized
Definition: struct_pricer.h:58
SCIP_DECL_PRICERREDCOST(ObjPricerVRP::scip_redcost)
Definition: pricer_vrp.cpp:216
public data structures and miscellaneous methods
SCIP_RETCODE SCIPpricerCreate(SCIP_PRICER **pricer, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int priority, SCIP_Bool delay, SCIP_DECL_PRICERCOPY((*pricercopy)), SCIP_DECL_PRICERFREE((*pricerfree)), SCIP_DECL_PRICERINIT((*pricerinit)), SCIP_DECL_PRICEREXIT((*pricerexit)), SCIP_DECL_PRICERINITSOL((*pricerinitsol)), SCIP_DECL_PRICEREXITSOL((*pricerexitsol)), SCIP_DECL_PRICERREDCOST((*pricerredcost)), SCIP_DECL_PRICERFARKAS((*pricerfarkas)), SCIP_PRICERDATA *pricerdata)
Definition: pricer.c:163
#define SCIP_Bool
Definition: def.h:70
#define SCIP_DECL_PRICERINITSOL(x)
Definition: type_pricer.h:81
SCIP_Bool SCIPpricerIsDelayed(SCIP_PRICER *pricer)
Definition: pricer.c:694
void SCIPpricerSetData(SCIP_PRICER *pricer, SCIP_PRICERDATA *pricerdata)
Definition: pricer.c:511
void SCIPclockFree(SCIP_CLOCK **clck)
Definition: clock.c:175
SCIP_RETCODE SCIPpricerExitsol(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:319
#define SCIPsetDebugMsg
Definition: set.h:1720
const char * SCIPpricerGetName(SCIP_PRICER *pricer)
Definition: pricer.c:588
void SCIPpricerSetInitsol(SCIP_PRICER *pricer, SCIP_DECL_PRICERINITSOL((*pricerinitsol)))
Definition: pricer.c:566
SCIP_RETCODE SCIPpricerActivate(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:343
#define BMSclearMemory(ptr)
Definition: memory.h:119
int SCIPparamGetInt(SCIP_PARAM *param)
Definition: paramset.c:716
SCIP_Bool active
Definition: struct_pricer.h:57
SCIP_RETCODE SCIPsetPricerPriority(SCIP *scip, SCIP_PRICER *pricer, int priority)
Definition: scip_pricer.c:349
SCIP_PRICERDATA * SCIPpricerGetData(SCIP_PRICER *pricer)
Definition: pricer.c:501
public methods for message output
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10263
SCIP_Real SCIPpricerGetTime(SCIP_PRICER *pricer)
Definition: pricer.c:662
#define SCIP_Real
Definition: def.h:164
#define BMSallocMemory(ptr)
Definition: memory.h:109
data structures for variable pricers
const char * SCIPpricerGetDesc(SCIP_PRICER *pricer)
Definition: pricer.c:598
struct SCIP_PricerData SCIP_PRICERDATA
Definition: type_pricer.h:36
#define SCIP_DECL_PRICERFREE(x)
Definition: type_pricer.h:54
common defines and data types used in all packages of SCIP
void SCIPpricerSetExit(SCIP_PRICER *pricer, SCIP_DECL_PRICEREXIT((*pricerexit)))
Definition: pricer.c:555
SCIP_RETCODE SCIPpricerExec(SCIP_PRICER *pricer, SCIP_SET *set, SCIP_PROB *prob, SCIP_LP *lp, SCIP_PRICESTORE *pricestore, SCIP_Real *lowerbound, SCIP_Bool *stopearly, SCIP_RESULT *result)
Definition: pricer.c:462
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:427
#define SCIP_ALLOC(x)
Definition: def.h:376
int SCIPpricerGetNCalls(SCIP_PRICER *pricer)
Definition: pricer.c:632
SCIP callable library.