Scippy

GCG

Branch-and-Price & Column Generation for Everyone

class_stabilization.cpp
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program */
4 /* GCG --- Generic Column Generation */
5 /* a Dantzig-Wolfe decomposition based extension */
6 /* of the branch-cut-and-price framework */
7 /* SCIP --- Solving Constraint Integer Programs */
8 /* */
9 /* Copyright (C) 2010-2021 Operations Research, RWTH Aachen University */
10 /* Zuse Institute Berlin (ZIB) */
11 /* */
12 /* This program is free software; you can redistribute it and/or */
13 /* modify it under the terms of the GNU Lesser General Public License */
14 /* as published by the Free Software Foundation; either version 3 */
15 /* of the License, or (at your option) any later version. */
16 /* */
17 /* This program is distributed in the hope that it will be useful, */
18 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
19 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
20 /* GNU Lesser General Public License for more details. */
21 /* */
22 /* You should have received a copy of the GNU Lesser General Public License */
23 /* along with this program; if not, write to the Free Software */
24 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.*/
25 /* */
26 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27 
28 /**@file class_stabilization.cpp
29  * @brief class with functions for dual variable smoothing
30  * @author Martin Bergner
31  * @author Jonas Witt
32  * @author Michael Bastubbe
33  *
34  * This is an implementation of dynamic alpha-schedule (based on subgradient information) stabilization including an optional
35  * combination with a subgradient method based on the papers
36  *
37  * Pessoa, A., Sadykov, R., Uchoa, E., & Vanderbeck, F. (2013). In-Out Separation and Column Generation
38  * Stabilization by Dual Price Smoothing. In Experimental Algorithms (pp. 354-365). Springer Berlin Heidelberg.
39  *
40  * Pessoa, A., Sadykov, R., Uchoa, E., & Vanderbeck, F. (2016). Automation and combination of linear-programming
41  * based stabilization techniques in column generation.
42  */
43 
44 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
45 /* #define SCIP_DEBUG */
46 #include "class_stabilization.h"
47 #include "pricer_gcg.h"
48 #include "gcg.h"
49 #include "pub_gcgcol.h"
50 #include "sepa_master.h"
51 #include "objscip/objscip.h"
52 #include "scip/cons_linear.h"
53 #include "scip_misc.h"
54 
55 namespace gcg {
56 
58  SCIP* scip,
59  PricingType* pricingtype_,
60  SCIP_Bool hybridascent_
61  ) :scip_(scip), stabcenterconsvals((SCIP_Real*) NULL), stabcenterconsvalssize(0), nstabcenterconsvals(0),
62  stabcentercutvals((SCIP_Real*) NULL), stabcentercutvalssize(0), nstabcentercutvals(0),
63  stabcenterlinkingconsvals((SCIP_Real*) NULL), nstabcenterlinkingconsvals(0), stabcenterlinkingconsvalssize(0),
64  stabcenterconv((SCIP_Real*) NULL), nstabcenterconv(0), dualdiffnorm(0.0),
65  subgradientconsvals(NULL), subgradientconsvalssize(0), nsubgradientconsvals(0),
66  subgradientcutvals(NULL), subgradientcutvalssize(0), nsubgradientcutvals(0),
67  subgradientlinkingconsvals(NULL),
68  subgradientnorm(0.0), hybridfactor(0.0),
69  pricingtype(pricingtype_), alpha(0.8), alphabar(0.8), hybridascent(hybridascent_), beta(0.0), nodenr(-1), k(0), t(0), hasstabilitycenter(FALSE),stabcenterbound(-SCIPinfinity(scip)),
70  inmispricingschedule(FALSE), subgradientproduct(0.0)
71 {
72 
73 }
74 
76 {
77  SCIPfreeBlockMemoryArrayNull(scip_, &stabcenterconsvals, stabcenterconsvalssize); /*lint !e64*/
78  SCIPfreeBlockMemoryArrayNull(scip_, &stabcentercutvals, stabcentercutvalssize); /*lint !e64*/
79  SCIPfreeBlockMemoryArrayNull(scip_, &stabcenterlinkingconsvals, stabcenterlinkingconsvalssize); /*lint !e64*/
80  SCIPfreeBlockMemoryArrayNull(scip_, &subgradientconsvals, subgradientconsvalssize); /*lint !e64*/
81  SCIPfreeBlockMemoryArrayNull(scip_, &subgradientcutvals, subgradientcutvalssize); /*lint !e64*/
82  SCIPfreeBlockMemoryArrayNull(scip_, &subgradientlinkingconsvals, subgradientlinkingconsvalssize); /*lint !e64*/
83  SCIPfreeBlockMemoryArrayNull(scip_, &stabcenterconv, nstabcenterconv); /*lint !e64*/
84  scip_ = (SCIP*) NULL;
85  stabcenterconsvals = (SCIP_Real*) NULL;
86  stabcentercutvals = (SCIP_Real*) NULL;
87  stabcenterlinkingconsvals = (SCIP_Real*) NULL;
88  stabcenterconv = (SCIP_Real*) NULL;
89  pricingtype = (PricingType*) NULL;
90  nodenr = -1;
91 
92 
93 }
94 
95 SCIP_RETCODE Stabilization::updateStabcenterconsvals()
96 {
97  SCIP* origprob = GCGmasterGetOrigprob(scip_);
98  int nconss = GCGgetNMasterConss(origprob);
99 
100  if( nconss == nstabcenterconsvals )
101  {
102  return SCIP_OKAY;
103  }
104 
105  if( nconss > stabcenterconsvalssize )
106  {
107  int oldsize = stabcenterconsvalssize;
108  stabcenterconsvalssize = SCIPcalcMemGrowSize(scip_, nconss);
109  SCIP_CALL( SCIPreallocBlockMemoryArray(scip_, &stabcenterconsvals, oldsize, stabcenterconsvalssize) );
110  }
111  assert(stabcenterconsvals != NULL);
112  BMSclearMemoryArray(&stabcenterconsvals[nstabcenterconsvals], (size_t)nconss-nstabcenterconsvals); /*lint !e866*/
113 
114  nstabcenterconsvals = nconss;
115 
116  return SCIP_OKAY;
117 }
118 
119 SCIP_RETCODE Stabilization::updateStabcentercutvals()
120 {
121  int ncuts = GCGsepaGetNCuts(scip_);
122 
123  if( ncuts == nstabcentercutvals )
124  {
125  return SCIP_OKAY;
126  }
127 
128  if( ncuts > stabcentercutvalssize )
129  {
130  int oldsize = stabcentercutvalssize;
131  stabcentercutvalssize = SCIPcalcMemGrowSize(scip_, ncuts);
132  SCIP_CALL( SCIPreallocBlockMemoryArray(scip_, &stabcentercutvals, oldsize, stabcentercutvalssize) );
133  }
134  assert(stabcentercutvals != NULL);
135  BMSclearMemoryArray(&stabcentercutvals[nstabcentercutvals], (size_t)ncuts-nstabcentercutvals); /*lint !e866*/
136 
137  nstabcentercutvals = ncuts;
138 
139  return SCIP_OKAY;
140 }
141 
142 SCIP_RETCODE Stabilization::updateSubgradientconsvals()
143 {
144  SCIP* origprob = GCGmasterGetOrigprob(scip_);
145  int nconss = GCGgetNMasterConss(origprob);
146 
147  if( nconss == nsubgradientconsvals )
148  {
149  return SCIP_OKAY;
150  }
151 
152  if( nconss > subgradientconsvalssize )
153  {
154  int oldsize = subgradientconsvalssize;
155  subgradientconsvalssize = SCIPcalcMemGrowSize(scip_, nconss);
156  SCIP_CALL( SCIPreallocBlockMemoryArray(scip_, &subgradientconsvals, oldsize, subgradientconsvalssize) );
157  }
158  assert(subgradientconsvals != NULL);
159  BMSclearMemoryArray(&subgradientconsvals[nsubgradientconsvals], (size_t)nconss-nsubgradientconsvals); /*lint !e866*/
160 
161  nsubgradientconsvals = nconss;
162 
163  return SCIP_OKAY;
164 }
165 
166 SCIP_RETCODE Stabilization::updateSubgradientcutvals()
167 {
168  int ncuts = GCGsepaGetNCuts(scip_);
169 
170  if( ncuts == nsubgradientcutvals )
171  {
172  return SCIP_OKAY;
173  }
174 
175  if( ncuts > subgradientcutvalssize )
176  {
177  int oldsize = subgradientcutvalssize;
178  subgradientcutvalssize = SCIPcalcMemGrowSize(scip_, ncuts);
179  SCIP_CALL( SCIPreallocBlockMemoryArray(scip_, &subgradientcutvals, oldsize, subgradientcutvalssize) );
180  }
181  assert(subgradientcutvals != NULL);
182  BMSclearMemoryArray(&subgradientcutvals[nsubgradientcutvals], (size_t)ncuts-nsubgradientcutvals); /*lint !e866*/
183 
184  nsubgradientcutvals = ncuts;
185 
186  return SCIP_OKAY;
187 }
188 
189 
191  int nlinkingconssnew
192  )
193 {
194  if( nlinkingconssnew > stabcenterlinkingconsvalssize)
195  {
196  int newsize = SCIPcalcMemGrowSize(scip_, nlinkingconssnew);
197  SCIP_CALL(SCIPreallocBlockMemoryArray(scip_, &stabcenterlinkingconsvals, stabcenterlinkingconsvalssize, newsize));
198 
199 
200  if( hybridascent )
201  {
202  SCIP_CALL( SCIPreallocBlockMemoryArray(scip_, &subgradientlinkingconsvals, stabcenterlinkingconsvalssize,
203  newsize) );
204  BMSclearMemoryArray(subgradientlinkingconsvals, nlinkingconssnew);
205  }
206  stabcenterlinkingconsvalssize = newsize;
207  }
208 
209  nstabcenterlinkingconsvals = nlinkingconssnew;
210  BMSclearMemoryArray(stabcenterlinkingconsvals, nstabcenterlinkingconsvals);
211 
212 
213  return SCIP_OKAY;
214 }
215 
217  int nconvconssnew
218  )
219 {
220  SCIPfreeBlockMemoryArrayNull(scip_, &stabcenterconv, nstabcenterconv); /*lint !e64*/
221  SCIP_CALL( SCIPallocBlockMemoryArray(scip_, &stabcenterconv, nconvconssnew) );
222 
223  nstabcenterconv = nconvconssnew;
224  BMSclearMemoryArray(stabcenterconv, nstabcenterconv);
225 
226  return SCIP_OKAY;
227 }
228 
230  int i
231  )
232 {
233  SCIP* origprob = GCGmasterGetOrigprob(scip_);
234  SCIP_Real subgradient = 0.0;
235 
236  assert(i < nstabcenterlinkingconsvals);
237  assert(nstabcenterlinkingconsvals<= GCGgetNVarLinkingconss(origprob));
238  assert(stabcenterlinkingconsvals != NULL);
239 
240  SCIP_CONS* cons = GCGgetVarLinkingconss(origprob)[i];
241 
242  if( hybridascent && hasstabilitycenter )
243  subgradient = subgradientlinkingconsvals[i];
244 
245  return computeDual(stabcenterlinkingconsvals[i], pricingtype->consGetDual(scip_, cons), subgradient, 0.0, 0.0);
246 }
247 
249  int i, /* index of the constraint */
250  SCIP_Real* dual /* return pointer for dual value */
251 )
252 {
253  SCIP* origprob = GCGmasterGetOrigprob(scip_);
254  SCIP_Real subgradient = 0.0;
255 #ifndef NDEBUG
256  int nconss = GCGgetNMasterConss(origprob);
257 #endif
258  assert(i < nconss);
259  assert(dual != NULL);
260 
261  SCIP_CONS* cons = GCGgetMasterConss(origprob)[i];
262 
263  if( i >= nstabcenterconsvals )
264  SCIP_CALL( updateStabcenterconsvals() );
265 
266  assert(i < nstabcenterconsvals);
267  assert(stabcenterconsvals != NULL);
268 
269  if( i >= nsubgradientconsvals && hybridascent )
270  SCIP_CALL( updateSubgradientconsvals() );
271 
272  if( hybridascent && hasstabilitycenter )
273  subgradient = subgradientconsvals[i];
274 
275  *dual = computeDual(stabcenterconsvals[i], pricingtype->consGetDual(scip_, cons), subgradient, SCIPgetLhsLinear(scip_, cons), SCIPgetRhsLinear(scip_, cons));
276  return SCIP_OKAY;
277 
278 }
279 
281  int i, /* index of the row */
282  SCIP_Real* dual /* return pointer for dual value */
283 )
284 {
285 #ifndef NDEBUG
286  int nrows = GCGsepaGetNCuts(scip_);
287 #endif
288  assert(i < nrows);
289  assert(dual != NULL);
290 
291  SCIP_ROW* row = GCGsepaGetMastercuts(scip_)[i];
292  SCIP_Real subgradient = 0.0;
293 
294  if( i >= nstabcentercutvals )
295  SCIP_CALL( updateStabcentercutvals() );
296 
297  assert(i < nstabcentercutvals);
298  assert(stabcentercutvals != NULL);
299 
300  if( i >= nsubgradientcutvals && hybridascent )
301  SCIP_CALL( updateSubgradientcutvals() );
302 
303  if( hybridascent && hasstabilitycenter )
304  {
305  assert(subgradientcutvals != NULL);
306  subgradient = subgradientcutvals[i];
307  }
308 
309  *dual = computeDual(stabcentercutvals[i], pricingtype->rowGetDual(row), subgradient, SCIProwGetLhs(row), SCIProwGetRhs(row));
310 
311  return SCIP_OKAY;
312 }
313 
315  int i
316  )
317 {
318  SCIP* origprob = GCGmasterGetOrigprob(scip_);
319 
320  assert(i < nstabcenterconv);
321  assert(nstabcenterconv<= GCGgetNPricingprobs(origprob));
322  assert(stabcenterconv != NULL);
323 
324  SCIP_CONS* cons = GCGgetConvCons(origprob, i);
325  SCIP_Real subgradient = 0.0;
326 
327  return computeDual(stabcenterconv[i], pricingtype->consGetDual(scip_, cons), subgradient, (SCIP_Real) GCGgetNIdenticalBlocks(origprob, i), (SCIP_Real) GCGgetNIdenticalBlocks(origprob, i));
328 }
329 
331  SCIP_Real lowerbound, /**< lower bound due to lagrange function corresponding to current (stabilized) dual vars */
332  SCIP_Real* dualsolconv, /**< corresponding feasible dual solution for convexity constraints */
333  GCG_COL** pricingcols /**< columns of the pricing problems */
334  )
335 {
336  assert(dualsolconv != NULL);
337  SCIPdebugMessage("Updating stability center: ");
338 
339  /* in case the bound is not improving and we have a stability center, do nothing */
340  if( SCIPisLE(scip_, lowerbound, stabcenterbound) && hasstabilitycenter )
341  {
342  SCIPdebugPrintf("no bound increase: %g <= %g\n", lowerbound, SCIPnodeGetLowerbound(SCIPgetCurrentNode(scip_)));
343  return SCIP_OKAY;
344  }
345 
346  SCIPdebugPrintf("bound increase: %g > %g\n", lowerbound, SCIPnodeGetLowerbound(SCIPgetCurrentNode(scip_)));
347 
348  /* first update the arrays */
349  SCIP_CALL( updateStabcenterconsvals() );
350  SCIP_CALL( updateStabcentercutvals() );
351 
352  if( hybridascent )
353  {
354  SCIP_CALL( updateSubgradientconsvals() );
355  SCIP_CALL( updateSubgradientcutvals() );
356  }
357 
358  /* get new dual values */
359  SCIP* origprob = GCGmasterGetOrigprob(scip_);
360 
361  int nconss = GCGgetNMasterConss(origprob);
362  int ncuts = GCGsepaGetNCuts(scip_);
363  int nprobs = GCGgetNPricingprobs(origprob);
364 
365  assert(nstabcenterlinkingconsvals <= GCGgetNVarLinkingconss(origprob) );
366  assert(nconss <= nstabcenterconsvals);
367  assert(ncuts <= nstabcentercutvals);
368 
369  for( int i = 0; i < nconss; ++i )
370  {
371  SCIP_CALL( consGetDual(i, &stabcenterconsvals[i]) );
372  }
373 
374  for( int i = 0; i < ncuts; ++i )
375  {
376  SCIP_CALL( rowGetDual(i, &stabcentercutvals[i]) );
377  }
378 
379  for( int i = 0; i < nstabcenterlinkingconsvals; ++i)
380  {
381  stabcenterlinkingconsvals[i] = linkingconsGetDual(i);
382  }
383 
384  for( int i = 0; i < nprobs; ++i )
385  {
386  if(!GCGisPricingprobRelevant(origprob, i))
387  continue;
388  stabcenterconv[i] = dualsolconv[i];
389  }
390 
391  if( hybridascent )
392  calculateSubgradient(pricingcols);
393 
394  hasstabilitycenter = TRUE;
395  stabcenterbound = lowerbound;
396 
397  return SCIP_OKAY;
398 }
399 
400 SCIP_Real Stabilization::computeDual(
401  SCIP_Real center,
402  SCIP_Real current,
403  SCIP_Real subgradient, /**< subgradient (or 0.0 if not needed) */
404  SCIP_Real lhs, /**< lhs (or 0.0 if not needed) */
405  SCIP_Real rhs /**< rhs (or 0.0 if not needed) */
406  ) const
407 {
408  SCIP_Real usedalpha = alpha;
409  SCIP_Real usedbeta = beta;
410 
411  if ( inmispricingschedule )
412  {
413  usedalpha = alphabar;
414  usedbeta = 0.0;
415  }
416 
417  if( hasstabilitycenter && (SCIPisZero(scip_, usedbeta) || SCIPisZero(scip_, usedalpha)) )
418  return usedalpha*center+(1.0-usedalpha)*current;
419  else if( hasstabilitycenter && SCIPisPositive(scip_, usedbeta) )
420  {
421  SCIP_Real dual = center + hybridfactor * (beta * (center + subgradient * dualdiffnorm / subgradientnorm) + (1.0 - beta) * current - center);
422 
423  /* make sure dual solution has the correct sign */
424  if( SCIPisInfinity(scip_, rhs) )
425  dual = MAX(dual, 0.0);
426  else if( SCIPisInfinity(scip_, -lhs) )
427  dual = MIN(dual, 0.0);
428 
429  return dual;
430  }
431  else
432  return current;
433 }
434 
435 void Stabilization::updateIterationCount()
436 {
437  ++t;
438 }
439 
440 void Stabilization::updateIterationCountMispricing()
441 {
442  ++k;
443 }
444 
446 {
447  if( nodenr != SCIPnodeGetNumber(SCIPgetCurrentNode(scip_)) )
448  {
449  nodenr = SCIPnodeGetNumber(SCIPgetCurrentNode(scip_));
450  k = 0;
451  t = 1;
452  alpha = 0.8;
453  hasstabilitycenter = FALSE;
454  stabcenterbound = -SCIPinfinity(scip_);
455  inmispricingschedule = FALSE;
456  }
457 }
458 
459 /**< update information for hybrid stabilization with dual ascent */
461 {
462  if( hasstabilitycenter && hybridascent && !inmispricingschedule )
463  {
464  /* first update the arrays */
465  SCIP_CALL( updateStabcenterconsvals() );
466  SCIP_CALL( updateStabcentercutvals() );
467 
468  SCIP_CALL( updateSubgradientconsvals() );
469  SCIP_CALL( updateSubgradientcutvals() );
470 
471  if( SCIPisPositive(scip_, alpha) )
472  {
473  calculateDualdiffnorm();
474  calculateBeta();
475  calculateHybridFactor();
476  }
477  }
478 
479  return SCIP_OKAY;
480 }
481 
483 {
484  SCIPdebugMessage("Alphabar update after mispricing\n");
485  updateIterationCountMispricing();
486  alphabar = MAX(0.0, 1-k*(1-alpha));
487  SCIPdebugMessage("alphabar updated to %g in mispricing iteration k=%d and node pricing iteration t=%d \n", alphabar, k, t);
488 }
489 
491 {
492  SCIPdebugMessage("Alpha update after successful pricing\n");
493  updateIterationCount();
494 
495  /* There is a sign error in the stabilization paper:
496  * if the scalar product (subgradientproduct) is positive, the angle is less than 90° and we want to decrease alpha
497  */
498  if( SCIPisNegative(scip_, subgradientproduct) )
499  {
500  increaseAlpha();
501  }
502  else
503  {
504  decreaseAlpha();
505  }
506 
507 }
508 
509 void Stabilization::increaseAlpha()
510 {
511  /* to avoid numerical problems, we assure alpha <= 0.9 */
512  alpha = MIN(0.9, alpha+(1-alpha)*0.1);
513 
514  SCIPdebugMessage("alpha increased to %g\n", alpha);
515 }
516 
517 void Stabilization::decreaseAlpha()
518 {
519  alpha = MAX(0.0, alpha-0.1);
520 
521  SCIPdebugMessage("alpha decreased to %g\n", alpha);
522 }
523 
524 SCIP_Real Stabilization::calculateSubgradientProduct(
525  GCG_COL** pricingcols /**< solutions of the pricing problems */
526  )
527 {
528  SCIP* origprob = GCGmasterGetOrigprob(scip_);
529  SCIP_CONS** origmasterconss = GCGgetOrigMasterConss(origprob);
530  SCIP_CONS** masterconss = GCGgetMasterConss(origprob);
531  SCIP_CONS** linkingconss = GCGgetVarLinkingconss(origprob);
532  int nlinkingconss = GCGgetNVarLinkingconss(origprob);
533  int* linkingconsblocks = GCGgetVarLinkingconssBlock(origprob);
534  assert(nstabcenterlinkingconsvals <= GCGgetNVarLinkingconss(origprob) );
535  int nconss = GCGgetNMasterConss(origprob);
536  assert(nconss <= nstabcenterconsvals);
537  SCIP_ROW** mastercuts = GCGsepaGetMastercuts(scip_);
538  SCIP_ROW** origmastercuts = GCGsepaGetOrigcuts(scip_);
539  int ncuts = GCGsepaGetNCuts(scip_);
540  assert(ncuts <= nstabcentercutvals);
541 
542  SCIP_Real gradientproduct = 0.0;
543 
544  /* masterconss */
545  for( int i = 0; i < nconss; ++i )
546  {
547  SCIP_VAR** vars;
548  SCIP_Real* vals;
549  int nvars;
550  SCIP_Real lhs; /* can also be rhs, but we need only one */
551 
552  SCIP_CONS* origcons = origmasterconss[i];
553  nvars = GCGconsGetNVars(origprob, origcons);
554  SCIP_CALL( SCIPallocBufferArray(origprob, &vars, nvars) );
555  SCIP_CALL( SCIPallocBufferArray(origprob, &vals, nvars) );
556  GCGconsGetVars(origprob, origcons, vars, nvars);
557  GCGconsGetVals(origprob, origcons, vals, nvars);
558 
559  SCIP_Real dual = pricingtype->consGetDual(scip_, masterconss[i]);
560  SCIP_Real stabdual;
561 
562  SCIP_CALL( consGetDual(i, &stabdual) );
563 
564  assert(!SCIPisInfinity(scip_, ABS(dual)));
565 
566  if( SCIPisFeasPositive(scip_, stabdual) )
567  {
568  lhs = GCGconsGetLhs(origprob, origcons);
569  }
570  else if( SCIPisFeasNegative(scip_, stabdual) )
571  {
572  lhs = GCGconsGetRhs(origprob, origcons);
573  }
574  else
575  {
576  SCIPfreeBufferArray(origprob, &vals);
577  SCIPfreeBufferArray(origprob, &vars);
578  continue;
579  }
580 
581  for( int j = 0; j < nvars; ++j )
582  {
583  SCIP_Real val = 0.0;
584  assert(GCGvarIsOriginal(vars[j]));
585  if( GCGvarGetBlock(vars[j]) < 0 )
586  {
587  SCIP_VAR* mastervar = GCGoriginalVarGetMastervars(vars[j])[0];
588  assert(GCGvarIsMaster(mastervar));
589  val = SCIPgetSolVal(scip_, (SCIP_SOL*) NULL, mastervar);
590  assert( !SCIPisInfinity(scip_, val) );
591  }
592  else
593  {
594  int block = GCGvarGetBlock(vars[j]);
595  if( !GCGisPricingprobRelevant(origprob, block) )
596  continue;
597 
598  assert(pricingcols[block] != NULL);
599 
600  SCIP_VAR* pricingvar = GCGoriginalVarGetPricingVar(vars[j]);
601  assert(GCGvarIsPricing(pricingvar));
602  SCIP* pricingprob = GCGgetPricingprob(origprob, block);
603  assert(pricingprob != NULL);
604  val = GCGcolGetSolVal(pricingprob, pricingcols[block], pricingvar);
605  assert(!SCIPisInfinity(scip_, ABS(val)));
606  }
607  assert(stabcenterconsvals != NULL);
608  assert(vals != NULL);
609  gradientproduct -= (dual - stabcenterconsvals[i]) * vals[j] * val;
610  }
611 
612  assert(stabcenterconsvals != NULL);
613  assert(!SCIPisInfinity(scip_, ABS(lhs)));
614 
615  gradientproduct += (dual - stabcenterconsvals[i]) * lhs;
616  SCIPfreeBufferArray(origprob, &vals);
617  SCIPfreeBufferArray(origprob, &vars);
618  }
619 
620  /* mastercuts */
621  for( int i = 0; i < ncuts; ++i )
622  {
623  SCIP_COL** cols;
624  SCIP_Real* vals;
625  int nvars;
626  SCIP_Real lhs; /* can also be rhs, but we need only one */
627 
628  SCIP_ROW* origcut = origmastercuts[i];
629  nvars = SCIProwGetNNonz(origcut);
630  cols = SCIProwGetCols(origcut);
631  vals = SCIProwGetVals(origcut);
632 
633  SCIP_Real dual = pricingtype->rowGetDual(mastercuts[i]);
634  assert(!SCIPisInfinity(scip_, ABS(dual)));
635 
636  SCIP_Real stabdual;
637 
638  SCIP_CALL( rowGetDual(i, &stabdual) );
639 
640  if( SCIPisFeasGT(scip_, stabdual, 0.0) )
641  {
642  lhs = SCIProwGetLhs(origcut);
643  }
644  else if( SCIPisFeasLT(scip_, stabdual, 0.0) )
645  {
646  lhs = SCIProwGetRhs(origcut);
647  }
648  else
649  {
650  continue;
651  }
652  for( int j = 0; j < nvars; ++j )
653  {
654  SCIP_Real val = 0.0;
655  SCIP_VAR* var = SCIPcolGetVar(cols[j]);
656  assert(GCGvarIsOriginal(var));
657 
658  /* Linking or master variable */
659  if( GCGvarGetBlock(var) < 0 )
660  {
661  SCIP_VAR* mastervar = GCGoriginalVarGetMastervars(var)[0];
662  assert(GCGvarIsMaster(mastervar));
663  val = SCIPgetSolVal(scip_, (SCIP_SOL*) NULL, mastervar);
664  assert(!SCIPisInfinity(scip_, ABS(val)));
665  }
666  /* Variable in a pricing problem */
667  else
668  {
669  int block = GCGvarGetBlock(var);
670  if( !GCGisPricingprobRelevant(origprob, block) )
671  continue;
672 
673  assert(pricingcols[block] != NULL);
674 
675  SCIP_VAR* pricingvar = GCGoriginalVarGetPricingVar(var);
676  assert(GCGvarIsPricing(pricingvar));
677  SCIP* pricingprob = GCGgetPricingprob(origprob, block);
678  assert(pricingprob != NULL);
679  val = GCGcolGetSolVal(pricingprob, pricingcols[block], pricingvar);
680  assert(!SCIPisInfinity(scip_, ABS(val)));
681  }
682  assert(stabcentercutvals != NULL);
683  assert(vals != NULL);
684  gradientproduct -= (dual - stabcentercutvals[i]) * vals[j] * val;
685  }
686 
687  assert(!SCIPisInfinity(scip_, ABS(lhs)));
688  assert(stabcentercutvals != NULL);
689 
690  gradientproduct += (dual - stabcentercutvals[i]) * lhs;
691  }
692 
693  /* linkingconss */
694  for( int i = 0; i < nlinkingconss; ++i )
695  {
696  SCIP_VAR* mastervar;
697  SCIP_VAR* pricingvar;
698  SCIP_CONS* linkingcons = linkingconss[i];
699  int block = linkingconsblocks[i];
700  mastervar = SCIPgetVarsLinear(scip_, linkingcons)[0];
701  assert(GCGvarIsMaster(mastervar));
702 
703  pricingvar = GCGlinkingVarGetPricingVars(GCGmasterVarGetOrigvars(mastervar)[0])[block];
704  assert(GCGvarIsPricing(pricingvar));
705  SCIP* pricingprob = GCGgetPricingprob(origprob, block);
706  assert(pricingprob != NULL);
707 
708  assert(stabcenterlinkingconsvals != NULL);
709  SCIP_Real dual = pricingtype->consGetDual(scip_, linkingcons) - stabcenterlinkingconsvals[i];
710 
711  SCIP_Real stabdual = linkingconsGetDual(i);
712 
713  if( SCIPisFeasZero(origprob, stabdual) )
714  continue;
715 
716  assert(pricingcols[block] != NULL);
717 
718  SCIP_Real masterval = SCIPgetSolVal(scip_, (SCIP_SOL*) NULL, mastervar);
719  SCIP_Real pricingval = GCGcolGetSolVal(pricingprob, pricingcols[block], pricingvar);
720  assert(!SCIPisInfinity(scip_, ABS(masterval)));
721  assert(!SCIPisInfinity(scip_, ABS(pricingval)));
722  assert(!SCIPisInfinity(scip_, ABS(dual)));
723  gradientproduct -= dual * (masterval - pricingval);
724  }
725 
726  SCIPdebugMessage("Update gradient product with value %g.\n", gradientproduct);
727 
728  return gradientproduct;
729 }
730 
731 /** calculates the subgradient (with linking variables) */
732 void Stabilization::calculateSubgradient(
733  GCG_COL** pricingcols /**< columns of the pricing problems */
734 )
735 {
736  SCIP* origprob = GCGmasterGetOrigprob(scip_);
737  SCIP_CONS** origmasterconss = GCGgetOrigMasterConss(origprob);
738 
739  SCIP_CONS** linkingconss = GCGgetVarLinkingconss(origprob);
740  int nlinkingconss = GCGgetNVarLinkingconss(origprob);
741  int* linkingconsblocks = GCGgetVarLinkingconssBlock(origprob);
742  assert(nstabcenterlinkingconsvals <= GCGgetNVarLinkingconss(origprob) );
743  int nconss = GCGgetNMasterConss(origprob);
744  assert(nconss <= nstabcenterconsvals);
745  SCIP_ROW** origmastercuts = GCGsepaGetOrigcuts(scip_);
746  int ncuts = GCGsepaGetNCuts(scip_);
747  assert(ncuts <= nstabcentercutvals);
748 
749  subgradientnorm = 0.0;
750 
751  /* masterconss */
752  for( int i = 0; i < nconss; ++i )
753  {
754  SCIP_VAR** vars;
755  SCIP_Real* vals;
756  int nvars;
757  SCIP_Real activity;
758  SCIP_Real infeasibility;
759 
760  SCIP_CONS* origcons = origmasterconss[i];
761  nvars = GCGconsGetNVars(origprob, origcons);
762  SCIPallocBufferArray(origprob, &vars, nvars);
763  SCIPallocBufferArray(origprob, &vals, nvars);
764  GCGconsGetVars(origprob, origcons, vars, nvars);
765  GCGconsGetVals(origprob, origcons, vals, nvars);
766 
767  SCIP_Real dual = stabcenterconsvals[i];
768  assert(!SCIPisInfinity(scip_, ABS(dual)));
769 
770  activity = 0.0;
771 
772  for( int j = 0; j < nvars; ++j )
773  {
774  SCIP_Real val = 0.0;
775  assert(GCGvarIsOriginal(vars[j]));
776  if( GCGvarGetBlock(vars[j]) < 0 )
777  {
778  SCIP_VAR* mastervar = GCGoriginalVarGetMastervars(vars[j])[0];
779  assert(GCGvarIsMaster(mastervar));
780  val = SCIPgetSolVal(scip_, (SCIP_SOL*) NULL, mastervar);
781  assert( !SCIPisInfinity(scip_, val) );
782  }
783  else
784  {
785  int block = GCGvarGetBlock(vars[j]);
786  if( !GCGisPricingprobRelevant(origprob, block) )
787  continue;
788 
789  assert(pricingcols[block] != NULL);
790 
791  SCIP_VAR* pricingvar = GCGoriginalVarGetPricingVar(vars[j]);
792  assert(GCGvarIsPricing(pricingvar));
793  SCIP* pricingprob = GCGgetPricingprob(origprob, block);
794  assert(pricingprob != NULL);
795  val = GCGcolGetSolVal(pricingprob, pricingcols[block], pricingvar);
796  assert(!SCIPisInfinity(scip_, ABS(val)));
797  }
798  assert(vals != NULL);
799  activity += vals[j] * val;
800  }
801 
802  infeasibility = 0.0;
803 
804  if( SCIPisFeasPositive(scip_, dual) /* || SCIPisInfinity(origprob, SCIPgetRhsLinear(origprob, origcons)) */)
805  {
806  infeasibility = GCGconsGetLhs(origprob, origcons) - activity;
807  }
808  else if( SCIPisFeasNegative(scip_, dual) /* || SCIPisInfinity(origprob, SCIPgetLhsLinear(origprob, origcons)) */)
809  {
810  infeasibility = GCGconsGetRhs(origprob, origcons) - activity;
811  }
812 
813  assert(subgradientconsvals != NULL);
814  assert(!SCIPisInfinity(scip_, SQR(infeasibility)));
815 
816  subgradientconsvals[i] = infeasibility;
817 
818  if( SCIPisPositive(scip_, SQR(infeasibility)) )
819  subgradientnorm += SQR(infeasibility);
820 
821  SCIPfreeBufferArray(origprob, &vals);
822  SCIPfreeBufferArray(origprob, &vars);
823  }
824 
825  /* mastercuts */
826  for( int i = 0; i < ncuts; ++i )
827  {
828  SCIP_COL** cols;
829  SCIP_Real* vals;
830  int nvars;
831  SCIP_Real activity;
832  SCIP_Real infeasibility;
833 
834  SCIP_ROW* origcut = origmastercuts[i];
835  nvars = SCIProwGetNNonz(origcut);
836  cols = SCIProwGetCols(origcut);
837  vals = SCIProwGetVals(origcut);
838 
839  activity = 0.0;
840 
841  SCIP_Real dual = stabcentercutvals[i];
842  assert(!SCIPisInfinity(scip_, ABS(dual)));
843  for( int j = 0; j < nvars; ++j )
844  {
845  SCIP_Real val = 0.0;
846  SCIP_VAR* var = SCIPcolGetVar(cols[j]);
847  assert(GCGvarIsOriginal(var));
848 
849  /* Linking or master variable */
850  if( GCGvarGetBlock(var) < 0 )
851  {
852  SCIP_VAR* mastervar = GCGoriginalVarGetMastervars(var)[0];
853  assert(GCGvarIsMaster(mastervar));
854  val = SCIPgetSolVal(scip_, (SCIP_SOL*) NULL, mastervar);
855  assert(!SCIPisInfinity(scip_, ABS(val)));
856  }
857  /* Variable in a pricing problem */
858  else
859  {
860  int block = GCGvarGetBlock(var);
861  if( !GCGisPricingprobRelevant(origprob, block) )
862  continue;
863 
864  assert(pricingcols[block] != NULL);
865 
866  SCIP_VAR* pricingvar = GCGoriginalVarGetPricingVar(var);
867  assert(GCGvarIsPricing(pricingvar));
868  SCIP* pricingprob = GCGgetPricingprob(origprob, block);
869  assert(pricingprob != NULL);
870  val = GCGcolGetSolVal(pricingprob, pricingcols[block], pricingvar);
871  assert(!SCIPisInfinity(scip_, ABS(val)));
872  }
873  assert(stabcentercutvals != NULL);
874  assert(vals != NULL);
875  activity += vals[j] * val;
876  }
877 
878  infeasibility = 0.0;
879 
880  if( SCIPisFeasPositive(scip_, dual) )
881  {
882  infeasibility = SCIProwGetLhs(origcut) - activity;
883  }
884  else if( SCIPisFeasNegative(scip_, dual) )
885  {
886  infeasibility = SCIProwGetRhs(origcut) - activity;
887  }
888 
889  assert(subgradientcutvals != NULL);
890  assert(!SCIPisInfinity(scip_, SQR(infeasibility)));
891 
892  subgradientcutvals[i] = infeasibility;
893 
894  if( SCIPisPositive(scip_, SQR(infeasibility)) )
895  subgradientnorm += SQR(infeasibility);
896  }
897 
898  /* linkingconss */
899  for( int i = 0; i < nlinkingconss; ++i )
900  {
901  SCIP_VAR* mastervar;
902  SCIP_VAR* pricingvar;
903  SCIP_CONS* linkingcons = linkingconss[i];
904  int block = linkingconsblocks[i];
905  SCIP_Real activity;
906  SCIP_Real infeasibility;
907  mastervar = SCIPgetVarsLinear(scip_, linkingcons)[0];
908  assert(GCGvarIsMaster(mastervar));
909 
910  pricingvar = GCGlinkingVarGetPricingVars(GCGmasterVarGetOrigvars(mastervar)[0])[block];
911  assert(GCGvarIsPricing(pricingvar));
912  SCIP* pricingprob = GCGgetPricingprob(origprob, block);
913  assert(pricingprob != NULL);
914 
915  assert(pricingcols[block] != NULL);
916 
917  assert(stabcenterlinkingconsvals != NULL);
918  SCIP_Real masterval = SCIPgetSolVal(scip_, (SCIP_SOL*) NULL, mastervar);
919  SCIP_Real pricingval = GCGcolGetSolVal(pricingprob, pricingcols[block], pricingvar);
920  assert(!SCIPisInfinity(scip_, ABS(masterval)));
921  assert(!SCIPisInfinity(scip_, ABS(pricingval)));
922  activity = (masterval - pricingval);
923 
924  infeasibility = activity;
925 
926  assert(subgradientlinkingconsvals != NULL);
927  assert(!SCIPisInfinity(scip_, SQR(infeasibility)));
928 
929  subgradientlinkingconsvals[i] = infeasibility;
930 
931  if( SCIPisPositive(scip_, SQR(infeasibility)) )
932  subgradientnorm += SQR(infeasibility);
933  }
934 
935 
936  assert(!SCIPisNegative(scip_, subgradientnorm));
937 
938  subgradientnorm = SQRT(subgradientnorm);
939 
940  SCIPdebugMessage("Update subgradient and subgradientnorm with value %g.\n", subgradientnorm);
941 }
942 
943 /**< calculate norm of difference between stabcenter and current duals */
944 void Stabilization::calculateDualdiffnorm()
945 {
946  SCIP* origprob = GCGmasterGetOrigprob(scip_);
947  SCIP_CONS** masterconss = GCGgetMasterConss(origprob);
948  SCIP_CONS** linkingconss = GCGgetVarLinkingconss(origprob);
949  int nlinkingconss = GCGgetNVarLinkingconss(origprob);
950  assert(nstabcenterlinkingconsvals <= GCGgetNVarLinkingconss(origprob) );
951  int nconss = GCGgetNMasterConss(origprob);
952  assert(nconss <= nstabcenterconsvals);
953  SCIP_ROW** mastercuts = GCGsepaGetMastercuts(scip_);
954  int ncuts = GCGsepaGetNCuts(scip_);
955  assert(ncuts <= nstabcentercutvals);
956 
957  dualdiffnorm = 0.0;
958 
959  /* masterconss */
960  assert(stabcenterconsvals != NULL);
961 
962  for( int i = 0; i < nconss; ++i )
963  {
964  SCIP_Real dualdiff = SQR(stabcenterconsvals[i] - pricingtype->consGetDual(scip_, masterconss[i]));
965 
966  if( SCIPisPositive(scip_, dualdiff) )
967  dualdiffnorm += dualdiff;
968  }
969 
970  /* mastercuts */
971  assert(stabcenterconsvals != NULL);
972 
973  for( int i = 0; i < ncuts; ++i )
974  {
975  SCIP_Real dualdiff = SQR(stabcentercutvals[i] - pricingtype->rowGetDual(mastercuts[i]));
976 
977  if( SCIPisPositive(scip_, dualdiff) )
978  dualdiffnorm += dualdiff;
979  }
980 
981  /* linkingconss */
982  assert(stabcenterlinkingconsvals != NULL);
983 
984  for( int i = 0; i < nlinkingconss; ++i )
985  {
986  SCIP_Real dualdiff = SQR(stabcenterlinkingconsvals[i] - pricingtype->consGetDual(scip_, linkingconss[i]));
987 
988  if( SCIPisPositive(scip_, dualdiff) )
989  dualdiffnorm += dualdiff;
990  }
991 
992  dualdiffnorm = SQRT(dualdiffnorm);
993  SCIPdebugMessage("Update dualdiffnorm with value %g.\n", dualdiffnorm);
994 }
995 
996 /**< calculate beta */
997 void Stabilization::calculateBeta()
998 {
999  SCIP* origprob = GCGmasterGetOrigprob(scip_);
1000  SCIP_CONS** masterconss = GCGgetMasterConss(origprob);
1001  SCIP_CONS** linkingconss = GCGgetVarLinkingconss(origprob);
1002  int nlinkingconss = GCGgetNVarLinkingconss(origprob);
1003  assert(nstabcenterlinkingconsvals <= GCGgetNVarLinkingconss(origprob) );
1004  int nconss = GCGgetNMasterConss(origprob);
1005  assert(nconss <= nstabcenterconsvals);
1006  SCIP_ROW** mastercuts = GCGsepaGetMastercuts(scip_);
1007  int ncuts = GCGsepaGetNCuts(scip_);
1008  assert(ncuts <= nstabcentercutvals);
1009 
1010  beta = 0.0;
1011 
1012  /* masterconss */
1013  assert(stabcenterconsvals != NULL);
1014 
1015  for( int i = 0; i < nconss; ++i )
1016  {
1017  SCIP_Real dualdiff = ABS(pricingtype->consGetDual(scip_, masterconss[i]) - stabcenterconsvals[i]);
1018  SCIP_Real product = dualdiff * ABS(subgradientconsvals[i]);
1019 
1020  if( SCIPisPositive(scip_, product) )
1021  beta += product;
1022  }
1023 
1024  /* mastercuts */
1025  assert(stabcentercutvals != NULL || ncuts == 0);
1026 
1027  for( int i = 0; i < ncuts; ++i )
1028  {
1029  SCIP_Real dualdiff = ABS(pricingtype->rowGetDual(mastercuts[i]) - stabcentercutvals[i]);
1030  SCIP_Real product = dualdiff * ABS(subgradientcutvals[i]);
1031 
1032  if( SCIPisPositive(scip_, product) )
1033  beta += product;
1034  }
1035 
1036  /* linkingconss */
1037  assert(stabcenterlinkingconsvals != NULL);
1038 
1039  for( int i = 0; i < nlinkingconss; ++i )
1040  {
1041  SCIP_Real dualdiff = ABS(pricingtype->consGetDual(scip_, linkingconss[i]) - stabcenterlinkingconsvals[i]);
1042  SCIP_Real product = dualdiff * ABS(subgradientlinkingconsvals[i]);
1043 
1044  if( SCIPisPositive(scip_, product) )
1045  beta += product;
1046  }
1047 
1048  if( SCIPisPositive(scip_, subgradientnorm) )
1049  beta = beta / (subgradientnorm * dualdiffnorm);
1050 
1051  SCIPdebugMessage("Update beta with value %g.\n", beta);
1052 
1053  assert( ( SCIPisPositive(scip_, beta) || SCIPisZero(scip_, subgradientnorm)) && SCIPisLE(scip_, beta, 1.0) );
1054 }
1055 
1056 /**< calculate factor that is needed in hybrid stabilization */
1057 void Stabilization::calculateHybridFactor()
1058 {
1059  SCIP* origprob = GCGmasterGetOrigprob(scip_);
1060  SCIP_CONS** masterconss = GCGgetMasterConss(origprob);
1061 
1062  SCIP_CONS** linkingconss = GCGgetVarLinkingconss(origprob);
1063  int nlinkingconss = GCGgetNVarLinkingconss(origprob);
1064  assert(nstabcenterlinkingconsvals <= GCGgetNVarLinkingconss(origprob) );
1065  int nconss = GCGgetNMasterConss(origprob);
1066  assert(nconss <= nstabcenterconsvals);
1067  SCIP_ROW** mastercuts = GCGsepaGetMastercuts(scip_);
1068  int ncuts = GCGsepaGetNCuts(scip_);
1069  assert(ncuts <= nstabcentercutvals);
1070 
1071  SCIP_Real divisornorm = 0.0;
1072 
1073  /* masterconss */
1074  assert(stabcenterconsvals != NULL);
1075 
1076  for( int i = 0; i < nconss; ++i )
1077  {
1078  SCIP_Real divisor = SQR((beta - 1.0) * stabcenterconsvals[i]
1079  + beta * (subgradientconsvals[i] * dualdiffnorm / subgradientnorm)
1080  + (1 - beta) * pricingtype->consGetDual(scip_, masterconss[i]));
1081 
1082  if( SCIPisPositive(scip_, divisor) )
1083  divisornorm += divisor;
1084  }
1085 
1086  /* mastercuts */
1087  assert(stabcenterconsvals != NULL);
1088 
1089  for( int i = 0; i < ncuts; ++i )
1090  {
1091  SCIP_Real divisor = SQR((beta - 1.0) * stabcentercutvals[i]
1092  + beta * (subgradientcutvals[i] * dualdiffnorm / subgradientnorm)
1093  + (1 - beta) * pricingtype->rowGetDual(mastercuts[i]));
1094 
1095  if( SCIPisPositive(scip_, divisor) )
1096  divisornorm += divisor;
1097  }
1098 
1099  /* linkingconss */
1100  assert(stabcenterlinkingconsvals != NULL);
1101 
1102  for( int i = 0; i < nlinkingconss; ++i )
1103  {
1104  SCIP_Real divisor = SQR((beta - 1.0) * stabcenterlinkingconsvals[i]
1105  + beta * (subgradientlinkingconsvals[i] * dualdiffnorm / subgradientnorm)
1106  + (1 - beta) * pricingtype->consGetDual(scip_, linkingconss[i]));
1107 
1108  if( SCIPisPositive(scip_, divisor) )
1109  divisornorm += divisor;
1110  }
1111 
1112  divisornorm = SQRT(divisornorm);
1113 
1114  hybridfactor = ((1 - alpha) * dualdiffnorm) / divisornorm;
1115 
1116  SCIPdebugMessage("Update hybridfactor with value %g.\n", hybridfactor);
1117 
1118  assert( SCIPisPositive(scip_, hybridfactor) );
1119 }
1120 
1121 
1123 {
1124  if( inmispricingschedule )
1125  return SCIPisGT(scip_, alphabar, 0.0);
1126  return SCIPisGT(scip_, alpha, 0.0);
1127 }
1128 
1129 /** enabling mispricing schedule */
1131 )
1132 {
1133  inmispricingschedule = TRUE;
1134 }
1135 
1136 /** disabling mispricing schedule */
1138 )
1139 {
1140  inmispricingschedule = FALSE;
1141  k=0;
1142 }
1143 
1144 /** is mispricing schedule enabled */
1146 ) const
1147 {
1148  return inmispricingschedule;
1149 }
1150 
1151 /** update subgradient product */
1153  GCG_COL** pricingcols /**< solutions of the pricing problems */
1154 )
1155 {
1156  /* first update the arrays */
1157  SCIP_CALL( updateStabcenterconsvals() );
1158  SCIP_CALL( updateStabcentercutvals() );
1159 
1160  subgradientproduct = calculateSubgradientProduct(pricingcols);
1161 
1162  return SCIP_OKAY;
1163 }
1164 
1165 
1166 } /* namespace gcg */
SCIP_Real GCGconsGetRhs(SCIP *scip, SCIP_CONS *cons)
Definition: scip_misc.c:108
class with functions for dual variable smoothing
int GCGgetNMasterConss(SCIP *scip)
Definition: relax_gcg.c:4079
GCG interface methods.
SCIP_Bool GCGvarIsMaster(SCIP_VAR *var)
Definition: gcgvar.c:150
int GCGgetNVarLinkingconss(SCIP *scip)
Definition: relax_gcg.c:5043
SCIP_Real GCGconsGetLhs(SCIP *scip, SCIP_CONS *cons)
Definition: scip_misc.c:206
SCIP_VAR ** GCGoriginalVarGetMastervars(SCIP_VAR *var)
Definition: gcgvar.c:587
SCIP_Real GCGcolGetSolVal(SCIP *scip, GCG_COL *gcgcol, SCIP_VAR *var)
Definition: gcgcol.c:613
SCIP_CONS ** GCGgetVarLinkingconss(SCIP *scip)
Definition: relax_gcg.c:5005
SCIP_RETCODE setNConvconsvals(int nconvconssnew)
SCIP_VAR ** GCGmasterVarGetOrigvars(SCIP_VAR *var)
Definition: gcgvar.c:908
int GCGvarGetBlock(SCIP_VAR *var)
Definition: gcgvar.c:1033
SCIP_RETCODE GCGconsGetVars(SCIP *scip, SCIP_CONS *cons, SCIP_VAR **vars, int nvars)
Definition: scip_misc.c:490
public methods for working with gcg columns
virtual SCIP_Real rowGetDual(SCIP_ROW *row) const =0
SCIP_Bool GCGvarIsPricing(SCIP_VAR *var)
Definition: gcgvar.c:134
SCIP_RETCODE setNLinkingconsvals(int nlinkingconssnew)
SCIP * GCGgetPricingprob(SCIP *scip, int pricingprobnr)
Definition: relax_gcg.c:3939
SCIP_VAR * GCGoriginalVarGetPricingVar(SCIP_VAR *var)
Definition: gcgvar.c:216
int GCGgetNPricingprobs(SCIP *scip)
Definition: relax_gcg.c:3979
SCIP_Bool GCGvarIsOriginal(SCIP_VAR *var)
Definition: gcgvar.c:166
GCG variable pricer.
various SCIP helper methods
int GCGsepaGetNCuts(SCIP *scip)
Definition: sepa_master.c:419
SCIP_ROW ** GCGsepaGetOrigcuts(SCIP *scip)
Definition: sepa_master.c:400
int * GCGgetVarLinkingconssBlock(SCIP *scip)
Definition: relax_gcg.c:5024
SCIP_Real linkingconsGetDual(int i)
master separator
SCIP_Real convGetDual(int i)
int GCGgetNIdenticalBlocks(SCIP *scip, int pricingprobnr)
Definition: relax_gcg.c:4053
SCIP * GCGmasterGetOrigprob(SCIP *scip)
SCIP_RETCODE GCGconsGetVals(SCIP *scip, SCIP_CONS *cons, SCIP_Real *vals, int nvals)
Definition: scip_misc.c:621
SCIP_CONS ** GCGgetOrigMasterConss(SCIP *scip)
Definition: relax_gcg.c:4117
int GCGconsGetNVars(SCIP *scip, SCIP_CONS *cons)
Definition: scip_misc.c:434
virtual SCIP_Real consGetDual(SCIP *scip, SCIP_CONS *cons) const =0
SCIP_RETCODE rowGetDual(int i, SCIP_Real *dual)
SCIP_Bool GCGisPricingprobRelevant(SCIP *scip, int pricingprobnr)
Definition: relax_gcg.c:4000
SCIP_CONS ** GCGgetMasterConss(SCIP *scip)
Definition: relax_gcg.c:4098
SCIP_RETCODE updateSubgradientProduct(GCG_COL **pricingcols)
SCIP_ROW ** GCGsepaGetMastercuts(SCIP *scip)
Definition: sepa_master.c:438
SCIP_Bool isInMispricingSchedule() const
SCIP_VAR ** GCGlinkingVarGetPricingVars(SCIP_VAR *var)
Definition: gcgvar.c:409
SCIP_RETCODE updateStabilityCenter(SCIP_Real lowerbound, SCIP_Real *dualsolconv, GCG_COL **pricingcols)
SCIP_CONS * GCGgetConvCons(SCIP *scip, int blocknr)
Definition: relax_gcg.c:4136
SCIP_RETCODE consGetDual(int i, SCIP_Real *dual)