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-2022 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 scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file pricer.c
17  * @ingroup OTHER_CFILES
18  * @brief methods for variable pricers
19  * @author Tobias Achterberg
20  * @author Timo Berthold
21  */
22 
23 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
24 
25 #include <assert.h>
26 #include <string.h>
27 
28 #include "scip/def.h"
29 #include "scip/set.h"
30 #include "scip/clock.h"
31 #include "scip/paramset.h"
32 #include "scip/lp.h"
33 #include "scip/prob.h"
34 #include "scip/pricestore.h"
35 #include "scip/scip.h"
36 #include "scip/pricer.h"
37 #include "scip/pub_message.h"
38 #include "scip/pub_misc.h"
39 
40 #include "scip/struct_pricer.h"
41 
42 
43 
44 /** compares two pricers w. r. to their activity and their priority */
45 SCIP_DECL_SORTPTRCOMP(SCIPpricerComp)
46 { /*lint --e{715}*/
47  if( ((SCIP_PRICER*)elem1)->active != ((SCIP_PRICER*)elem2)->active )
48  return ((SCIP_PRICER*)elem1)->active ? -1 : +1;
49  else
50  return ((SCIP_PRICER*)elem2)->priority - ((SCIP_PRICER*)elem1)->priority;
51 }
52 
53 /** comparison method for sorting pricers w.r.t. to their name */
54 SCIP_DECL_SORTPTRCOMP(SCIPpricerCompName)
55 {
56  if( ((SCIP_PRICER*)elem1)->active != ((SCIP_PRICER*)elem2)->active )
57  return ((SCIP_PRICER*)elem1)->active ? -1 : +1;
58  else
59  return strcmp(SCIPpricerGetName((SCIP_PRICER*)elem1), SCIPpricerGetName((SCIP_PRICER*)elem2));
60 }
61 
62 /** method to call, when the priority of a pricer was changed */
63 static
64 SCIP_DECL_PARAMCHGD(paramChgdPricerPriority)
65 { /*lint --e{715}*/
66  SCIP_PARAMDATA* paramdata;
67 
68  paramdata = SCIPparamGetData(param);
69  assert(paramdata != NULL);
70 
71  /* use SCIPsetPricerPriority() to mark the pricers unsorted */
72  SCIP_CALL( SCIPsetPricerPriority(scip, (SCIP_PRICER*)paramdata, SCIPparamGetInt(param)) ); /*lint !e740*/
73 
74  return SCIP_OKAY;
75 }
76 
77 /** copies the given pricer to a new scip */
79  SCIP_PRICER* pricer, /**< pricer */
80  SCIP_SET* set, /**< SCIP_SET of SCIP to copy to */
81  SCIP_Bool* valid /**< was the copying process valid? */
82  )
83 {
84  assert(pricer != NULL);
85  assert(set != NULL);
86  assert(valid != NULL);
87  assert(set->scip != NULL);
88 
89  if( pricer->pricercopy != NULL )
90  {
91  SCIPsetDebugMsg(set, "including pricer %s in subscip %p\n", SCIPpricerGetName(pricer), (void*)set->scip);
92  SCIP_CALL( pricer->pricercopy(set->scip, pricer, valid) );
93  }
94  return SCIP_OKAY;
95 }
96 
97 /** internal method creating a variable pricer */
98 static
100  SCIP_PRICER** pricer, /**< pointer to variable pricer data structure */
101  SCIP_SET* set, /**< global SCIP settings */
102  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
103  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
104  const char* name, /**< name of variable pricer */
105  const char* desc, /**< description of variable pricer */
106  int priority, /**< priority of the variable pricer */
107  SCIP_Bool delay, /**< should the pricer be delayed until no other pricers or already existing
108  * problem variables with negative reduced costs are found */
109  SCIP_DECL_PRICERCOPY ((*pricercopy)), /**< copy method of pricer or NULL if you don't want to copy your plugin into sub-SCIPs */
110  SCIP_DECL_PRICERFREE ((*pricerfree)), /**< destructor of variable pricer */
111  SCIP_DECL_PRICERINIT ((*pricerinit)), /**< initialize variable pricer */
112  SCIP_DECL_PRICEREXIT ((*pricerexit)), /**< deinitialize variable pricer */
113  SCIP_DECL_PRICERINITSOL((*pricerinitsol)),/**< solving process initialization method of variable pricer */
114  SCIP_DECL_PRICEREXITSOL((*pricerexitsol)),/**< solving process deinitialization method of variable pricer */
115  SCIP_DECL_PRICERREDCOST((*pricerredcost)),/**< reduced cost pricing method of variable pricer for feasible LPs */
116  SCIP_DECL_PRICERFARKAS((*pricerfarkas)), /**< Farkas pricing method of variable pricer for infeasible LPs */
117  SCIP_PRICERDATA* pricerdata /**< variable pricer data */
118  )
119 {
121  char paramdesc[SCIP_MAXSTRLEN];
122 
123  assert(pricer != NULL);
124  assert(name != NULL);
125  assert(desc != NULL);
126  assert(pricerredcost != NULL);
127 
128  SCIP_ALLOC( BMSallocMemory(pricer) );
129  BMSclearMemory(*pricer);
130 
131  SCIP_ALLOC( BMSduplicateMemoryArray(&(*pricer)->name, name, strlen(name)+1) );
132  SCIP_ALLOC( BMSduplicateMemoryArray(&(*pricer)->desc, desc, strlen(desc)+1) );
133  (*pricer)->priority = priority;
134  (*pricer)->pricercopy = pricercopy;
135  (*pricer)->pricerfree = pricerfree;
136  (*pricer)->pricerinit = pricerinit;
137  (*pricer)->pricerexit = pricerexit;
138  (*pricer)->pricerinitsol = pricerinitsol;
139  (*pricer)->pricerexitsol = pricerexitsol;
140  (*pricer)->pricerredcost = pricerredcost;
141  (*pricer)->pricerfarkas = pricerfarkas;
142  (*pricer)->pricerdata = pricerdata;
143  SCIP_CALL( SCIPclockCreate(&(*pricer)->setuptime, SCIP_CLOCKTYPE_DEFAULT) );
144  SCIP_CALL( SCIPclockCreate(&(*pricer)->pricerclock, SCIP_CLOCKTYPE_DEFAULT) );
145  (*pricer)->ncalls = 0;
146  (*pricer)->nvarsfound = 0;
147  (*pricer)->delay = delay;
148  (*pricer)->active = FALSE;
149  (*pricer)->initialized = FALSE;
150 
151  /* add parameters */
152  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "pricers/%s/priority", name);
153  (void) SCIPsnprintf(paramdesc, SCIP_MAXSTRLEN, "priority of pricer <%s>", name);
154  SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname, paramdesc,
155  &(*pricer)->priority, FALSE, priority, INT_MIN/4, INT_MAX/4,
156  paramChgdPricerPriority, (SCIP_PARAMDATA*)(*pricer)) ); /*lint !e740*/
157 
158  return SCIP_OKAY;
159 }
160 
161 /** creates a variable pricer
162  * To use the variable pricer for solving a problem, it first has to be activated with a call to SCIPactivatePricer().
163  */
165  SCIP_PRICER** pricer, /**< pointer to variable pricer data structure */
166  SCIP_SET* set, /**< global SCIP settings */
167  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
168  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
169  const char* name, /**< name of variable pricer */
170  const char* desc, /**< description of variable pricer */
171  int priority, /**< priority of the variable pricer */
172  SCIP_Bool delay, /**< should the pricer be delayed until no other pricers or already existing
173  * problem variables with negative reduced costs are found */
174  SCIP_DECL_PRICERCOPY ((*pricercopy)), /**< copy method of pricer or NULL if you don't want to copy your plugin into sub-SCIPs */
175  SCIP_DECL_PRICERFREE ((*pricerfree)), /**< destructor of variable pricer */
176  SCIP_DECL_PRICERINIT ((*pricerinit)), /**< initialize variable pricer */
177  SCIP_DECL_PRICEREXIT ((*pricerexit)), /**< deinitialize variable pricer */
178  SCIP_DECL_PRICERINITSOL((*pricerinitsol)),/**< solving process initialization method of variable pricer */
179  SCIP_DECL_PRICEREXITSOL((*pricerexitsol)),/**< solving process deinitialization method of variable pricer */
180  SCIP_DECL_PRICERREDCOST((*pricerredcost)),/**< reduced cost pricing method of variable pricer for feasible LPs */
181  SCIP_DECL_PRICERFARKAS((*pricerfarkas)), /**< Farkas pricing method of variable pricer for infeasible LPs */
182  SCIP_PRICERDATA* pricerdata /**< variable pricer data */
183  )
184 {
185  assert(pricer != NULL);
186  assert(name != NULL);
187  assert(desc != NULL);
188  assert(pricerredcost != NULL);
189 
190  SCIP_CALL_FINALLY( doPricerCreate(pricer, set, messagehdlr, blkmem, name, desc, priority, delay, pricercopy,
191  pricerfree, pricerinit, pricerexit, pricerinitsol, pricerexitsol, pricerredcost, pricerfarkas, pricerdata),
192  (void) SCIPpricerFree(pricer ,set) );
193 
194  return SCIP_OKAY;
195 }
196 
197 /** calls destructor and frees memory of variable pricer */
199  SCIP_PRICER** pricer, /**< pointer to variable pricer data structure */
200  SCIP_SET* set /**< global SCIP settings */
201  )
202 {
203  assert(pricer != NULL);
204  if( *pricer == NULL )
205  return SCIP_OKAY;
206  assert(!(*pricer)->initialized);
207  assert(set != NULL);
208 
209  /* call destructor of variable pricer */
210  if( (*pricer)->pricerfree != NULL )
211  {
212  SCIP_CALL( (*pricer)->pricerfree(set->scip, *pricer) );
213  }
214 
215  SCIPclockFree(&(*pricer)->pricerclock);
216  SCIPclockFree(&(*pricer)->setuptime);
217  BMSfreeMemoryArrayNull(&(*pricer)->name);
218  BMSfreeMemoryArrayNull(&(*pricer)->desc);
219  BMSfreeMemory(pricer);
220 
221  return SCIP_OKAY;
222 }
223 
224 /** initializes variable pricer */
226  SCIP_PRICER* pricer, /**< variable pricer */
227  SCIP_SET* set /**< global SCIP settings */
228  )
229 {
230  assert(pricer != NULL);
231  assert(pricer->active);
232  assert(set != NULL);
233 
234  if( pricer->initialized )
235  {
236  SCIPerrorMessage("variable pricer <%s> already initialized\n", pricer->name);
237  return SCIP_INVALIDCALL;
238  }
239 
240  if( set->misc_resetstat )
241  {
242  SCIPclockReset(pricer->setuptime);
243  SCIPclockReset(pricer->pricerclock);
244 
245  pricer->ncalls = 0;
246  pricer->nvarsfound = 0;
247  }
248 
249  if( pricer->pricerinit != NULL )
250  {
251  /* start timing */
252  SCIPclockStart(pricer->setuptime, set);
253 
254  SCIP_CALL( pricer->pricerinit(set->scip, pricer) );
255 
256  /* stop timing */
257  SCIPclockStop(pricer->setuptime, set);
258  }
259  pricer->initialized = TRUE;
260 
261  return SCIP_OKAY;
262 }
263 
264 /** calls exit method of variable pricer */
266  SCIP_PRICER* pricer, /**< variable pricer */
267  SCIP_SET* set /**< global SCIP settings */
268  )
269 {
270  assert(pricer != NULL);
271  assert(pricer->active);
272  assert(set != NULL);
273 
274  if( !pricer->initialized )
275  {
276  SCIPerrorMessage("variable pricer <%s> not initialized\n", pricer->name);
277  return SCIP_INVALIDCALL;
278  }
279 
280  if( pricer->pricerexit != NULL )
281  {
282  /* start timing */
283  SCIPclockStart(pricer->setuptime, set);
284 
285  SCIP_CALL( pricer->pricerexit(set->scip, pricer) );
286 
287  /* stop timing */
288  SCIPclockStop(pricer->setuptime, set);
289  }
290  pricer->initialized = FALSE;
291 
292  return SCIP_OKAY;
293 }
294 
295 /** informs variable pricer that the branch and bound process is being started */
297  SCIP_PRICER* pricer, /**< variable pricer */
298  SCIP_SET* set /**< global SCIP settings */
299  )
300 {
301  assert(pricer != NULL);
302  assert(set != NULL);
303 
304  /* call solving process initialization method of variable pricer */
305  if( pricer->pricerinitsol != NULL )
306  {
307  /* start timing */
308  SCIPclockStart(pricer->setuptime, set);
309 
310  SCIP_CALL( pricer->pricerinitsol(set->scip, pricer) );
311 
312  /* stop timing */
313  SCIPclockStop(pricer->setuptime, set);
314  }
315 
316  return SCIP_OKAY;
317 }
318 
319 /** informs variable pricer that the branch and bound process data is being freed */
321  SCIP_PRICER* pricer, /**< variable pricer */
322  SCIP_SET* set /**< global SCIP settings */
323  )
324 {
325  assert(pricer != NULL);
326  assert(set != NULL);
327 
328  /* call solving process deinitialization method of variable pricer */
329  if( pricer->pricerexitsol != NULL )
330  {
331  /* start timing */
332  SCIPclockStart(pricer->setuptime, set);
333 
334  SCIP_CALL( pricer->pricerexitsol(set->scip, pricer) );
335 
336  /* stop timing */
337  SCIPclockStop(pricer->setuptime, set);
338  }
339 
340  return SCIP_OKAY;
341 }
342 
343 /** activates pricer such that it is called in LP solving loop */
345  SCIP_PRICER* pricer, /**< variable pricer */
346  SCIP_SET* set /**< global SCIP settings */
347  )
348 {
349  assert(pricer != NULL);
350  assert(set != NULL);
351  assert(set->stage == SCIP_STAGE_PROBLEM);
352 
353  if( !pricer->active )
354  {
355  pricer->active = TRUE;
356  set->nactivepricers++;
357  set->pricerssorted = FALSE;
358  }
359 
360  return SCIP_OKAY;
361 }
362 
363 /** deactivates pricer such that it is no longer called in LP solving loop */
365  SCIP_PRICER* pricer, /**< variable pricer */
366  SCIP_SET* set /**< global SCIP settings */
367  )
368 {
369  assert(pricer != NULL);
370  assert(set != NULL);
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 SCIPsetPricerPriority(SCIP *scip, SCIP_PRICER *pricer, int priority)
Definition: scip_pricer.c:350
SCIP_RETCODE SCIPpricerInit(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:225
SCIP_RETCODE SCIPpricerDeactivate(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:364
void SCIPpricerSetInit(SCIP_PRICER *pricer, SCIP_DECL_PRICERINIT((*pricerinit)))
Definition: pricer.c:544
void SCIPpricerSetData(SCIP_PRICER *pricer, SCIP_PRICERDATA *pricerdata)
Definition: pricer.c:511
void SCIPpricerSetExitsol(SCIP_PRICER *pricer, SCIP_DECL_PRICEREXITSOL((*pricerexitsol)))
Definition: pricer.c:577
const char * SCIPpricerGetName(SCIP_PRICER *pricer)
Definition: pricer.c:588
#define BMSfreeMemoryArrayNull(ptr)
Definition: memory.h:141
int SCIPpricestoreGetNVars(SCIP_PRICESTORE *pricestore)
Definition: pricestore.c:600
SCIP_PARAMDATA * SCIPparamGetData(SCIP_PARAM *param)
Definition: paramset.c:670
#define SCIP_MAXSTRLEN
Definition: def.h:293
internal methods for clocks and timing issues
struct SCIP_ParamData SCIP_PARAMDATA
Definition: type_paramset.h:78
static SCIP_DECL_PARAMCHGD(paramChgdPricerPriority)
Definition: pricer.c:64
#define SCIP_CALL_FINALLY(x, y)
Definition: def.h:426
SCIP_Real SCIPpricerGetTime(SCIP_PRICER *pricer)
Definition: pricer.c:662
SCIP_Real SCIPsetInfinity(SCIP_SET *set)
Definition: set.c:6065
#define SCIP_DECL_PRICEREXIT(x)
Definition: type_pricer.h:70
SCIP_Bool SCIPpricerIsActive(SCIP_PRICER *pricer)
Definition: pricer.c:684
void SCIPclockStop(SCIP_CLOCK *clck, SCIP_SET *set)
Definition: clock.c:351
#define FALSE
Definition: def.h:87
SCIP_RETCODE SCIPpricerInitsol(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:296
void SCIPclockStart(SCIP_CLOCK *clck, SCIP_SET *set)
Definition: clock.c:281
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10755
#define TRUE
Definition: def.h:86
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
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
SCIP_PRICERDATA * SCIPpricerGetData(SCIP_PRICER *pricer)
Definition: pricer.c:501
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:251
#define BMSfreeMemory(ptr)
Definition: memory.h:138
#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:78
SCIP_LPSOLSTAT SCIPlpGetSolstat(SCIP_LP *lp)
Definition: lp.c:13081
internal methods for LP management
Definition: heur_padm.c:123
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:265
int SCIPpricerGetPriority(SCIP_PRICER *pricer)
Definition: pricer.c:608
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:55
void SCIPclockReset(SCIP_CLOCK *clck)
Definition: clock.c:200
SCIP_CLOCK * setuptime
Definition: struct_pricer.h:50
SCIP_RETCODE SCIPpricerFree(SCIP_PRICER **pricer, SCIP_SET *set)
Definition: pricer.c:198
SCIP_Real SCIPclockGetTime(SCIP_CLOCK *clck)
Definition: clock.c:429
SCIP_DECL_SORTPTRCOMP(SCIPpricerComp)
Definition: pricer.c:45
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:99
#define NULL
Definition: lpi_spx1.cpp:155
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:384
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:3014
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:136
SCIP_RETCODE SCIPclockCreate(SCIP_CLOCK **clck, SCIP_CLOCKTYPE clocktype)
Definition: clock.c:161
SCIP_RETCODE SCIPpricerFarkas(SCIP_PRICER *pricer, SCIP_SET *set, SCIP_PROB *prob, SCIP_RESULT *result)
Definition: pricer.c:423
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:164
#define SCIP_Bool
Definition: def.h:84
#define SCIP_DECL_PRICERINITSOL(x)
Definition: type_pricer.h:81
static const char * paramname[]
Definition: lpi_msk.c:5021
void SCIPclockFree(SCIP_CLOCK **clck)
Definition: clock.c:176
SCIP_RETCODE SCIPpricerExitsol(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:320
#define SCIPsetDebugMsg
Definition: set.h:1761
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:344
#define BMSclearMemory(ptr)
Definition: memory.h:122
SCIP_Bool SCIPpricerIsDelayed(SCIP_PRICER *pricer)
Definition: pricer.c:694
int SCIPparamGetInt(SCIP_PARAM *param)
Definition: paramset.c:725
SCIP_Bool active
Definition: struct_pricer.h:57
SCIP_Bool SCIPpricerIsInitialized(SCIP_PRICER *pricer)
Definition: pricer.c:704
public methods for message output
int SCIPpricerGetNCalls(SCIP_PRICER *pricer)
Definition: pricer.c:632
#define SCIP_Real
Definition: def.h:177
const char * SCIPpricerGetDesc(SCIP_PRICER *pricer)
Definition: pricer.c:598
SCIP_Real SCIPpricerGetSetupTime(SCIP_PRICER *pricer)
Definition: pricer.c:652
#define BMSallocMemory(ptr)
Definition: memory.h:111
data structures for variable pricers
int SCIPpricerGetNVarsFound(SCIP_PRICER *pricer)
Definition: pricer.c:642
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:430
#define SCIP_ALLOC(x)
Definition: def.h:395
SCIP callable library.