Scippy

SCIP

Solving Constraint Integer Programs

pricestore.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 pricestore.c
26 * @ingroup OTHER_CFILES
27 * @brief methods for storing priced variables
28 * @author Tobias Achterberg
29 */
30
31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32
33#include "scip/clock.h"
34#include "scip/lp.h"
35#include "scip/lpexact.h"
36#include "scip/pricestore.h"
37#include "scip/pub_lp.h"
38#include "scip/pub_message.h"
39#include "scip/pub_var.h"
40#include "scip/set.h"
41#include "scip/struct_lp.h"
43#include "scip/struct_prob.h"
44#include "scip/struct_set.h"
45#include "scip/struct_var.h"
46#include "scip/tree.h"
47#include "scip/var.h"
48
49
50/*
51 * dynamic memory arrays
52 */
53
54/** resizes vars and score arrays to be able to store at least num entries */
55static
57 SCIP_PRICESTORE* pricestore, /**< pricing storage */
58 SCIP_SET* set, /**< global SCIP settings */
59 int num /**< minimal number of slots in array */
60 )
61{
62 assert(pricestore != NULL);
63 assert(set != NULL);
64
65 if( num > pricestore->varssize )
66 {
67 int newsize;
68
69 newsize = SCIPsetCalcMemGrowSize(set, num);
70 SCIP_ALLOC( BMSreallocMemoryArray(&pricestore->vars, newsize) );
71 SCIP_ALLOC( BMSreallocMemoryArray(&pricestore->scores, newsize) );
72 pricestore->varssize = newsize;
73 }
74 assert(num <= pricestore->varssize);
75
76 return SCIP_OKAY;
77}
78
79/** resizes bdviolvars arrays to be able to store at least num entries */
80static
82 SCIP_PRICESTORE* pricestore, /**< pricing storage */
83 SCIP_SET* set, /**< global SCIP settings */
84 int num /**< minimal number of slots in array */
85 )
86{
87 assert(pricestore != NULL);
88 assert(set != NULL);
89
90 if( num > pricestore->bdviolvarssize )
91 {
92 int newsize;
93
94 newsize = SCIPsetCalcMemGrowSize(set, num);
95 SCIP_ALLOC( BMSreallocMemoryArray(&pricestore->bdviolvars, newsize) );
96 SCIP_ALLOC( BMSreallocMemoryArray(&pricestore->bdviolvarslb, newsize) );
97 SCIP_ALLOC( BMSreallocMemoryArray(&pricestore->bdviolvarsub, newsize) );
98 pricestore->bdviolvarssize = newsize;
99 }
100 assert(num <= pricestore->bdviolvarssize);
101
102 return SCIP_OKAY;
103}
104
105
106/** creates pricing storage */
108 SCIP_PRICESTORE** pricestore /**< pointer to store pricing storage */
109 )
110{
111 assert(pricestore != NULL);
112
113 SCIP_ALLOC( BMSallocMemory(pricestore) );
114
115 SCIP_CALL( SCIPclockCreate(&(*pricestore)->probpricingtime, SCIP_CLOCKTYPE_DEFAULT) );
116 (*pricestore)->vars = NULL;
117 (*pricestore)->scores = NULL;
118 (*pricestore)->bdviolvars = NULL;
119 (*pricestore)->bdviolvarslb = NULL;
120 (*pricestore)->bdviolvarsub = NULL;
121 (*pricestore)->varssize = 0;
122 (*pricestore)->nvars = 0;
123 (*pricestore)->bdviolvarssize = 0;
124 (*pricestore)->nbdviolvars = 0;
125 (*pricestore)->naddedbdviolvars = 0;
126 (*pricestore)->nprobpricings = 0;
127 (*pricestore)->nprobvarsfound = 0;
128 (*pricestore)->nvarsfound = 0;
129 (*pricestore)->nvarsapplied = 0;
130 (*pricestore)->initiallp = FALSE;
131
132 return SCIP_OKAY;
133}
134
135/** frees pricing storage */
137 SCIP_PRICESTORE** pricestore /**< pointer to store pricing storage */
138 )
139{
140 assert(pricestore != NULL);
141 assert(*pricestore != NULL);
142 assert((*pricestore)->nvars == 0);
143 assert((*pricestore)->nbdviolvars == 0);
144
145 SCIPclockFree(&(*pricestore)->probpricingtime);
146 BMSfreeMemoryArrayNull(&(*pricestore)->vars);
147 BMSfreeMemoryArrayNull(&(*pricestore)->scores);
148 BMSfreeMemoryArrayNull(&(*pricestore)->bdviolvars);
149 BMSfreeMemoryArrayNull(&(*pricestore)->bdviolvarslb);
150 BMSfreeMemoryArrayNull(&(*pricestore)->bdviolvarsub);
151 BMSfreeMemory(pricestore);
152
153 return SCIP_OKAY;
154}
155
156/** informs pricing storage, that the setup of the initial LP starts now */
158 SCIP_PRICESTORE* pricestore /**< pricing storage */
159 )
160{
161 assert(pricestore != NULL);
162 assert(!pricestore->initiallp);
163 assert(pricestore->nvars == 0);
164
165 pricestore->initiallp = TRUE;
166}
167
168/** informs pricing storage, that the setup of the initial LP is now finished */
170 SCIP_PRICESTORE* pricestore /**< pricing storage */
171 )
172{
173 assert(pricestore != NULL);
174 assert(pricestore->initiallp);
175 assert(pricestore->nvars == 0);
176
177 pricestore->initiallp = FALSE;
178}
179
180/** adds variable to pricing storage and capture it */
182 SCIP_PRICESTORE* pricestore, /**< pricing storage */
183 BMS_BLKMEM* blkmem, /**< block memory */
184 SCIP_SET* set, /**< global SCIP settings */
185 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
186 SCIP_LP* lp, /**< LP data */
187 SCIP_VAR* var, /**< priced variable */
188 SCIP_Real score, /**< pricing score of variable (the larger, the better the variable) */
189 SCIP_Bool root /**< are we at the root node? */
190 )
191{
192 int maxpricevars;
193 int v;
194
195 assert(pricestore != NULL);
196 assert(set != NULL);
197 assert(var != NULL);
198
199#ifndef NDEBUG
200 /* check if we add this variables to the same scip, where we created it */
201 if( var->scip != set->scip )
202 {
203 SCIPerrorMessage("try to add a variable of another scip instance\n");
204 return SCIP_INVALIDDATA;
205 }
206#endif
207
208 SCIPsetDebugMsg(set, "adding variable <%s> (lb=%g, ub=%g) to pricing storage (initiallp=%u)\n",
209 SCIPvarGetName(var), SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var), pricestore->initiallp);
210
211 if( pricestore->initiallp )
212 maxpricevars = INT_MAX;
213 else
214 {
215 pricestore->nvarsfound++;
216 maxpricevars = SCIPsetGetPriceMaxvars(set, root);
217 }
218 assert(maxpricevars >= 1);
219 assert(pricestore->nvars <= maxpricevars);
220
221 /* check, if variable belongs to the best "maxpricevars" pricing variables */
222 if( pricestore->nvars < maxpricevars || score > pricestore->scores[maxpricevars-1] )
223 {
224 /* capture variable */
225 SCIPvarCapture(var);
226
227 /* if the array consists of "maxpricevars" variables, release the worst variables */
228 if( pricestore->nvars == maxpricevars )
229 {
230 SCIP_CALL( SCIPvarRelease(&pricestore->vars[pricestore->nvars-1], blkmem, set, eventqueue, lp) );
231 pricestore->nvars--;
232 }
233 assert(pricestore->nvars < maxpricevars);
234
235 /* get enough memory to store additional variable */
236 SCIP_CALL( pricestoreEnsureVarsMem(pricestore, set, pricestore->nvars+1) );
237 assert(pricestore->nvars <= pricestore->varssize);
238
239 /* insert the variable at the correct position in sorted arrays */
240 for( v = pricestore->nvars; v > 0 && score > pricestore->scores[v-1]; --v )
241 {
242 pricestore->vars[v] = pricestore->vars[v-1];
243 pricestore->scores[v] = pricestore->scores[v-1];
244 }
245 pricestore->vars[v] = var;
246 pricestore->scores[v] = score;
247 pricestore->nvars++;
248 }
249
250 return SCIP_OKAY;
251}
252
253/** adds variable where zero violates the bounds to pricing storage, capture it */
255 SCIP_PRICESTORE* pricestore, /**< pricing storage */
256 BMS_BLKMEM* blkmem, /**< block memory */
257 SCIP_SET* set, /**< global SCIP settings */
258 SCIP_STAT* stat, /**< problem statistics */
259 SCIP_LP* lp, /**< LP data */
260 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
261 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
262 SCIP_VAR* var /**< variable, where zero violates the bounds */
263 )
264{
265 assert(pricestore != NULL);
266 assert(set != NULL);
267 assert(var != NULL);
269 assert(pricestore->naddedbdviolvars <= pricestore->nbdviolvars);
270
271 SCIPsetDebugMsg(set, "zero violates bounds of <%s> (lb=%g, ub=%g)\n", SCIPvarGetName(var), SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var));
272
273 if( !pricestore->initiallp )
274 pricestore->nvarsfound++;
275
276 /* get enough memory to store additional variable */
277 SCIP_CALL( pricestoreEnsureBdviolvarsMem(pricestore, set, pricestore->nbdviolvars+1) );
278 assert(pricestore->nbdviolvars <= pricestore->bdviolvarssize);
279
280 /* capture variable */
281 SCIPvarCapture(var);
282
283 /* insert variable in bdviolvars arrays */
284 pricestore->bdviolvars[pricestore->nbdviolvars] = var;
285 pricestore->bdviolvarslb[pricestore->nbdviolvars] = SCIPvarGetLbLocal(var);
286 pricestore->bdviolvarsub[pricestore->nbdviolvars] = SCIPvarGetUbLocal(var);
287 pricestore->nbdviolvars++;
288
289 /* Temporarily set bounds, such that zero is feasible, because we don't want to destroy
290 * dual feasibility (by adding columns) and primal feasibility (by introducing violated bounds)
291 * at the same time.
292 * The correct bounds must be reset with a call to SCIPpricestoreResetBounds().
293 * The inference information is unimportant for this temporary bound change.
294 */
296 {
297 SCIP_CALL( SCIPvarChgLbLocal(var, blkmem, set, stat, lp, branchcand, eventqueue, 0.0) );
298 }
299 else
300 {
301 SCIP_CALL( SCIPvarChgUbLocal(var, blkmem, set, stat, lp, branchcand, eventqueue, 0.0) );
302 }
303
304 return SCIP_OKAY;
305}
306
307/** adds given problem variable to pricing storage, if zero is not best bound w.r.t. objective function */
308static
310 SCIP_PRICESTORE* pricestore, /**< pricing storage */
311 BMS_BLKMEM* blkmem, /**< block memory buffers */
312 SCIP_SET* set, /**< global SCIP settings */
313 SCIP_STAT* stat, /**< dynamic problem statistics */
314 SCIP_TREE* tree, /**< branch and bound tree */
315 SCIP_LP* lp, /**< LP data */
316 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
317 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
318 SCIP_VAR* var, /**< problem variable */
319 SCIP_Bool* added /**< pointer to store whether variable was added to pricing storage */
320 )
321{
322 assert(tree != NULL);
323 assert(added != NULL);
324
325 *added = FALSE;
326
327 /* add variable, if zero is not feasible within the bounds */
329 {
330 SCIPsetDebugMsg(set, " -> zero violates bounds of <%s> [%g,%g]\n", SCIPvarGetName(var), SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var));
331 SCIP_CALL( SCIPpricestoreAddBdviolvar(pricestore, blkmem, set, stat, lp, branchcand, eventqueue, var) );
332 *added = TRUE;
333 }
334 else
335 {
336 SCIP_Real bestbound;
337
338 /* add variable, if zero is not best bound w.r.t. objective function */
339 bestbound = SCIPvarGetBestBoundLocal(var);
340 if( !SCIPsetIsZero(set, bestbound) )
341 {
342 SCIPsetDebugMsg(set, " -> best bound of <%s> [%g,%g] is not zero but %g\n",
343 SCIPvarGetName(var), SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var), bestbound);
344 SCIP_CALL( SCIPpricestoreAddVar(pricestore, blkmem, set, eventqueue, lp, var,
345 -SCIPvarGetObj(var) * bestbound, (SCIPtreeGetCurrentDepth(tree) == 0)) );
346 *added = TRUE;
347 }
348 }
349
350 return SCIP_OKAY;
351}
352
353/** adds problem variables with negative reduced costs to pricing storage */
355 SCIP_PRICESTORE* pricestore, /**< pricing storage */
356 BMS_BLKMEM* blkmem, /**< block memory buffers */
357 SCIP_SET* set, /**< global SCIP settings */
358 SCIP_STAT* stat, /**< dynamic problem statistics */
359 SCIP_PROB* prob, /**< transformed problem after presolve */
360 SCIP_TREE* tree, /**< branch and bound tree */
361 SCIP_LP* lp, /**< LP data */
362 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
363 SCIP_EVENTQUEUE* eventqueue /**< event queue */
364 )
365{
366 SCIP_VAR* var;
367 SCIP_COL* col;
368 SCIP_Bool root;
369 SCIP_Bool added;
370 int v;
371 int abortpricevars;
372 int maxpricevars;
373 int nfoundvars;
374
375 assert(pricestore != NULL);
376 assert(set != NULL);
377 assert(stat != NULL);
378 assert(prob != NULL);
379 assert(lp != NULL);
380 assert(lp->solved);
381 assert(tree != NULL);
382 assert(SCIPtreeHasCurrentNodeLP(tree));
383 assert(prob->nvars >= SCIPlpGetNCols(lp));
384
385 /* if all problem variables of status COLUMN are already in the LP, nothing has to be done */
386 if( prob->ncolvars == SCIPlpGetNCols(lp) )
387 return SCIP_OKAY;
388
389 root = (SCIPtreeGetCurrentDepth(tree) == 0);
390 maxpricevars = SCIPsetGetPriceMaxvars(set, root);
391 assert(maxpricevars >= 1);
392 abortpricevars = (int)(set->price_abortfac * maxpricevars);
393 assert(abortpricevars >= maxpricevars);
394
395 /**@todo test pricing: is abortpricevars a good idea? -> like strong branching, lookahead, ... */
396
397 pricestore->nprobpricings++;
398
399 /* start timing */
400 SCIPclockStart(pricestore->probpricingtime, set);
401
402 /* price already existing problem variables */
403 nfoundvars = 0;
404 for( v = 0; v < prob->nvars && nfoundvars < abortpricevars; ++v )
405 {
406 var = prob->vars[v];
408 {
409 col = SCIPvarGetCol(var);
410 assert(col != NULL);
411 assert(col->var == var);
412 assert(col->len >= 0);
413 assert(col->lppos >= -1);
414 assert(col->lpipos >= -1);
415 assert(SCIPcolIsInLP(col) == (col->lpipos >= 0));
416
417 if( !SCIPcolIsInLP(col) )
418 {
419 SCIPsetDebugMsg(set, "price column variable <%s> in bounds [%g,%g]\n",
421
422 /* add variable to pricing storage, if zero is not best bound w.r.t. objective function */
423 SCIP_CALL( addBoundViolated(pricestore, blkmem, set, stat, tree, lp, branchcand, eventqueue, var, &added) );
424
425 if( added )
426 {
427 pricestore->nprobvarsfound++;
428 nfoundvars++;
429 }
430 else if( SCIPcolGetNNonz(col) > 0 )
431 {
432 SCIP_Real feasibility;
433
434 /* a column not in LP that doesn't have zero in its bounds was added by bound checking above */
437
439 {
440 /* The LP was proven infeasible, so we have an infeasibility proof by the dual Farkas multipliers y.
441 * The valid inequality y^T A x >= y^T b is violated by all x, especially by the (for this
442 * inequality most feasible solution) x' defined by
443 * x'_i = ub_i, if y^T A_i > 0
444 * x'_i = lb_i, if y^T A_i <= 0.
445 * Pricing in this case means to add variables i with positive Farkas value, i.e. y^T A_i x'_i > 0
446 */
447 feasibility = -SCIPcolGetFarkasValue(col, stat, lp);
448 SCIPsetDebugMsg(set, " <%s> Farkas feasibility: %e\n", SCIPvarGetName(col->var), feasibility);
449 }
450 else
451 {
452 /* The dual LP is feasible, and we have a feasible dual solution. Pricing in this case means to
453 * add variables with negative feasibility, that is
454 * - positive reduced costs for variables with negative lower bound
455 * - negative reduced costs for variables with positive upper bound
456 */
457 feasibility = SCIPcolGetFeasibility(col, set, stat, lp);
458 SCIPsetDebugMsg(set, " <%s> reduced cost feasibility: %e\n", SCIPvarGetName(col->var), feasibility);
459 }
460
461 /* add variable if feasibility is negative, i.e., the reduced costs are negative */
462 if( !SCIPsetIsPositive(set, feasibility) )
463 {
464 SCIP_CALL( SCIPpricestoreAddVar(pricestore, blkmem, set, eventqueue, lp, var, -feasibility / (col->len+1), root) );
465 pricestore->nprobvarsfound++;
466 nfoundvars++;
467 }
468 }
469 }
470 }
471 }
472
473 /* stop timing */
474 SCIPclockStop(pricestore->probpricingtime, set);
475
476 return SCIP_OKAY;
477}
478
479/** adds priced variables to the LP */
481 SCIP_PRICESTORE* pricestore, /**< pricing storage */
482 BMS_BLKMEM* blkmem, /**< block memory buffers */
483 SCIP_SET* set, /**< global SCIP settings */
484 SCIP_STAT* stat, /**< dynamic problem statistics */
485 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
486 SCIP_PROB* prob, /**< transformed problem after presolve */
487 SCIP_TREE* tree, /**< branch and bound tree */
488 SCIP_LP* lp /**< LP data */
489 )
490{
491 SCIP_VAR* var;
492 SCIP_COL* col;
493 int v;
494
495 assert(pricestore != NULL);
496 assert(pricestore->naddedbdviolvars <= pricestore->nbdviolvars);
497 assert(set != NULL);
498 assert(prob != NULL);
499 assert(lp != NULL);
500 assert(tree != NULL);
502
503 SCIPsetDebugMsg(set, "adding %d variables (%d bound violated and %d priced vars) to %d LP columns\n",
504 SCIPpricestoreGetNVars(pricestore), pricestore->nbdviolvars - pricestore->naddedbdviolvars,
505 pricestore->nvars, SCIPlpGetNCols(lp));
506
507 /* add the variables with violated bounds to LP */
508 for( v = pricestore->naddedbdviolvars; v < pricestore->nbdviolvars; ++v )
509 {
510 var = pricestore->bdviolvars[v];
512 assert(SCIPvarGetProbindex(var) >= 0);
513 assert(var->nuses >= 2); /* at least used in pricing storage and in problem */
514
516 {
517 /* transform loose variable into column variable */
518 SCIP_CALL( SCIPvarColumn(var, blkmem, set, stat, prob, lp) );
519 SCIP_CALL( SCIPvarColumnExact(var, blkmem, set, stat, lp->lpexact) );
520 }
521
523
524 col = SCIPvarGetCol(var);
525 assert(col != NULL);
526 assert(col->lppos == -1);
527 SCIPsetDebugMsg(set, "adding bound violated variable <%s> (lb=%g, ub=%g)\n", SCIPvarGetName(var),
528 pricestore->bdviolvarslb[v], pricestore->bdviolvarsub[v]);
530
531 SCIP_CALL( SCIPlpExactAddCol(lp->lpexact, set, set->exact_enable ? var->exactdata->colexact : NULL) );
532
533 if( !pricestore->initiallp )
534 pricestore->nvarsapplied++;
535 }
536 pricestore->naddedbdviolvars = pricestore->nbdviolvars;
537
538 /* add the selected pricing variables to LP */
539 for( v = 0; v < pricestore->nvars; ++v )
540 {
541 var = pricestore->vars[v];
543 assert(SCIPvarGetProbindex(var) >= 0);
544 assert(var->nuses >= 2); /* at least used in pricing storage and in problem */
545
546 /* transform variable into column variable, if needed */
548 {
549 /* transform loose variable into column variable */
550 SCIP_CALL( SCIPvarColumn(var, blkmem, set, stat, prob, lp) );
551 SCIP_CALL( SCIPvarColumnExact(var, blkmem, set, stat, lp->lpexact) );
552 }
554
555 col = SCIPvarGetCol(var);
556 assert(col != NULL);
557 assert(col->lppos == -1);
558 SCIPsetDebugMsg(set, "adding priced variable <%s> (score=%g)\n", SCIPvarGetName(var), pricestore->scores[v]);
560
561 SCIP_CALL( SCIPlpExactAddCol(lp->lpexact, set, set->exact_enable ? var->exactdata->colexact : NULL) );
562
563 /* release the variable */
564 SCIP_CALL( SCIPvarRelease(&pricestore->vars[v], blkmem, set, eventqueue, lp) );
565
566 if( !pricestore->initiallp )
567 pricestore->nvarsapplied++;
568 }
569
570 /* clear the pricing storage */
571 pricestore->nvars = 0;
572
573 return SCIP_OKAY;
574}
575
576/** reset variables' bounds violated by zero to its original value */
578 SCIP_PRICESTORE* pricestore, /**< pricing storage */
579 BMS_BLKMEM* blkmem, /**< block memory */
580 SCIP_SET* set, /**< global SCIP settings */
581 SCIP_STAT* stat, /**< problem statistics */
582 SCIP_LP* lp, /**< LP data */
583 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
584 SCIP_EVENTQUEUE* eventqueue /**< event queue */
585 )
586{
587 SCIP_VAR* var;
588 int v;
589
590 assert(pricestore != NULL);
591 assert(set != NULL);
592 assert(lp != NULL);
593 assert(pricestore->nvars == 0);
594 assert(pricestore->naddedbdviolvars == pricestore->nbdviolvars);
595
596 /* reset variables' bounds, release them, and clear the boundviolation storage;
597 * the inference information is unimportant in these removals of temporary bound changes
598 */
599 for( v = 0; v < pricestore->nbdviolvars; ++v )
600 {
601 var = pricestore->bdviolvars[v];
602 assert(var != NULL);
603
604 SCIPsetDebugMsg(set, "resetting bounds of <%s> from [%g,%g] to [%g,%g]\n", var->name,
605 SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var), pricestore->bdviolvarslb[v], pricestore->bdviolvarsub[v]);
606 SCIP_CALL( SCIPvarChgLbLocal(var, blkmem, set, stat, lp, branchcand, eventqueue, pricestore->bdviolvarslb[v]) );
607 SCIP_CALL( SCIPvarChgUbLocal(var, blkmem, set, stat, lp, branchcand, eventqueue, pricestore->bdviolvarsub[v]) );
608 SCIP_CALL( SCIPvarRelease(&pricestore->bdviolvars[v], blkmem, set, eventqueue, lp) );
609 }
610 pricestore->naddedbdviolvars = 0;
611 pricestore->nbdviolvars = 0;
612
613 return SCIP_OKAY;
614}
615
616/** gets number of variables in pricing storage */
618 SCIP_PRICESTORE* pricestore /**< pricing storage */
619 )
620{
621 assert(pricestore != NULL);
622 assert(pricestore->nbdviolvars >= pricestore->naddedbdviolvars);
623
624 return pricestore->nvars + pricestore->nbdviolvars - pricestore->naddedbdviolvars;
625}
626
627/** gets number of variables in pricing storage whose bounds must be reset */
629 SCIP_PRICESTORE* pricestore /**< pricing storage */
630 )
631{
632 assert(pricestore != NULL);
633 assert(pricestore->nbdviolvars >= pricestore->naddedbdviolvars);
634
635 return pricestore->nbdviolvars - pricestore->naddedbdviolvars;
636}
637
638/** gets time needed to price existing problem variables */
640 SCIP_PRICESTORE* pricestore /**< pricing storage */
641 )
642{
643 assert(pricestore != NULL);
644
645 return SCIPclockGetTime(pricestore->probpricingtime);
646}
647
648/** gets total number of calls to problem variable pricing */
650 SCIP_PRICESTORE* pricestore /**< pricing storage */
651 )
652{
653 assert(pricestore != NULL);
654
655 return pricestore->nprobpricings;
656}
657
658/** gets total number of times, a problem variable was priced in */
660 SCIP_PRICESTORE* pricestore /**< pricing storage */
661 )
662{
663 assert(pricestore != NULL);
664
665 return pricestore->nprobvarsfound;
666}
667
668/** get total number of variables found so far in pricing */
670 SCIP_PRICESTORE* pricestore /**< pricing storage */
671 )
672{
673 assert(pricestore != NULL);
674
675 return pricestore->nvarsfound;
676}
677
678/** get total number of variables priced into the LP so far */
680 SCIP_PRICESTORE* pricestore /**< pricing storage */
681 )
682{
683 assert(pricestore != NULL);
684
685 return pricestore->nvarsapplied;
686}
void SCIPclockStop(SCIP_CLOCK *clck, SCIP_SET *set)
Definition: clock.c:360
void SCIPclockStart(SCIP_CLOCK *clck, SCIP_SET *set)
Definition: clock.c:290
SCIP_Real SCIPclockGetTime(SCIP_CLOCK *clck)
Definition: clock.c:438
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
#define NULL
Definition: def.h:248
#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
int SCIPcolGetNNonz(SCIP_COL *col)
Definition: lp.c:17520
SCIP_Bool SCIPcolIsInLP(SCIP_COL *col)
Definition: lp.c:17509
SCIP_COL * SCIPvarGetCol(SCIP_VAR *var)
Definition: var.c:23683
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
Definition: var.c:23386
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
Definition: var.c:24268
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
Definition: var.c:23900
int SCIPvarGetProbindex(SCIP_VAR *var)
Definition: var.c:23662
const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:23267
SCIP_Real SCIPvarGetBestBoundLocal(SCIP_VAR *var)
Definition: var.c:24312
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
Definition: var.c:24234
SCIP_RETCODE SCIPlpAddCol(SCIP_LP *lp, SCIP_SET *set, SCIP_COL *col, int depth)
Definition: lp.c:9699
SCIP_LPSOLSTAT SCIPlpGetSolstat(SCIP_LP *lp)
Definition: lp.c:13420
SCIP_Real SCIPcolGetFeasibility(SCIP_COL *col, SCIP_SET *set, SCIP_STAT *stat, SCIP_LP *lp)
Definition: lp.c:4171
SCIP_Real SCIPcolGetFarkasValue(SCIP_COL *col, SCIP_STAT *stat, SCIP_LP *lp)
Definition: lp.c:4356
int SCIPlpGetNCols(SCIP_LP *lp)
Definition: lp.c:17979
internal methods for LP management
SCIP_RETCODE SCIPlpExactAddCol(SCIP_LPEXACT *lpexact, SCIP_SET *set, SCIP_COLEXACT *col)
Definition: lpexact.c:4089
internal methods for exact LP management
#define BMSfreeMemory(ptr)
Definition: memory.h:145
#define BMSreallocMemoryArray(ptr, num)
Definition: memory.h:127
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:437
#define BMSfreeMemoryArrayNull(ptr)
Definition: memory.h:148
#define BMSallocMemory(ptr)
Definition: memory.h:118
void SCIPpricestoreStartInitialLP(SCIP_PRICESTORE *pricestore)
Definition: pricestore.c:157
SCIP_RETCODE SCIPpricestoreApplyVars(SCIP_PRICESTORE *pricestore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_LP *lp)
Definition: pricestore.c:480
int SCIPpricestoreGetNVars(SCIP_PRICESTORE *pricestore)
Definition: pricestore.c:617
SCIP_RETCODE SCIPpricestoreAddProbVars(SCIP_PRICESTORE *pricestore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue)
Definition: pricestore.c:354
SCIP_RETCODE SCIPpricestoreAddVar(SCIP_PRICESTORE *pricestore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp, SCIP_VAR *var, SCIP_Real score, SCIP_Bool root)
Definition: pricestore.c:181
static SCIP_RETCODE addBoundViolated(SCIP_PRICESTORE *pricestore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_VAR *var, SCIP_Bool *added)
Definition: pricestore.c:309
int SCIPpricestoreGetNVarsApplied(SCIP_PRICESTORE *pricestore)
Definition: pricestore.c:679
SCIP_RETCODE SCIPpricestoreCreate(SCIP_PRICESTORE **pricestore)
Definition: pricestore.c:107
int SCIPpricestoreGetNBoundResets(SCIP_PRICESTORE *pricestore)
Definition: pricestore.c:628
SCIP_Real SCIPpricestoreGetProbPricingTime(SCIP_PRICESTORE *pricestore)
Definition: pricestore.c:639
SCIP_RETCODE SCIPpricestoreAddBdviolvar(SCIP_PRICESTORE *pricestore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_VAR *var)
Definition: pricestore.c:254
SCIP_RETCODE SCIPpricestoreFree(SCIP_PRICESTORE **pricestore)
Definition: pricestore.c:136
static SCIP_RETCODE pricestoreEnsureVarsMem(SCIP_PRICESTORE *pricestore, SCIP_SET *set, int num)
Definition: pricestore.c:56
static SCIP_RETCODE pricestoreEnsureBdviolvarsMem(SCIP_PRICESTORE *pricestore, SCIP_SET *set, int num)
Definition: pricestore.c:81
int SCIPpricestoreGetNVarsFound(SCIP_PRICESTORE *pricestore)
Definition: pricestore.c:669
int SCIPpricestoreGetNProbvarsFound(SCIP_PRICESTORE *pricestore)
Definition: pricestore.c:659
void SCIPpricestoreEndInitialLP(SCIP_PRICESTORE *pricestore)
Definition: pricestore.c:169
SCIP_RETCODE SCIPpricestoreResetBounds(SCIP_PRICESTORE *pricestore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue)
Definition: pricestore.c:577
int SCIPpricestoreGetNProbPricings(SCIP_PRICESTORE *pricestore)
Definition: pricestore.c:649
internal methods for storing priced variables
public methods for LP management
public methods for message output
#define SCIPerrorMessage
Definition: pub_message.h:64
public methods for problem variables
SCIP_Bool SCIPsetIsPositive(SCIP_SET *set, SCIP_Real val)
Definition: set.c:6648
SCIP_Bool SCIPsetIsZero(SCIP_SET *set, SCIP_Real val)
Definition: set.c:6637
int SCIPsetGetPriceMaxvars(SCIP_SET *set, SCIP_Bool root)
Definition: set.c:6205
int SCIPsetCalcMemGrowSize(SCIP_SET *set, int num)
Definition: set.c:6080
SCIP_Bool SCIPsetIsNegative(SCIP_SET *set, SCIP_Real val)
Definition: set.c:6659
internal methods for global SCIP settings
#define SCIPsetDebugMsg
Definition: set.h:1811
int len
Definition: struct_lp.h:171
int lppos
Definition: struct_lp.h:174
int lpipos
Definition: struct_lp.h:175
SCIP_VAR * var
Definition: struct_lp.h:162
SCIP_LPEXACT * lpexact
Definition: struct_lp.h:309
SCIP_Bool solved
Definition: struct_lp.h:373
SCIP_Real * bdviolvarslb
SCIP_Real * bdviolvarsub
SCIP_CLOCK * probpricingtime
SCIP_VAR ** bdviolvars
SCIP_Real * scores
int ncolvars
Definition: struct_prob.h:81
SCIP_VAR ** vars
Definition: struct_prob.h:67
SCIP_COLEXACT * colexact
Definition: struct_var.h:255
SCIP * scip
Definition: struct_var.h:345
char * name
Definition: struct_var.h:291
SCIP_VARDATAEXACT * exactdata
Definition: struct_var.h:290
int nuses
Definition: struct_var.h:318
data structures for LP management
data structures for storing priced variables
datastructures for storing and manipulating the main problem
datastructures for global SCIP settings
datastructures for problem variables
Definition: heur_padm.c:135
SCIP_Bool SCIPtreeIsFocusNodeLPConstructed(SCIP_TREE *tree)
Definition: tree.c:9442
SCIP_Bool SCIPtreeHasCurrentNodeLP(SCIP_TREE *tree)
Definition: tree.c:9496
int SCIPtreeGetCurrentDepth(SCIP_TREE *tree)
Definition: tree.c:9479
internal methods for branch and bound tree
@ SCIP_CLOCKTYPE_DEFAULT
Definition: type_clock.h:43
@ SCIP_LPSOLSTAT_INFEASIBLE
Definition: type_lp.h:45
@ SCIP_INVALIDDATA
Definition: type_retcode.h:52
@ SCIP_OKAY
Definition: type_retcode.h:42
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
@ SCIP_VARSTATUS_COLUMN
Definition: type_var.h:53
@ SCIP_VARSTATUS_LOOSE
Definition: type_var.h:52
SCIP_RETCODE SCIPvarRelease(SCIP_VAR **var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp)
Definition: var.c:3787
SCIP_RETCODE SCIPvarColumnExact(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_LPEXACT *lp)
Definition: var.c:4646
void SCIPvarCapture(SCIP_VAR *var)
Definition: var.c:3762
SCIP_RETCODE SCIPvarColumn(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_LP *lp)
Definition: var.c:4612
SCIP_RETCODE SCIPvarChgLbLocal(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_Real newbound)
Definition: var.c:12715
SCIP_RETCODE SCIPvarChgUbLocal(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_Real newbound)
Definition: var.c:12983
internal methods for problem variables