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