Scippy

SCIP

Solving Constraint Integer Programs

prop_redcost.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-2015 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file prop_redcost.c
17  * @brief propagator using the LP reduced cost and the cutoff bound
18  * @author Tobias Achterberg
19  * @author Stefan Heinz
20  * @author Matthias Miltenberger
21  * @author Michael Winkler
22  *
23  * This propagator uses the reduced cost of an optimal solved LP relaxation to propagate the variables against the
24  * cutoff bound.
25  */
26 
27 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
28 
29 #include <assert.h>
30 #include <string.h>
31 
32 #include "scip/prop_redcost.h"
33 
34 
35 /**@name Propagator properties
36  *
37  * @{
38  */
39 
40 #define PROP_NAME "redcost"
41 #define PROP_DESC "reduced cost strengthening propagator"
42 #define PROP_TIMING SCIP_PROPTIMING_DURINGLPLOOP | SCIP_PROPTIMING_AFTERLPLOOP
43 #define PROP_PRIORITY +1000000 /**< propagator priority */
44 #define PROP_FREQ 1 /**< propagator frequency */
45 #define PROP_DELAY FALSE /**< should propagation method be delayed, if other propagators found reductions? */
46 
47 /**@} */
48 
49 
50 /**@name Default parameter values
51  *
52  * @{
53  */
54 
55 #define DEFAULT_CONTINUOUS FALSE /**< should reduced cost fixing be also applied to continuous variables? */
56 #define DEFAULT_USEIMPLICS TRUE /**< should implications be used to strength the reduced cost for binary variables? */
57 
58 /**@} */
59 
60 
61 /*
62  * Data structures
63  */
64 
65 
66 /** propagator data */
67 struct SCIP_PropData
68 {
69  SCIP_Bool continuous; /**< should reduced cost fixing be also applied to continuous variables? */
70  SCIP_Real maxredcost; /**< maximum reduced cost of a single binary variable */
71  SCIP_Bool usefullimplics; /**< are the implied reduced cost usefull */
72  SCIP_Bool useimplics; /**< should implications be used to strength the reduced cost for binary variables? */
73 };
74 
75 
76 /**@name Local methods
77  *
78  * @{
79  */
80 
81 /** propagate the given binary variable/column using the root reduced cost stored in the SCIP internal data structers
82  * and check if the implictions can be useful. Deppending on that implictions are used or not used during the search to
83  * strength the reduced costs.
84  */
85 static
87  SCIP* scip, /**< SCIP data structure */
88  SCIP_PROPDATA* propdata, /**< propagator data structure */
89  SCIP_VAR* var, /**< variable to use for propagation */
90  SCIP_COL* col, /**< LP column of the variable */
91  SCIP_Real cutoffbound, /**< the current cutoff bound */
92  int* nchgbds /**< pointer to count the number of bound changes */
93  )
94 {
95  SCIP_Real rootredcost;
96  SCIP_Real rootsol;
97  SCIP_Real rootlpobjval;
98 
99  assert(SCIPgetDepth(scip) == 0);
100 
101  /* skip binary variable if it is locally fixed */
102  if( SCIPvarGetLbLocal(var) > 0.5 || SCIPvarGetUbLocal(var) < 0.5 )
103  return SCIP_OKAY;
104 
105  rootredcost = SCIPvarGetBestRootRedcost(var);
106  rootsol = SCIPvarGetBestRootSol(var);
107  rootlpobjval = SCIPvarGetBestRootLPObjval(var);
108 
109  if( SCIPisDualfeasZero(scip, rootredcost) )
110  return SCIP_OKAY;
111 
112  assert(rootlpobjval != SCIP_INVALID); /*lint !e777*/
113 
114  if( rootsol > 0.5 )
115  {
116  assert(!SCIPisDualfeasPositive(scip, rootredcost));
117 
118  /* update maximum reduced cost of a single binary variable */
119  propdata->maxredcost = MAX(propdata->maxredcost, -rootredcost);
120 
121  if( rootlpobjval - rootredcost > cutoffbound )
122  {
123  SCIPdebugMessage("globally fix binary variable <%s> to 1.0\n", SCIPvarGetName(var));
124 
125  SCIP_CALL( SCIPchgVarLb(scip, var, 1.0) );
126  (*nchgbds)++;
127  return SCIP_OKAY;
128  }
129  }
130  else
131  {
132  assert(!SCIPisDualfeasNegative(scip, rootredcost));
133 
134  /* update maximum reduced cost of a single binary variable */
135  propdata->maxredcost = MAX(propdata->maxredcost, rootredcost);
136 
137  if( rootlpobjval + rootredcost > cutoffbound )
138  {
139  SCIPdebugMessage("globally fix binary variable <%s> to 0.0\n", SCIPvarGetName(var));
140 
141  SCIP_CALL( SCIPchgVarUb(scip, var, 0.0) );
142  (*nchgbds)++;
143  return SCIP_OKAY;
144  }
145  }
146 
147  /* evaluate if the implications are useful; the implications are seen to be useful if they provide an increase for
148  * the root reduced costs
149  */
150  if( !propdata->usefullimplics )
151  {
152  SCIP_Real lbredcost;
153  SCIP_Real ubredcost;
154 
155  lbredcost = SCIPgetVarImplRedcost(scip, var, FALSE);
156  assert(!SCIPisDualfeasPositive(scip, lbredcost));
157 
158  ubredcost = SCIPgetVarImplRedcost(scip, var, TRUE);
159  assert(!SCIPisDualfeasNegative(scip, ubredcost));
160 
161  switch( SCIPcolGetBasisStatus(col) )
162  {
163  case SCIP_BASESTAT_LOWER:
164  ubredcost -= SCIPgetVarRedcost(scip, var);
165  assert(!SCIPisDualfeasNegative(scip, ubredcost));
166  break;
167 
168  case SCIP_BASESTAT_UPPER:
169  lbredcost -= SCIPgetVarRedcost(scip, var);
170  assert(!SCIPisDualfeasPositive(scip, lbredcost));
171  break;
172 
173  case SCIP_BASESTAT_BASIC:
174  case SCIP_BASESTAT_ZERO:
175  default:
176  break;
177  }
178 
179  propdata->usefullimplics = (lbredcost < 0.0) || (ubredcost > 0.0);
180  }
181 
182  return SCIP_OKAY;
183 }
184 
185 /** propagate the given binary variable/column using the reduced cost */
186 static
188  SCIP* scip, /**< SCIP data structure */
189  SCIP_PROPDATA* propdata, /**< propagator data structure */
190  SCIP_VAR* var, /**< variable to use for propagation */
191  SCIP_COL* col, /**< LP column of the variable */
192  SCIP_Real requiredredcost, /**< required reduset cost to be able to fix a binary variable */
193  int* nchgbds, /**< pointer to count the number of bound changes */
194  SCIP_Bool* cutoff /**< pointer to store if an cutoff was detected */
195  )
196 {
197  SCIP_Real lbredcost;
198  SCIP_Real ubredcost;
199  SCIP_Real redcost;
200 
201  /* skip binary variable if it is locally fixed */
202  if( SCIPvarGetLbLocal(var) > 0.5 || SCIPvarGetUbLocal(var) < 0.5 )
203  return SCIP_OKAY;
204 
205  /* first use the redcost cost to fix the binary variable */
206  switch( SCIPcolGetBasisStatus(col) )
207  {
208  case SCIP_BASESTAT_LOWER:
209  redcost = SCIPgetVarRedcost(scip, var);
210  assert(!SCIPisDualfeasNegative(scip, redcost));
211 
212  if( redcost > requiredredcost )
213  {
214  SCIPdebugMessage("variable <%s>: fixed 0.0 (requiredredcost <%g>, redcost <%g>)\n",
215  SCIPvarGetName(var), requiredredcost, redcost);
216 
217  SCIP_CALL( SCIPchgVarUb(scip, var, 0.0) );
218  (*nchgbds)++;
219  return SCIP_OKAY;
220  }
221  break;
222 
223  case SCIP_BASESTAT_UPPER:
224  redcost = SCIPgetVarRedcost(scip, var);
225  assert(!SCIPisDualfeasPositive(scip, redcost));
226 
227  if( -redcost > requiredredcost )
228  {
229  SCIPdebugMessage("variable <%s>: fixed 1.0 (requiredredcost <%g>, redcost <%g>)\n",
230  SCIPvarGetName(var), requiredredcost, redcost);
231 
232  SCIP_CALL( SCIPchgVarLb(scip, var, 1.0) );
233  (*nchgbds)++;
234  return SCIP_OKAY;
235  }
236  break;
237 
238  case SCIP_BASESTAT_BASIC:
239  return SCIP_OKAY;
240 
241  case SCIP_BASESTAT_ZERO:
242  assert(SCIPisDualfeasZero(scip, SCIPgetColRedcost(scip, col)));
243  return SCIP_OKAY;
244 
245  default:
246  SCIPerrorMessage("invalid basis state\n");
247  return SCIP_INVALIDDATA;
248  }
249 
250  /* second, if the implications should be used and if the implications are seen to be promising used the implied
251  * reduced costs to fix the binary variable
252  */
253  if( propdata->useimplics && propdata->usefullimplics )
254  {
255  /* collect implied reduced costs if the variable would be fixed to its lower bound */
256  lbredcost = SCIPgetVarImplRedcost(scip, var, FALSE);
257  assert(!SCIPisDualfeasPositive(scip, lbredcost) || SCIPisFeasEQ(scip, SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var)) );
258 
259  /* collect implied reduced costs if the variable would be fixed to its upper bound */
260  ubredcost = SCIPgetVarImplRedcost(scip, var, TRUE);
261  assert(!SCIPisDualfeasNegative(scip, ubredcost) || SCIPisFeasEQ(scip, SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var)) );
262 
263  if( -lbredcost > requiredredcost && ubredcost > requiredredcost )
264  {
265  SCIPdebugMessage("variable <%s>: cutoff (requiredredcost <%g>, lbredcost <%g>, ubredcost <%g>)\n",
266  SCIPvarGetName(var), requiredredcost, lbredcost, ubredcost);
267 
268  (*cutoff) = TRUE;
269  }
270  else if( -lbredcost > requiredredcost )
271  {
272  SCIPdebugMessage("variable <%s>: fixed 1.0 (requiredredcost <%g>, redcost <%g>, lbredcost <%g>)\n",
273  SCIPvarGetName(var), requiredredcost, redcost, lbredcost);
274 
275  SCIP_CALL( SCIPchgVarLb(scip, var, 1.0) );
276  (*nchgbds)++;
277  }
278  else if( ubredcost > requiredredcost )
279  {
280  SCIPdebugMessage("variable <%s>: fixed 0.0 (requiredredcost <%g>, redcost <%g>, ubredcost <%g>)\n",
281  SCIPvarGetName(var), requiredredcost, redcost, ubredcost);
282 
283  SCIP_CALL( SCIPchgVarUb(scip, var, 0.0) );
284  (*nchgbds)++;
285  }
286 
287  /* update maximum reduced cost of a single binary variable */
288  propdata->maxredcost = MAX3(propdata->maxredcost, -lbredcost, ubredcost);
289  }
290 
291  return SCIP_OKAY;
292 }
293 
294 /** propagate the given none binary variable/column using the reduced cost */
295 static
297  SCIP* scip, /**< SCIP data structure */
298  SCIP_VAR* var, /**< variable to use for propagation */
299  SCIP_COL* col, /**< LP column of the variable */
300  SCIP_Real lpobjval, /**< objective value of the current LP */
301  SCIP_Real cutoffbound, /**< the current cutoff bound */
302  int* nchgbds /**< pointer to count the number of bound changes */
303  )
304 {
305  SCIP_Real redcost;
306 
307  switch( SCIPcolGetBasisStatus(col) )
308  {
309  case SCIP_BASESTAT_LOWER:
310  redcost = SCIPgetColRedcost(scip, col);
311 
312  assert(!SCIPisDualfeasNegative(scip, redcost) || SCIPisFeasEQ(scip, SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var)) );
313  if( SCIPisDualfeasPositive(scip, redcost) )
314  {
315  SCIP_Real oldlb;
316  SCIP_Real oldub;
317 
318  oldlb = SCIPvarGetLbLocal(var);
319  oldub = SCIPvarGetUbLocal(var);
320  assert(SCIPisEQ(scip, oldlb, SCIPcolGetLb(col)));
321  assert(SCIPisEQ(scip, oldub, SCIPcolGetUb(col)));
322 
323  if( SCIPisFeasLT(scip, oldlb, oldub) )
324  {
325  SCIP_Real newub;
326  SCIP_Bool strengthen;
327 
328  /* calculate reduced cost based bound */
329  newub = (cutoffbound - lpobjval) / redcost + oldlb;
330 
331  /* check, if new bound is good enough:
332  * - integer variables: take all possible strengthenings
333  * - continuous variables: strengthening must cut part of the variable's dynamic range, and
334  * at least 20% of the current domain
335  */
336  if( SCIPvarIsIntegral(var) )
337  {
338  newub = SCIPadjustedVarUb(scip, var, newub);
339  strengthen = (newub < oldub - 0.5);
340  }
341  else
342  strengthen = (newub < SCIPcolGetMaxPrimsol(col) && newub <= 0.2 * oldlb + 0.8 * oldub);
343 
344  if( strengthen )
345  {
346  /* strengthen upper bound */
347  SCIPdebugMessage("redcost strengthening upper bound: <%s> [%g,%g] -> [%g,%g] (ub=%g, lb=%g, redcost=%g)\n",
348  SCIPvarGetName(var), oldlb, oldub, oldlb, newub, cutoffbound, lpobjval, redcost);
349  SCIP_CALL( SCIPchgVarUb(scip, var, newub) );
350  (*nchgbds)++;
351  }
352  }
353  }
354  break;
355 
356  case SCIP_BASESTAT_BASIC:
357  break;
358 
359  case SCIP_BASESTAT_UPPER:
360  redcost = SCIPgetColRedcost(scip, col);
361 
362  assert(!SCIPisDualfeasPositive(scip, redcost) || SCIPisFeasEQ(scip, SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var)) );
363  if( SCIPisDualfeasNegative(scip, redcost) )
364  {
365  SCIP_Real oldlb;
366  SCIP_Real oldub;
367 
368  oldlb = SCIPvarGetLbLocal(var);
369  oldub = SCIPvarGetUbLocal(var);
370  assert(SCIPisEQ(scip, oldlb, SCIPcolGetLb(col)));
371  assert(SCIPisEQ(scip, oldub, SCIPcolGetUb(col)));
372 
373  if( SCIPisFeasLT(scip, oldlb, oldub) )
374  {
375  SCIP_Real newlb;
376  SCIP_Bool strengthen;
377 
378  /* calculate reduced cost based bound */
379  newlb = (cutoffbound - lpobjval) / redcost + oldub;
380 
381  /* check, if new bound is good enough:
382  * - integer variables: take all possible strengthenings
383  * - continuous variables: strengthening must cut part of the variable's dynamic range, and
384  * at least 20% of the current domain
385  */
386  if( SCIPvarIsIntegral(var) )
387  {
388  newlb = SCIPadjustedVarLb(scip, var, newlb);
389  strengthen = (newlb > oldlb + 0.5);
390  }
391  else
392  strengthen = (newlb > SCIPcolGetMinPrimsol(col) && newlb >= 0.8 * oldlb + 0.2 * oldub);
393 
394  /* check, if new bound is good enough: at least 20% strengthening for continuous variables */
395  if( strengthen )
396  {
397  /* strengthen lower bound */
398  SCIPdebugMessage("redcost strengthening lower bound: <%s> [%g,%g] -> [%g,%g] (ub=%g, lb=%g, redcost=%g)\n",
399  SCIPvarGetName(var), oldlb, oldub, newlb, oldub, cutoffbound, lpobjval, redcost);
400  SCIP_CALL( SCIPchgVarLb(scip, var, newlb) );
401  (*nchgbds)++;
402  }
403  }
404  }
405  break;
406 
407  case SCIP_BASESTAT_ZERO:
408  assert(SCIPisDualfeasZero(scip, SCIPgetColRedcost(scip, col)));
409  break;
410 
411  default:
412  SCIPerrorMessage("invalid basis state\n");
413  return SCIP_INVALIDDATA;
414  }
415 
416  return SCIP_OKAY;
417 }
418 
419 /**@} */
420 
421 /**@name Callback methods of propagator
422  *
423  * @{
424  */
425 
426 /** copy method for propagator plugins (called when SCIP copies plugins) */
427 static
428 SCIP_DECL_PROPCOPY(propCopyRedcost)
429 { /*lint --e{715}*/
430  assert(scip != NULL);
431  assert(prop != NULL);
432  assert(strcmp(SCIPpropGetName(prop), PROP_NAME) == 0);
433 
434  /* call inclusion method of constraint handler */
436 
437  return SCIP_OKAY;
438 }
439 
440 /** destructor of propagator to free user data (called when SCIP is exiting) */
441 static
442 SCIP_DECL_PROPFREE(propFreeRedcost)
443 { /*lint --e{715}*/
444  SCIP_PROPDATA* propdata;
445 
446  /* free propagator data */
447  propdata = SCIPpropGetData(prop);
448  assert(propdata != NULL);
449 
450  SCIPfreeMemory(scip, &propdata);
451 
452  SCIPpropSetData(prop, NULL);
453 
454  return SCIP_OKAY;
455 }
456 
457 /** solving process initialization method of propagator (called when branch and bound process is about to begin) */
458 static
459 SCIP_DECL_PROPINITSOL(propInitsolRedcost)
460 {
461  SCIP_PROPDATA* propdata;
462 
463  propdata = SCIPpropGetData(prop);
464  assert(propdata != NULL);
465 
466  propdata->usefullimplics = FALSE;
467  propdata->maxredcost = 0.0;
468 
469  return SCIP_OKAY;
470 }
471 
472 /** reduced cost propagation method for an LP solution */
473 static
474 SCIP_DECL_PROPEXEC(propExecRedcost)
475 { /*lint --e{715}*/
476  SCIP_PROPDATA* propdata;
477  SCIP_COL** cols;
478  SCIP_Real requiredredcost;
479  SCIP_Real cutoffbound;
480  SCIP_Real lpobjval;
481  SCIP_Bool propbinvars;
482  SCIP_Bool cutoff;
483  int nchgbds;
484  int ncols;
485  int c;
486 
487  *result = SCIP_DIDNOTRUN;
488 
489  /* in case we have a zero objective function, we skip the reduced cost propagator */
490  if( SCIPgetNObjVars(scip) == 0 )
491  return SCIP_OKAY;
492 
493  /* propagator can only be applied during solving stage */
494  if( SCIPgetStage(scip) < SCIP_STAGE_SOLVING )
495  return SCIP_OKAY;
496 
497  /* we cannot apply reduced cost fixing, if we want to solve exactly */
498  /**@todo implement reduced cost fixing with interval arithmetics */
499  if( SCIPisExactSolve(scip) )
500  return SCIP_OKAY;
501 
502  /* only call propagator, if the current node has an LP */
503  if( !SCIPhasCurrentNodeLP(scip) )
504  return SCIP_OKAY;
505 
506  /* only call propagator, if an optimal LP solution is at hand */
508  return SCIP_OKAY;
509 
510  /* only call propagator, if the current LP is a valid relaxation */
511  if( !SCIPisLPRelax(scip) )
512  return SCIP_OKAY;
513 
514  /* we cannot apply reduced cost strengthening, if no simplex basis is available */
515  if( !SCIPisLPSolBasic(scip) )
516  return SCIP_OKAY;
517 
518  /* do not run if propagation w.r.t. objective is not allowed */
519  if( !SCIPallowObjProp(scip) )
520  return SCIP_OKAY;
521 
522  /* get current cutoff bound */
523  cutoffbound = SCIPgetCutoffbound(scip);
524 
525  /* reduced cost strengthening can only be applied, if we have a finite cutoff */
526  if( SCIPisInfinity(scip, cutoffbound) )
527  return SCIP_OKAY;
528 
529  /* get LP columns */
530  cols = SCIPgetLPCols(scip);
531  ncols = SCIPgetNLPCols(scip);
532 
533  /* do nothing if the LP has no columns (is empty) */
534  if( ncols == 0 )
535  return SCIP_OKAY;
536 
537  /* get propagator data */
538  propdata = SCIPpropGetData(prop);
539  assert(propdata != NULL);
540 
541  /* chack if all integral variables are fixed and the continuous variables should not be propagated */
542  if( !propdata->continuous && SCIPgetNPseudoBranchCands(scip) == 0 )
543  return SCIP_OKAY;
544 
545  /* get LP objective value */
546  lpobjval = SCIPgetLPObjval(scip);
547 
548  /* check if binary variables should be propagated */
549  propbinvars = (SCIPgetDepth(scip) == 0) || (cutoffbound - lpobjval < 5 * propdata->maxredcost);
550 
551  /* skip the propagator if the problem has only binary variables and those should not be propagated */
552  if( !propbinvars && SCIPgetNVars(scip) == SCIPgetNBinVars(scip) )
553  return SCIP_OKAY;
554 
555  *result = SCIP_DIDNOTFIND;
556  cutoff = FALSE;
557  nchgbds = 0;
558 
559  /* compute the required reduced cost which are needed for a binary variable to be fixed */
560  requiredredcost = cutoffbound - lpobjval;
561 
562  SCIPdebugMessage("lpobjval <%g>, cutoffbound <%g>, max reduced <%g>, propgate binary %u, use implics %u\n",
563  lpobjval, cutoffbound, propdata->maxredcost, propbinvars, propdata->usefullimplics);
564 
565  /* check reduced costs for non-basic columns */
566  for( c = 0; c < ncols && !cutoff; ++c )
567  {
568  SCIP_VAR* var;
569 
570  var = SCIPcolGetVar(cols[c]);
571 
572  /* skip continuous variables in case the corresponding parameter is set */
573  if( !propdata->continuous && !SCIPvarIsIntegral(var) )
574  continue;
575 
576  if( SCIPvarIsBinary(var) )
577  {
578  if( propbinvars )
579  {
580  if( SCIPgetDepth(scip) == 0 )
581  {
582  SCIP_CALL( propagateRootRedcostBinvar(scip, propdata, var, cols[c], cutoffbound, &nchgbds) );
583  }
584  else
585  {
586  SCIP_CALL( propagateRedcostBinvar(scip, propdata, var, cols[c], requiredredcost, &nchgbds, &cutoff) );
587  }
588  }
589  }
590  else
591  {
592  SCIP_CALL( propagateRedcostVar(scip, var, cols[c], lpobjval, cutoffbound, &nchgbds) );
593  }
594  }
595 
596  if( cutoff )
597  {
598  *result = SCIP_CUTOFF;
599 
600  SCIPdebugMessage("node %" SCIP_LONGINT_FORMAT ": detected cutoff\n",
602  }
603  else if( nchgbds > 0 )
604  {
605  *result = SCIP_REDUCEDDOM;
606 
607  SCIPdebugMessage("node %" SCIP_LONGINT_FORMAT ": %d bound changes (max redcost <%g>)\n",
608  SCIPnodeGetNumber(SCIPgetCurrentNode(scip)) , nchgbds, propdata->maxredcost);
609  }
610 
611  return SCIP_OKAY;
612 }
613 
614 /**@} */
615 
616 /**@name Interface methods
617  *
618  * @{
619  */
620 
621 /** creates the redcost propagator and includes it in SCIP */
623  SCIP* scip /**< SCIP data structure */
624  )
625 {
626  SCIP_PROPDATA* propdata;
627  SCIP_PROP* prop;
628 
629  /* create redcost propagator data */
630  SCIP_CALL( SCIPallocMemory(scip, &propdata) );
631 
632  /* include propagator */
634  propExecRedcost, propdata) );
635 
636  assert(prop != NULL);
637 
638  /* set optional callbacks via setter functions */
639  SCIP_CALL( SCIPsetPropCopy(scip, prop, propCopyRedcost) );
640  SCIP_CALL( SCIPsetPropInitsol(scip, prop, propInitsolRedcost) );
641  SCIP_CALL( SCIPsetPropFree(scip, prop, propFreeRedcost) );
642 
643  /* add redcost propagator parameters */
645  "propagating/" PROP_NAME "/continuous",
646  "should reduced cost fixing be also applied to continuous variables?",
647  &propdata->continuous, FALSE, DEFAULT_CONTINUOUS, NULL, NULL) );
649  "propagating/" PROP_NAME "/useimplics",
650  "should implications be used to strength the reduced cost for binary variables?",
651  &propdata->useimplics, FALSE, DEFAULT_USEIMPLICS, NULL, NULL) );
652 
653  return SCIP_OKAY;
654 }
655 
656 /**@} */
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:41180
int SCIPgetNVars(SCIP *scip)
Definition: scip.c:10735
const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:16341
static SCIP_RETCODE propagateRedcostBinvar(SCIP *scip, SCIP_PROPDATA *propdata, SCIP_VAR *var, SCIP_COL *col, SCIP_Real requiredredcost, int *nchgbds, SCIP_Bool *cutoff)
Definition: prop_redcost.c:187
SCIP_RETCODE SCIPchgVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip.c:19814
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
Definition: scip.c:41256
SCIP_Real SCIPgetVarImplRedcost(SCIP *scip, SCIP_VAR *var, SCIP_Bool varfixing)
Definition: scip.c:17623
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
Definition: var.c:16521
SCIP_Bool SCIPisDualfeasZero(SCIP *scip, SCIP_Real val)
Definition: scip.c:41753
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:41528
SCIP_Real SCIPvarGetBestRootLPObjval(SCIP_VAR *var)
Definition: var.c:13028
#define NULL
Definition: lpi_spx.cpp:130
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
Definition: var.c:17011
#define PROP_DELAY
Definition: prop_redcost.c:45
int SCIPgetNLPCols(SCIP *scip)
Definition: scip.c:26715
#define FALSE
Definition: def.h:53
#define DEFAULT_CONTINUOUS
Definition: prop_redcost.c:55
int SCIPgetNBinVars(SCIP *scip)
Definition: scip.c:10780
int SCIPgetNPseudoBranchCands(SCIP *scip)
Definition: scip.c:33099
#define TRUE
Definition: def.h:52
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_RETCODE SCIPsetPropCopy(SCIP *scip, SCIP_PROP *prop, SCIP_DECL_PROPCOPY((*propcopy)))
Definition: scip.c:6914
static SCIP_DECL_PROPEXEC(propExecRedcost)
Definition: prop_redcost.c:474
SCIP_Bool SCIPisDualfeasPositive(SCIP *scip, SCIP_Real val)
Definition: scip.c:41765
SCIP_Real SCIPgetCutoffbound(SCIP *scip)
Definition: scip.c:38147
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
Definition: scip.c:26426
#define SCIPdebugMessage
Definition: pub_message.h:77
static SCIP_RETCODE propagateRedcostVar(SCIP *scip, SCIP_VAR *var, SCIP_COL *col, SCIP_Real lpobjval, SCIP_Real cutoffbound, int *nchgbds)
Definition: prop_redcost.c:296
SCIP_Real SCIPgetLPObjval(SCIP *scip)
Definition: scip.c:26469
#define DEFAULT_USEIMPLICS
Definition: prop_redcost.c:56
SCIP_Longint SCIPnodeGetNumber(SCIP_NODE *node)
Definition: tree.c:7016
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip.c:3516
SCIP_Real SCIPcolGetMaxPrimsol(SCIP_COL *col)
Definition: lp.c:18661
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
Definition: var.c:16532
static SCIP_DECL_PROPFREE(propFreeRedcost)
Definition: prop_redcost.c:442
#define PROP_PRIORITY
Definition: prop_redcost.c:43
SCIP_BASESTAT SCIPcolGetBasisStatus(SCIP_COL *col)
Definition: lp.c:18673
#define SCIPallocMemory(scip, ptr)
Definition: scip.h:20355
SCIP_PROPDATA * SCIPpropGetData(SCIP_PROP *prop)
Definition: prop.c:735
#define SCIPerrorMessage
Definition: pub_message.h:45
propagator using the LP reduced cost and the cutoff bound
SCIP_Real SCIPvarGetBestRootSol(SCIP_VAR *var)
Definition: var.c:12928
SCIP_Real SCIPadjustedVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real ub)
Definition: scip.c:19783
static SCIP_DECL_PROPCOPY(propCopyRedcost)
Definition: prop_redcost.c:428
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:41515
#define SCIP_CALL(x)
Definition: def.h:263
SCIP_Bool SCIPhasCurrentNodeLP(SCIP *scip)
Definition: scip.c:26341
void SCIPpropSetData(SCIP_PROP *prop, SCIP_PROPDATA *propdata)
Definition: prop.c:745
SCIP_Real SCIPcolGetMinPrimsol(SCIP_COL *col)
Definition: lp.c:18651
SCIP_COL ** SCIPgetLPCols(SCIP *scip)
Definition: scip.c:26694
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
Definition: var.c:17021
#define PROP_NAME
Definition: prop_redcost.c:40
SCIP_RETCODE SCIPchgVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip.c:19894
#define SCIP_Bool
Definition: def.h:50
SCIP_RETCODE SCIPsetPropFree(SCIP *scip, SCIP_PROP *prop, SCIP_DECL_PROPFREE((*propfree)))
Definition: scip.c:6930
SCIP_RETCODE SCIPincludePropBasic(SCIP *scip, SCIP_PROP **propptr, const char *name, const char *desc, int priority, int freq, SCIP_Bool delay, SCIP_PROPTIMING timingmask, SCIP_DECL_PROPEXEC((*propexec)), SCIP_PROPDATA *propdata)
Definition: scip.c:6877
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip.c:801
#define MAX(x, y)
Definition: tclique_def.h:75
SCIP_Bool SCIPallowObjProp(SCIP *scip)
Definition: scip.c:23080
SCIP_Bool SCIPisDualfeasNegative(SCIP *scip, SCIP_Real val)
Definition: scip.c:41777
SCIP_Real SCIPgetColRedcost(SCIP *scip, SCIP_COL *col)
Definition: scip.c:27389
SCIP_Real SCIPcolGetLb(SCIP_COL *col)
Definition: lp.c:18605
SCIP_RETCODE SCIPincludePropRedcost(SCIP *scip)
Definition: prop_redcost.c:622
SCIP_Real SCIPgetVarRedcost(SCIP *scip, SCIP_VAR *var)
Definition: scip.c:17580
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
Definition: scip.c:36389
SCIP_RETCODE SCIPsetPropInitsol(SCIP *scip, SCIP_PROP *prop, SCIP_DECL_PROPINITSOL((*propinitsol)))
Definition: scip.c:6978
int SCIPgetDepth(SCIP *scip)
Definition: scip.c:37750
SCIP_Bool SCIPisLPRelax(SCIP *scip)
Definition: scip.c:26447
#define SCIPfreeMemory(scip, ptr)
Definition: scip.h:20371
static SCIP_RETCODE propagateRootRedcostBinvar(SCIP *scip, SCIP_PROPDATA *propdata, SCIP_VAR *var, SCIP_COL *col, SCIP_Real cutoffbound, int *nchgbds)
Definition: prop_redcost.c:86
#define SCIP_Real
Definition: def.h:124
struct SCIP_PropData SCIP_PROPDATA
Definition: type_prop.h:38
#define SCIP_INVALID
Definition: def.h:144
#define PROP_DESC
Definition: prop_redcost.c:41
#define PROP_FREQ
Definition: prop_redcost.c:44
SCIP_Real SCIPadjustedVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real lb)
Definition: scip.c:19751
SCIP_Real SCIPcolGetUb(SCIP_COL *col)
Definition: lp.c:18615
int SCIPgetNObjVars(SCIP *scip)
Definition: scip.c:10963
SCIP_Bool SCIPisLPSolBasic(SCIP *scip)
Definition: scip.c:26834
SCIP_VAR * SCIPcolGetVar(SCIP_COL *col)
Definition: lp.c:18684
static SCIP_DECL_PROPINITSOL(propInitsolRedcost)
Definition: prop_redcost.c:459
#define PROP_TIMING
Definition: prop_redcost.c:42
const char * SCIPpropGetName(SCIP_PROP *prop)
Definition: prop.c:887
SCIP_Real SCIPvarGetBestRootRedcost(SCIP_VAR *var)
Definition: var.c:12994
SCIP_Bool SCIPisExactSolve(SCIP *scip)
Definition: scip.c:1012