Scippy

SCIP

Solving Constraint Integer Programs

prob.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-2017 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 prob.c
17  * @brief Methods and datastructures for storing and manipulating the main problem
18  * @author Tobias Achterberg
19  */
20 
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
23 #include <assert.h>
24 #include <string.h>
25 
26 #include "scip/def.h"
27 #include "scip/set.h"
28 #include "scip/stat.h"
29 #include "scip/event.h"
30 #include "scip/lp.h"
31 #include "scip/var.h"
32 #include "scip/prob.h"
33 #include "scip/primal.h"
34 #include "scip/tree.h"
35 #include "scip/reopt.h"
36 #include "scip/branch.h"
37 #include "scip/cons.h"
38 #include "scip/conflictstore.h"
39 #include "scip/pub_message.h"
40 #include "scip/pub_misc.h"
41 
42 
43 #define OBJSCALE_MAXDNOM 1000000LL /**< maximal denominator in objective integral scaling */
44 #define OBJSCALE_MAXSCALE 1000000.0 /**< maximal scalar to reach objective integrality */
45 #define OBJSCALE_MAXFINALSCALE 1000.0 /**< maximal final value to apply as scaling */
46 
47 
48 
49 /*
50  * dymanic memory arrays
51  */
52 
53 /** resizes vars array to be able to store at least num entries */
54 static
56  SCIP_PROB* prob, /**< problem data */
57  SCIP_SET* set, /**< global SCIP settings */
58  int num /**< minimal number of slots in array */
59  )
60 {
61  assert(prob != NULL);
62  assert(set != NULL);
63 
64  if( num > prob->varssize )
65  {
66  int newsize;
67 
68  newsize = SCIPsetCalcMemGrowSize(set, num);
69  SCIP_ALLOC( BMSreallocMemoryArray(&prob->vars, newsize) );
70  prob->varssize = newsize;
71  }
72  assert(num <= prob->varssize);
73 
74  return SCIP_OKAY;
75 }
76 
77 /** resizes fixedvars array to be able to store at least num entries */
78 static
80  SCIP_PROB* prob, /**< problem data */
81  SCIP_SET* set, /**< global SCIP settings */
82  int num /**< minimal number of slots in array */
83  )
84 {
85  assert(prob != NULL);
86  assert(set != NULL);
87 
88  if( num > prob->fixedvarssize )
89  {
90  int newsize;
91 
92  newsize = SCIPsetCalcMemGrowSize(set, num);
93  SCIP_ALLOC( BMSreallocMemoryArray(&prob->fixedvars, newsize) );
94  prob->fixedvarssize = newsize;
95  }
96  assert(num <= prob->fixedvarssize);
97 
98  return SCIP_OKAY;
99 }
100 
101 /** resizes deletedvars array to be able to store at least num entries */
102 static
104  SCIP_PROB* prob, /**< problem data */
105  SCIP_SET* set, /**< global SCIP settings */
106  int num /**< minimal number of slots in array */
107  )
108 {
109  assert(prob != NULL);
110  assert(set != NULL);
111 
112  if( num > prob->deletedvarssize )
113  {
114  int newsize;
115 
116  newsize = SCIPsetCalcMemGrowSize(set, num);
117  SCIP_ALLOC( BMSreallocMemoryArray(&prob->deletedvars, newsize) );
118  prob->deletedvarssize = newsize;
119  }
120  assert(num <= prob->deletedvarssize);
121 
122  return SCIP_OKAY;
123 }
124 
125 /** resizes conss array to be able to store at least num entries */
126 static
128  SCIP_PROB* prob, /**< problem data */
129  SCIP_SET* set, /**< global SCIP settings */
130  int num /**< minimal number of slots in array */
131  )
132 {
133  assert(prob != NULL);
134  assert(set != NULL);
135 
136  if( num > prob->consssize )
137  {
138  int newsize;
139 
140  newsize = SCIPsetCalcMemGrowSize(set, num);
141  SCIP_ALLOC( BMSreallocMemoryArray(&prob->conss, newsize) );
142  prob->consssize = newsize;
143  }
144  assert(num <= prob->consssize);
145 
146  return SCIP_OKAY;
147 }
148 
149 /** returns whether the constraint has a name */
150 static
152  SCIP_CONS* cons /**< constraint */
153  )
154 {
155  const char* name;
156 
157  name = SCIPconsGetName(cons);
158 
159  return (name != NULL && name[0] != '\0');
160 }
161 
162 /** returns whether the variable has a name */
163 static
165  SCIP_VAR* var /**< variable */
166  )
167 {
168  const char* name;
169 
170  name = SCIPvarGetName(var);
171 
172  return (name != NULL && name[0] != '\0');
173 }
174 
175 
176 
177 /*
178  * problem creation
179  */
180 
181 /** creates problem data structure by copying the source problem
182  *
183  * If the problem type requires the use of variable pricers, these pricers should be activated with calls
184  * to SCIPactivatePricer(). These pricers are automatically deactivated, when the problem is freed.
185  */
187  SCIP_PROB** prob, /**< pointer to problem data structure */
188  BMS_BLKMEM* blkmem, /**< block memory */
189  SCIP_SET* set, /**< global SCIP settings */
190  const char* name, /**< problem name */
191  SCIP* sourcescip, /**< source SCIP data structure */
192  SCIP_PROB* sourceprob, /**< source problem structure */
193  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
194  * target variables */
195  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
196  * target constraints */
197  SCIP_Bool global /**< create a global or a local copy? */
198  )
199 {
200  SCIP_PROBDATA* targetdata = NULL;
201  SCIP_RESULT result = SCIP_DIDNOTRUN;
202 
203  assert(prob != NULL);
204  assert(set != NULL);
205  assert(blkmem != NULL);
206  assert(sourcescip != NULL);
207  assert(sourceprob != NULL);
208  assert(varmap != NULL);
209  assert(consmap != NULL);
210 
211  /* create problem and initialize callbacks with NULL */
212  SCIP_CALL( SCIPprobCreate(prob, blkmem, set, name, NULL, NULL, NULL, NULL, NULL, NULL, NULL, FALSE) );
213 
214  /* call user copy callback method */
215  if( sourceprob->probdata != NULL && sourceprob->probcopy != NULL )
216  {
217  SCIP_CALL( sourceprob->probcopy(set->scip, sourcescip, sourceprob->probdata, varmap, consmap, &targetdata, global, &result) );
218 
219  /* evaluate result */
220  if( result != SCIP_DIDNOTRUN && result != SCIP_SUCCESS )
221  {
222  SCIPerrorMessage("probdata copying method returned invalid result <%d>\n", result);
223  return SCIP_INVALIDRESULT;
224  }
225 
226  assert(targetdata == NULL || result == SCIP_SUCCESS);
227 
228  /* if copying was successful, add data and callbacks */
229  if( result == SCIP_SUCCESS )
230  {
231  assert( targetdata != NULL );
232  (*prob)->probdelorig = sourceprob->probdelorig;
233  (*prob)->probtrans = sourceprob->probtrans;
234  (*prob)->probdeltrans = sourceprob->probdeltrans;
235  (*prob)->probinitsol = sourceprob->probinitsol;
236  (*prob)->probexitsol = sourceprob->probexitsol;
237  (*prob)->probcopy = sourceprob->probcopy;
238  (*prob)->probdata = targetdata;
239  }
240  }
241 
242  return SCIP_OKAY;
243 }
244 
245 /** creates problem data structure
246  * If the problem type requires the use of variable pricers, these pricers should be activated with calls
247  * to SCIPactivatePricer(). These pricers are automatically deactivated, when the problem is freed.
248  */
250  SCIP_PROB** prob, /**< pointer to problem data structure */
251  BMS_BLKMEM* blkmem, /**< block memory */
252  SCIP_SET* set, /**< global SCIP settings */
253  const char* name, /**< problem name */
254  SCIP_DECL_PROBDELORIG ((*probdelorig)), /**< frees user data of original problem */
255  SCIP_DECL_PROBTRANS ((*probtrans)), /**< creates user data of transformed problem by transforming original user data */
256  SCIP_DECL_PROBDELTRANS((*probdeltrans)), /**< frees user data of transformed problem */
257  SCIP_DECL_PROBINITSOL ((*probinitsol)), /**< solving process initialization method of transformed data */
258  SCIP_DECL_PROBEXITSOL ((*probexitsol)), /**< solving process deinitialization method of transformed data */
259  SCIP_DECL_PROBCOPY ((*probcopy)), /**< copies user data if you want to copy it to a subscip, or NULL */
260  SCIP_PROBDATA* probdata, /**< user problem data set by the reader */
261  SCIP_Bool transformed /**< is this the transformed problem? */
262  )
263 {
264  assert(prob != NULL);
265 
266  SCIP_ALLOC( BMSallocMemory(prob) );
267  SCIP_ALLOC( BMSduplicateMemoryArray(&(*prob)->name, name, strlen(name)+1) );
268 
269  (*prob)->probdata = probdata;
270  (*prob)->probcopy = probcopy;
271  (*prob)->probdelorig = probdelorig;
272  (*prob)->probtrans = probtrans;
273  (*prob)->probdeltrans = probdeltrans;
274  (*prob)->probinitsol = probinitsol;
275  (*prob)->probexitsol = probexitsol;
276  if( set->misc_usevartable )
277  {
278  SCIP_CALL( SCIPhashtableCreate(&(*prob)->varnames, blkmem,
279  (set->misc_usesmalltables ? SCIP_HASHSIZE_NAMES_SMALL : SCIP_HASHSIZE_NAMES),
280  SCIPhashGetKeyVar, SCIPhashKeyEqString, SCIPhashKeyValString, NULL) );
281  }
282  else
283  (*prob)->varnames = NULL;
284  (*prob)->vars = NULL;
285  (*prob)->varssize = 0;
286  (*prob)->nvars = 0;
287  (*prob)->nbinvars = 0;
288  (*prob)->nintvars = 0;
289  (*prob)->nimplvars = 0;
290  (*prob)->ncontvars = 0;
291  (*prob)->ncolvars = 0;
292  (*prob)->fixedvars = NULL;
293  (*prob)->fixedvarssize = 0;
294  (*prob)->nfixedvars = 0;
295  (*prob)->deletedvars = NULL;
296  (*prob)->deletedvarssize = 0;
297  (*prob)->ndeletedvars = 0;
298  (*prob)->nobjvars = 0;
299  if( set->misc_useconstable )
300  {
301  SCIP_CALL( SCIPhashtableCreate(&(*prob)->consnames, blkmem,
302  (set->misc_usesmalltables ? SCIP_HASHSIZE_NAMES_SMALL : SCIP_HASHSIZE_NAMES),
303  SCIPhashGetKeyCons, SCIPhashKeyEqString, SCIPhashKeyValString, NULL) );
304  }
305  else
306  (*prob)->consnames = NULL;
307  (*prob)->conss = NULL;
308  (*prob)->consssize = 0;
309  (*prob)->nconss = 0;
310  (*prob)->maxnconss = 0;
311  (*prob)->startnvars = 0;
312  (*prob)->startnconss = 0;
313  (*prob)->objsense = SCIP_OBJSENSE_MINIMIZE;
314  (*prob)->objoffset = 0.0;
315  (*prob)->objscale = 1.0;
316  (*prob)->objlim = SCIP_INVALID;
317  (*prob)->dualbound = SCIP_INVALID;
318  (*prob)->objisintegral = FALSE;
319  (*prob)->transformed = transformed;
320  (*prob)->nlpenabled = FALSE;
321  (*prob)->permuted = FALSE;
322  (*prob)->conscompression = FALSE;
323 
324  return SCIP_OKAY;
325 }
326 
327 /** sets callback to free user data of original problem */
329  SCIP_PROB* prob, /**< problem */
330  SCIP_DECL_PROBDELORIG ((*probdelorig)) /**< frees user data of original problem */
331  )
332 {
333  assert(prob != NULL);
334 
335  prob->probdelorig = probdelorig;
336 }
337 
338 /** sets callback to create user data of transformed problem by transforming original user data */
340  SCIP_PROB* prob, /**< problem */
341  SCIP_DECL_PROBTRANS ((*probtrans)) /**< creates user data of transformed problem by transforming original user data */
342  )
343 {
344  assert(prob != NULL);
345 
346  prob->probtrans = probtrans;
347 }
348 
349 /** sets callback to free user data of transformed problem */
351  SCIP_PROB* prob, /**< problem */
352  SCIP_DECL_PROBDELTRANS((*probdeltrans)) /**< frees user data of transformed problem */
353  )
354 {
355  assert(prob != NULL);
356 
357  prob->probdeltrans = probdeltrans;
358 }
359 
360 /** sets solving process initialization callback of transformed data */
362  SCIP_PROB* prob, /**< problem */
363  SCIP_DECL_PROBINITSOL ((*probinitsol)) /**< solving process initialization callback of transformed data */
364  )
365 {
366  assert(prob != NULL);
367 
368  prob->probinitsol= probinitsol;
369 }
370 
371 /** sets solving process deinitialization callback of transformed data */
373  SCIP_PROB* prob, /**< problem */
374  SCIP_DECL_PROBEXITSOL ((*probexitsol)) /**< solving process deinitialization callback of transformed data */
375  )
376 {
377  assert(prob != NULL);
378 
379  prob->probexitsol= probexitsol;
380 }
381 
382 /** sets callback to copy user data to copy it to a subscip, or NULL */
384  SCIP_PROB* prob, /**< problem */
385  SCIP_DECL_PROBCOPY ((*probcopy)) /**< copies user data if you want to copy it to a subscip, or NULL */
386  )
387 {
388  assert(prob != NULL);
389 
390  prob->probcopy= probcopy;
391 }
392 
393 /** frees problem data structure */
395  SCIP_PROB** prob, /**< pointer to problem data structure */
396  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
397  BMS_BLKMEM* blkmem, /**< block memory buffer */
398  SCIP_SET* set, /**< global SCIP settings */
399  SCIP_STAT* stat, /**< dynamic problem statistics */
400  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
401  SCIP_LP* lp /**< current LP data (or NULL, if it's the original problem) */
402  )
403 {
404  SCIP_Bool warnreleasevar = TRUE;
405  int v;
406 
407  assert(prob != NULL);
408  assert(*prob != NULL);
409  assert(set != NULL);
410 
411  /* remove all constraints from the problem */
412  while( (*prob)->nconss > 0 )
413  {
414  /*@todo for debug mode it even might sense, to sort them downwards after their arraypos */
415  assert((*prob)->conss != NULL);
416  SCIP_CALL( SCIPprobDelCons(*prob, blkmem, set, stat, (*prob)->conss[(*prob)->nconss - 1]) );
417  }
418 
419  if( (*prob)->transformed )
420  {
421  int h;
422 
423  /* unlock variables for all constraint handlers that don't need constraints */
424  for( h = 0; h < set->nconshdlrs; ++h )
425  {
426  if( !SCIPconshdlrNeedsCons(set->conshdlrs[h]) )
427  {
428  SCIP_CALL( SCIPconshdlrUnlockVars(set->conshdlrs[h], set) );
429  }
430  }
431  }
432 
433  /* free constraint array */
434  BMSfreeMemoryArrayNull(&(*prob)->conss);
435 
436  /* free user problem data */
437  if( (*prob)->transformed )
438  {
439  if( (*prob)->probdeltrans != NULL )
440  {
441  SCIP_CALL( (*prob)->probdeltrans(set->scip, &(*prob)->probdata) );
442  }
443  }
444  else
445  {
446  if( (*prob)->probdelorig != NULL )
447  {
448  SCIP_CALL( (*prob)->probdelorig(set->scip, &(*prob)->probdata) );
449  }
450  }
451 
452  /* release problem variables */
453  for( v = (*prob)->nvars - 1; v >= 0; --v )
454  {
455  assert(SCIPvarGetProbindex((*prob)->vars[v]) >= 0);
456 
457  if ( warnreleasevar && SCIPvarGetNUses((*prob)->vars[v]) > 1 )
458  {
459  SCIPmessageFPrintWarning(messagehdlr, "%s variable <%s> not released when freeing SCIP. Consider releasing variable first.\n",
460  (*prob)->transformed ? "Transformed" : "Original", SCIPvarGetName((*prob)->vars[v]));
461  warnreleasevar = FALSE;
462  }
463 
464  SCIP_CALL( SCIPvarRemove((*prob)->vars[v], blkmem, NULL, set, TRUE) );
465  SCIP_CALL( SCIPvarRelease(&(*prob)->vars[v], blkmem, set, eventqueue, lp) );
466  }
467  BMSfreeMemoryArrayNull(&(*prob)->vars);
468 
469  /* release fixed problem variables */
470  for( v = (*prob)->nfixedvars - 1; v >= 0; --v )
471  {
472  assert(SCIPvarGetProbindex((*prob)->fixedvars[v]) == -1);
473 
474  if ( warnreleasevar && SCIPvarGetNUses((*prob)->fixedvars[v]) > 1 )
475  {
476  SCIPmessageFPrintWarning(messagehdlr, "%s variable <%s> not released when freeing SCIP. Consider releasing variable first.\n",
477  (*prob)->transformed ? "Transformed" : "Original", SCIPvarGetName((*prob)->fixedvars[v]));
478  warnreleasevar = FALSE;
479  }
480 
481  SCIP_CALL( SCIPvarRelease(&(*prob)->fixedvars[v], blkmem, set, eventqueue, lp) );
482  }
483  BMSfreeMemoryArrayNull(&(*prob)->fixedvars);
484 
485  /* free deleted problem variables array */
486  BMSfreeMemoryArrayNull(&(*prob)->deletedvars);
487 
488  /* free hash tables for names */
489  if( (*prob)->varnames != NULL )
490  {
491  SCIPhashtableFree(&(*prob)->varnames);
492  }
493  if( (*prob)->consnames != NULL )
494  {
495  SCIPhashtableFree(&(*prob)->consnames);
496  }
497  BMSfreeMemoryArray(&(*prob)->name);
498  BMSfreeMemory(prob);
499 
500  return SCIP_OKAY;
501 }
502 
503 /** transform problem data into normalized form */
505  SCIP_PROB* source, /**< problem to transform */
506  BMS_BLKMEM* blkmem, /**< block memory buffer */
507  SCIP_SET* set, /**< global SCIP settings */
508  SCIP_STAT* stat, /**< problem statistics */
509  SCIP_PRIMAL* primal, /**< primal data */
510  SCIP_TREE* tree, /**< branch and bound tree */
511  SCIP_REOPT* reopt, /**< reoptimization data structure */
512  SCIP_LP* lp, /**< current LP data */
513  SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
514  SCIP_EVENTFILTER* eventfilter, /**< event filter for global (not variable dependent) events */
515  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
516  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
517  SCIP_PROB** target /**< pointer to target problem data structure */
518  )
519 {
520  SCIP_VAR* targetvar;
521  SCIP_CONS* targetcons;
522  char transname[SCIP_MAXSTRLEN];
523  int v;
524  int c;
525  int h;
526 
527  assert(set != NULL);
528  assert(source != NULL);
529  assert(blkmem != NULL);
530  assert(target != NULL);
531 
532  SCIPsetDebugMsg(set, "transform problem: original has %d variables\n", source->nvars);
533 
534  /* create target problem data (probdelorig and probtrans are not needed, probdata is set later) */
535  (void) SCIPsnprintf(transname, SCIP_MAXSTRLEN, "t_%s", source->name);
536  SCIP_CALL( SCIPprobCreate(target, blkmem, set, transname, source->probdelorig, source->probtrans, source->probdeltrans,
537  source->probinitsol, source->probexitsol, source->probcopy, NULL, TRUE) );
538  SCIPprobSetObjsense(*target, source->objsense);
539 
540  /* transform objective limit */
541  if( source->objlim < SCIP_INVALID )
542  SCIPprobSetObjlim(*target, source->objlim);
543 
544  /* transform dual bound */
545  if( source->dualbound < SCIP_INVALID )
546  SCIPprobSetDualbound(*target, source->dualbound);
547 
548  /* transform and copy all variables to target problem */
549  SCIP_CALL( probEnsureVarsMem(*target, set, source->nvars) );
550  for( v = 0; v < source->nvars; ++v )
551  {
552  SCIP_CALL( SCIPvarTransform(source->vars[v], blkmem, set, stat, source->objsense, &targetvar) );
553  SCIP_CALL( SCIPprobAddVar(*target, blkmem, set, lp, branchcand, eventfilter, eventqueue, targetvar) );
554  SCIP_CALL( SCIPvarRelease(&targetvar, blkmem, set, eventqueue, NULL) );
555  }
556  assert((*target)->nvars == source->nvars);
557  assert((*target)->nobjvars == SCIPprobGetNObjVars(*target, set));
558 
559  /* call user data transformation */
560  if( source->probtrans != NULL )
561  {
562  SCIP_CALL( source->probtrans(set->scip, source->probdata, &(*target)->probdata) );
563  }
564  else
565  (*target)->probdata = source->probdata;
566 
567  /* transform and copy all constraints to target problem */
568  for( c = 0; c < source->nconss; ++c )
569  {
570  SCIP_CALL( SCIPconsTransform(source->conss[c], blkmem, set, &targetcons) );
571  SCIP_CALL( SCIPprobAddCons(*target, set, stat, targetcons) );
572  SCIP_CALL( SCIPconsRelease(&targetcons, blkmem, set) );
573  }
574 
575  /* lock variables for all constraint handlers that don't need constraints */
576  for( h = 0; h < set->nconshdlrs; ++h )
577  {
578  if( !SCIPconshdlrNeedsCons(set->conshdlrs[h]) )
579  {
580  SCIP_CALL( SCIPconshdlrLockVars(set->conshdlrs[h], set) );
581  }
582  }
583 
584  /* objective value is always integral, iff original objective value is always integral and shift is integral */
585  (*target)->objisintegral = source->objisintegral && SCIPsetIsIntegral(set, (*target)->objoffset);
586 
587  /* check, whether objective value is always integral by inspecting the problem, if it is the case adjust the
588  * cutoff bound if primal solution is already known
589  */
590  SCIP_CALL( SCIPprobCheckObjIntegral(*target, source, blkmem, set, stat, primal, tree, reopt, lp, eventqueue) );
591 
592  /* copy the nlpenabled flag */
593  (*target)->nlpenabled = source->nlpenabled;
594 
595  /* mark the transformed problem to be permuted iff the source problem is permuted */
596  (*target)->permuted = source->permuted;
597 
598  /* transform the conflict pool */
599  SCIP_CALL( SCIPconflictstoreTransform(conflictstore, blkmem, set, stat, tree, *target, reopt) );
600 
601  return SCIP_OKAY;
602 }
603 
604 /** resets the global and local bounds of original variables in original problem to their original values */
606  SCIP_PROB* prob, /**< original problem data */
607  BMS_BLKMEM* blkmem, /**< block memory */
608  SCIP_SET* set, /**< global SCIP settings */
609  SCIP_STAT* stat /**< problem statistics */
610  )
611 {
612  int v;
613 
614  assert(prob != NULL);
615  assert(prob->nfixedvars == 0);
616 
617  for( v = 0; v < prob->nvars; ++v )
618  {
619  SCIP_CALL( SCIPvarResetBounds(prob->vars[v], blkmem, set, stat) );
620  }
621 
622  return SCIP_OKAY;
623 }
624 
625 /** (Re)Sort the variables, which appear in the four categories (binary, integer, implicit, continuous) after presolve
626  * with respect to their original index (within their categories). Adjust the problem index afterwards which is
627  * supposed to reflect the position in the variable array. This additional (re)sorting is supposed to get more robust
628  * against the order presolving fixed variables. (We also reobtain a possible block structure induced by the user
629  * model)
630  */
632  SCIP_PROB* prob /**< problem data */
633  )
634 {
635  SCIP_VAR** vars;
636  int nbinvars;
637  int nintvars;
638  int nimplvars;
639  int ncontvars;
640  int nvars;
641  int v;
642 
643  vars = prob->vars;
644  nvars = prob->nvars;
645  nbinvars = prob->nbinvars;
646  nintvars = prob->nintvars;
647  nimplvars = prob->nimplvars;
648  ncontvars = prob->ncontvars;
649 
650  if( nvars == 0 )
651  return;
652 
653  assert(vars != NULL);
654  assert(nbinvars + nintvars + nimplvars + ncontvars == nvars);
655 
656  SCIPdebugMessage("entering sorting with respect to original block structure! \n");
657 
658  /* sort binaries */
659  if( nbinvars > 0 )
660  SCIPsortPtr((void**)vars, SCIPvarComp, nbinvars);
661 
662  /* sort integers */
663  if( nintvars > 0 )
664  SCIPsortPtr((void**)&vars[nbinvars], SCIPvarComp, nintvars);
665 
666  /* sort implicit variables */
667  if( nimplvars > 0 )
668  SCIPsortPtr((void**)&vars[nbinvars + nintvars], SCIPvarComp, nimplvars);
669 
670  /* sort continuous variables*/
671  if( ncontvars > 0 )
672  SCIPsortPtr((void**)&vars[nbinvars + nintvars + nimplvars], SCIPvarComp, ncontvars);
673 
674  /* after sorting, the problem index of each variable has to be adjusted */
675  for( v = 0; v < nvars; ++v )
676  {
677  vars[v]->probindex = v;
678  SCIPdebugMessage("Variable: Problem index <%d>, original index <%d> \n", vars[v]->probindex, vars[v]->index);
679  }
680 }
681 
682 
683 
684 /*
685  * problem modification
686  */
687 
688 /** sets user problem data */
690  SCIP_PROB* prob, /**< problem */
691  SCIP_PROBDATA* probdata /**< user problem data to use */
692  )
693 {
694  assert(prob != NULL);
695 
696  prob->probdata = probdata;
697 }
698 
699 /** inserts variable at the correct position in vars array, depending on its type */
700 static
702  SCIP_PROB* prob, /**< problem data */
703  SCIP_VAR* var /**< variable to insert */
704  )
705 {
706  int insertpos;
707  int intstart;
708  int implstart;
709  int contstart;
710 
711  assert(prob != NULL);
712  assert(prob->vars != NULL);
713  assert(prob->nvars < prob->varssize);
714  assert(var != NULL);
715  assert(SCIPvarGetProbindex(var) == -1);
719  /* original variables cannot go into transformed problem and transformed variables cannot go into original problem */
720  assert((SCIPvarGetStatus(var) != SCIP_VARSTATUS_ORIGINAL) == prob->transformed);
721 
722  /* insert variable in array */
723  insertpos = prob->nvars;
724  intstart = prob->nbinvars;
725  implstart = intstart + prob->nintvars;
726  contstart = implstart + prob->nimplvars;
727 
729  prob->ncontvars++;
730  else
731  {
732  if( insertpos > contstart )
733  {
734  prob->vars[insertpos] = prob->vars[contstart];
735  SCIPvarSetProbindex(prob->vars[insertpos], insertpos);
736  insertpos = contstart;
737  }
738  assert(insertpos == contstart);
739 
741  prob->nimplvars++;
742  else
743  {
744  if( insertpos > implstart )
745  {
746  prob->vars[insertpos] = prob->vars[implstart];
747  SCIPvarSetProbindex(prob->vars[insertpos], insertpos);
748  insertpos = implstart;
749  }
750  assert(insertpos == implstart);
751 
753  prob->nintvars++;
754  else
755  {
756  assert(SCIPvarGetType(var) == SCIP_VARTYPE_BINARY);
757  if( insertpos > intstart )
758  {
759  prob->vars[insertpos] = prob->vars[intstart];
760  SCIPvarSetProbindex(prob->vars[insertpos], insertpos);
761  insertpos = intstart;
762  }
763  assert(insertpos == intstart);
764 
765  prob->nbinvars++;
766  }
767  }
768  }
769  prob->nvars++;
770 
771  assert(prob->nvars == prob->nbinvars + prob->nintvars + prob->nimplvars + prob->ncontvars);
772  assert((SCIPvarGetType(var) == SCIP_VARTYPE_BINARY && insertpos == prob->nbinvars - 1)
773  || (SCIPvarGetType(var) == SCIP_VARTYPE_INTEGER && insertpos == prob->nbinvars + prob->nintvars - 1)
774  || (SCIPvarGetType(var) == SCIP_VARTYPE_IMPLINT && insertpos == prob->nbinvars + prob->nintvars + prob->nimplvars - 1)
776  && insertpos == prob->nbinvars + prob->nintvars + prob->nimplvars + prob->ncontvars - 1));
777 
778  prob->vars[insertpos] = var;
779  SCIPvarSetProbindex(var, insertpos);
780 
781  /* update number of column variables in problem */
783  prob->ncolvars++;
784  assert(0 <= prob->ncolvars && prob->ncolvars <= prob->nvars);
785 }
786 
787 /** removes variable from vars array */
788 static
790  SCIP_PROB* prob, /**< problem data */
791  BMS_BLKMEM* blkmem, /**< block memory */
792  SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */
793  SCIP_SET* set, /**< global SCIP settings */
794  SCIP_VAR* var /**< variable to remove */
795  )
796 {
797  int freepos;
798  int intstart;
799  int implstart;
800  int contstart;
801 
802  assert(prob != NULL);
803  assert(var != NULL);
804  assert(SCIPvarGetProbindex(var) >= 0);
805  assert(prob->vars != NULL);
806  assert(prob->vars[SCIPvarGetProbindex(var)] == var);
807 
808  intstart = prob->nbinvars;
809  implstart = intstart + prob->nintvars;
810  contstart = implstart + prob->nimplvars;
811 
812  switch( SCIPvarGetType(var) )
813  {
814  case SCIP_VARTYPE_BINARY:
815  assert(0 <= SCIPvarGetProbindex(var) && SCIPvarGetProbindex(var) < intstart);
816  prob->nbinvars--;
817  break;
819  assert(intstart <= SCIPvarGetProbindex(var) && SCIPvarGetProbindex(var) < implstart);
820  prob->nintvars--;
821  break;
823  assert(implstart <= SCIPvarGetProbindex(var) && SCIPvarGetProbindex(var) < contstart);
824  prob->nimplvars--;
825  break;
827  assert(contstart <= SCIPvarGetProbindex(var) && SCIPvarGetProbindex(var) < prob->nvars);
828  prob->ncontvars--;
829  break;
830  default:
831  SCIPerrorMessage("unknown variable type\n");
832  SCIPABORT();
833  return SCIP_INVALIDDATA; /*lint !e527*/
834  }
835 
836  /* move last binary, last integer, last implicit, and last continuous variable forward to fill the free slot */
837  freepos = SCIPvarGetProbindex(var);
838  if( freepos < intstart-1 )
839  {
840  /* move last binary variable to free slot */
841  prob->vars[freepos] = prob->vars[intstart-1];
842  SCIPvarSetProbindex(prob->vars[freepos], freepos);
843  freepos = intstart-1;
844  }
845  if( freepos < implstart-1 )
846  {
847  /* move last integer variable to free slot */
848  prob->vars[freepos] = prob->vars[implstart-1];
849  SCIPvarSetProbindex(prob->vars[freepos], freepos);
850  freepos = implstart-1;
851  }
852  if( freepos < contstart-1 )
853  {
854  /* move last implicit integer variable to free slot */
855  prob->vars[freepos] = prob->vars[contstart-1];
856  SCIPvarSetProbindex(prob->vars[freepos], freepos);
857  freepos = contstart-1;
858  }
859  if( freepos < prob->nvars-1 )
860  {
861  /* move last implicit integer variable to free slot */
862  prob->vars[freepos] = prob->vars[prob->nvars-1];
863  SCIPvarSetProbindex(prob->vars[freepos], freepos);
864  freepos = prob->nvars-1;
865  }
866  assert(freepos == prob->nvars-1);
867 
868  prob->nvars--;
869  assert(prob->nvars == prob->nbinvars + prob->nintvars + prob->nimplvars + prob->ncontvars);
870 
871  /* update number of column variables in problem */
873  prob->ncolvars--;
874  assert(0 <= prob->ncolvars && prob->ncolvars <= prob->nvars);
875 
876  /* inform the variable that it is no longer in the problem; if necessary, delete it from the implication graph */
877  SCIP_CALL( SCIPvarRemove(var, blkmem, cliquetable, set, FALSE) );
878 
879  return SCIP_OKAY;
880 }
881 
882 /** adds variable's name to the namespace */
884  SCIP_PROB* prob, /**< problem data */
885  SCIP_VAR* var /**< variable */
886  )
887 {
888  assert(SCIPvarGetProbindex(var) != -1);
889 
890  if( varHasName(var) && prob->varnames != NULL )
891  {
892  SCIP_CALL( SCIPhashtableInsert(prob->varnames, (void*)var) );
893  }
894 
895  return SCIP_OKAY;
896 }
897 
898 /** removes variable's name from the namespace */
900  SCIP_PROB* prob, /**< problem data */
901  SCIP_VAR* var /**< variable */
902  )
903 {
904  if( varHasName(var) && prob->varnames != NULL )
905  {
906  assert(SCIPhashtableExists(prob->varnames, (void*)var));
907  SCIP_CALL( SCIPhashtableRemove(prob->varnames, (void*)var) );
908  }
909 
910  return SCIP_OKAY;
911 }
912 
913 /** adds variable to the problem and captures it */
915  SCIP_PROB* prob, /**< problem data */
916  BMS_BLKMEM* blkmem, /**< block memory buffers */
917  SCIP_SET* set, /**< global SCIP settings */
918  SCIP_LP* lp, /**< current LP data */
919  SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
920  SCIP_EVENTFILTER* eventfilter, /**< event filter for global (not variable dependent) events */
921  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
922  SCIP_VAR* var /**< variable to add */
923  )
924 {
925  assert(prob != NULL);
926  assert(set != NULL);
927  assert(var != NULL);
928  assert(SCIPvarGetProbindex(var) == -1);
932  /* original variables cannot go into transformed problem and transformed variables cannot go into original problem */
933  assert((SCIPvarGetStatus(var) != SCIP_VARSTATUS_ORIGINAL) == prob->transformed);
934 
935 #ifndef NDEBUG
936  /* check if we add this variables to the same scip, where we created it */
937  if( var->scip != set->scip )
938  {
939  SCIPerrorMessage("variable belongs to a different scip instance\n");
940  return SCIP_INVALIDDATA;
941  }
942 #endif
943 
944  /* capture variable */
945  SCIPvarCapture(var);
946 
947  /* allocate additional memory */
948  SCIP_CALL( probEnsureVarsMem(prob, set, prob->nvars+1) );
949 
950  /* insert variable in vars array and mark it to be in problem */
951  probInsertVar(prob, var);
952 
953  /* add variable's name to the namespace */
954  SCIP_CALL( SCIPprobAddVarName(prob, var) );
955 
956  /* update branching candidates and pseudo and loose objective value in the LP */
958  {
959  SCIP_CALL( SCIPbranchcandUpdateVar(branchcand, set, var) );
960  SCIP_CALL( SCIPlpUpdateAddVar(lp, set, var) );
961  }
962 
963  SCIPsetDebugMsg(set, "added variable <%s> to problem (%d variables: %d binary, %d integer, %d implicit, %d continuous)\n",
964  SCIPvarGetName(var), prob->nvars, prob->nbinvars, prob->nintvars, prob->nimplvars, prob->ncontvars);
965 
966  if( prob->transformed )
967  {
968  SCIP_EVENT* event;
969 
970  /* issue VARADDED event */
971  SCIP_CALL( SCIPeventCreateVarAdded(&event, blkmem, var) );
972  SCIP_CALL( SCIPeventqueueAdd(eventqueue, blkmem, set, NULL, NULL, NULL, eventfilter, &event) );
973 
974  /* update the number of variables with non-zero objective coefficient */
975  SCIPprobUpdateNObjVars(prob, set, 0.0, SCIPvarGetObj(var));
976 
977  /* set varlocks to ensure that no dual reduction can be performed */
978  if( set->reopt_enable || !set->misc_allowdualreds )
979  {
980  SCIP_CALL( SCIPvarAddLocks(var, blkmem, set, eventqueue, 1, 1) );
981  }
982 
983  /* SCIP assumes that the status of objisintegral does not change after transformation. Thus, the objective of all
984  * new variables beyond that stage has to be compatible. */
985  assert( SCIPsetGetStage(set) == SCIP_STAGE_TRANSFORMING || ! prob->objisintegral || SCIPsetIsZero(set, SCIPvarGetObj(var)) ||
986  ( SCIPvarIsIntegral(var) && SCIPsetIsIntegral(set, SCIPvarGetObj(var)) ) );
987  }
988 
989  return SCIP_OKAY;
990 }
991 
992 /** marks variable to be removed from the problem; however, the variable is NOT removed from the constraints */
994  SCIP_PROB* prob, /**< problem data */
995  BMS_BLKMEM* blkmem, /**< block memory */
996  SCIP_SET* set, /**< global SCIP settings */
997  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
998  SCIP_VAR* var, /**< problem variable */
999  SCIP_Bool* deleted /**< pointer to store whether marking variable to be deleted was successful */
1000  )
1001 {
1002  assert(prob != NULL);
1003  assert(set != NULL);
1004  assert(var != NULL);
1005  assert(deleted != NULL);
1006  assert(SCIPvarGetProbindex(var) != -1);
1010 
1011  *deleted = FALSE;
1012 
1013  /* don't remove variables that are not in the problem */
1014  /**@todo what about negated variables? should the negation variable be removed instead? */
1015  if( SCIPvarGetProbindex(var) == -1 )
1016  return SCIP_OKAY;
1017 
1018  /* don't remove the direct counterpart of an original variable from the transformed problem, because otherwise
1019  * operations on the original variables would be applied to a NULL pointer
1020  */
1021  if( SCIPvarIsTransformedOrigvar(var) )
1022  return SCIP_OKAY;
1023 
1024  assert(SCIPvarGetNegatedVar(var) == NULL);
1025 
1026  SCIPsetDebugMsg(set, "deleting variable <%s> from problem (%d variables: %d binary, %d integer, %d implicit, %d continuous)\n",
1027  SCIPvarGetName(var), prob->nvars, prob->nbinvars, prob->nintvars, prob->nimplvars, prob->ncontvars);
1028 
1029  /* mark variable to be deleted from the problem */
1030  SCIPvarMarkDeleted(var);
1031 
1032  if( prob->transformed )
1033  {
1034  SCIP_EVENT* event;
1035 
1036  assert(eventqueue != NULL);
1037 
1038  /* issue VARDELETED event */
1039  SCIP_CALL( SCIPeventCreateVarDeleted(&event, blkmem, var) );
1040  SCIP_CALL( SCIPeventqueueAdd(eventqueue, blkmem, set, NULL, NULL, NULL, NULL, &event) );
1041  }
1042 
1043  /* remember that the variable should be deleted from the problem in SCIPprobPerformVarDeletions() */
1044  SCIP_CALL( probEnsureDeletedvarsMem(prob, set, prob->ndeletedvars+1) );
1045  prob->deletedvars[prob->ndeletedvars] = var;
1046  prob->ndeletedvars++;
1047 
1048  *deleted = TRUE;
1049 
1050  return SCIP_OKAY;
1051 }
1052 
1053 /** actually removes the deleted variables from the problem and releases them */
1055  SCIP_PROB* prob, /**< problem data */
1056  BMS_BLKMEM* blkmem, /**< block memory */
1057  SCIP_SET* set, /**< global SCIP settings */
1058  SCIP_STAT* stat, /**< dynamic problem statistics */
1059  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
1060  SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */
1061  SCIP_LP* lp, /**< current LP data (may be NULL) */
1062  SCIP_BRANCHCAND* branchcand /**< branching candidate storage */
1063  )
1064 {
1065  int i;
1066 
1067  assert(prob != NULL);
1068  assert(set != NULL);
1069 
1070  /* delete variables from the constraints;
1071  * do this only in solving stage, in presolving, it is already handled by the constraint handlers
1072  */
1073  if( SCIPsetGetStage(set) == SCIP_STAGE_SOLVING )
1074  {
1075  for( i = 0; i < set->nconshdlrs; ++i )
1076  {
1077  SCIP_CALL( SCIPconshdlrDelVars(set->conshdlrs[i], blkmem, set, stat) );
1078  }
1079  }
1080 
1081  for( i = 0; i < prob->ndeletedvars; ++i )
1082  {
1083  SCIP_VAR* var;
1084 
1085  var = prob->deletedvars[i];
1086 
1087  /* don't delete the variable, if it was fixed or aggregated in the meantime */
1088  if( SCIPvarGetProbindex(var) >= 0 )
1089  {
1090  SCIPsetDebugMsg(set, "perform deletion of <%s> [%p]\n", SCIPvarGetName(var), (void*)var);
1091 
1092  /* convert column variable back into loose variable, free LP column */
1094  {
1095  SCIP_CALL( SCIPvarLoose(var, blkmem, set, eventqueue, prob, lp) );
1096  }
1097 
1098  /* update branching candidates and pseudo and loose objective value in the LP */
1100  {
1101  SCIP_CALL( SCIPlpUpdateDelVar(lp, set, var) );
1102  SCIP_CALL( SCIPbranchcandRemoveVar(branchcand, var) );
1103  }
1104 
1105  /* remove variable's name from the namespace */
1106  SCIP_CALL( SCIPprobRemoveVarName(prob, var) );
1107 
1108  /* remove variable from vars array and mark it to be not in problem */
1109  SCIP_CALL( probRemoveVar(prob, blkmem, cliquetable, set, var) );
1110 
1111  /* update the number of variables with non-zero objective coefficient */
1112  if( prob->transformed )
1113  SCIPprobUpdateNObjVars(prob, set, SCIPvarGetObj(var), 0.0);
1114 
1115  /* release variable */
1116  SCIP_CALL( SCIPvarRelease(&prob->deletedvars[i], blkmem, set, eventqueue, lp) );
1117  }
1118  }
1119  prob->ndeletedvars = 0;
1120 
1121  return SCIP_OKAY;
1122 }
1123 
1124 /** changes the type of a variable in the problem */
1126  SCIP_PROB* prob, /**< problem data */
1127  BMS_BLKMEM* blkmem, /**< block memory */
1128  SCIP_SET* set, /**< global SCIP settings */
1129  SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
1130  SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */
1131  SCIP_VAR* var, /**< variable to add */
1132  SCIP_VARTYPE vartype /**< new type of variable */
1133  )
1134 {
1135  assert(prob != NULL);
1136  assert(var != NULL);
1137  assert(SCIPvarGetProbindex(var) >= 0);
1141  assert(branchcand != NULL || SCIPvarGetStatus(var) == SCIP_VARSTATUS_ORIGINAL);
1142 
1143  if( SCIPvarGetType(var) == vartype )
1144  return SCIP_OKAY;
1145 
1146  /* temporarily remove variable from branching candidates */
1147  if( branchcand != NULL )
1148  {
1149  SCIP_CALL( SCIPbranchcandRemoveVar(branchcand, var) );
1150  }
1151 
1152  /* temporarily remove variable from problem */
1153  SCIP_CALL( probRemoveVar(prob, blkmem, cliquetable, set, var) );
1154 
1155  /* change the type of the variable */
1156  SCIP_CALL( SCIPvarChgType(var, vartype) );
1157 
1158  /* reinsert variable into problem */
1159  probInsertVar(prob, var);
1160 
1161  /* update branching candidates */
1162  if( branchcand != NULL )
1163  {
1164  SCIP_CALL( SCIPbranchcandUpdateVar(branchcand, set, var) );
1165  }
1166 
1167  return SCIP_OKAY;
1168 }
1169 
1170 /** informs problem, that the given loose problem variable changed its status */
1172  SCIP_PROB* prob, /**< problem data */
1173  BMS_BLKMEM* blkmem, /**< block memory */
1174  SCIP_SET* set, /**< global SCIP settings */
1175  SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
1176  SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */
1177  SCIP_VAR* var /**< problem variable */
1178  )
1179 {
1180  assert(prob != NULL);
1181  assert(var != NULL);
1182  assert(SCIPvarGetProbindex(var) != -1);
1183 
1184  /* get current status of variable */
1185  switch( SCIPvarGetStatus(var) )
1186  {
1188  SCIPerrorMessage("variables cannot switch to ORIGINAL status\n");
1189  return SCIP_INVALIDDATA;
1190 
1191  case SCIP_VARSTATUS_LOOSE:
1192  /* variable switched from column to loose */
1193  prob->ncolvars--;
1194  break;
1195 
1196  case SCIP_VARSTATUS_COLUMN:
1197  /* variable switched from non-column to column */
1198  prob->ncolvars++;
1199  break;
1200 
1201  case SCIP_VARSTATUS_FIXED:
1205  /* variable switched from unfixed to fixed (if it was fixed before, probindex would have been -1) */
1206 
1207  /* remove variable from problem */
1208  SCIP_CALL( probRemoveVar(prob, blkmem, cliquetable, set, var) );
1209 
1210  /* insert variable in fixedvars array */
1211  SCIP_CALL( probEnsureFixedvarsMem(prob, set, prob->nfixedvars+1) );
1212  prob->fixedvars[prob->nfixedvars] = var;
1213  prob->nfixedvars++;
1214 
1215  /* update branching candidates */
1216  SCIP_CALL( SCIPbranchcandUpdateVar(branchcand, set, var) );
1217  break;
1218 
1219  default:
1220  SCIPerrorMessage("invalid variable status <%d>\n", SCIPvarGetStatus(var));
1221  return SCIP_INVALIDDATA;
1222  }
1223  assert(0 <= prob->ncolvars && prob->ncolvars <= prob->nvars);
1224 
1225  return SCIP_OKAY;
1226 }
1227 
1228 /** adds constraint's name to the namespace */
1230  SCIP_PROB* prob, /**< problem data */
1231  SCIP_CONS* cons /**< constraint */
1232  )
1233 {
1234  /* add constraint's name to the namespace */
1235  if( consHasName(cons) && prob->consnames != NULL )
1236  {
1237  SCIP_CALL( SCIPhashtableInsert(prob->consnames, (void*)cons) );
1238  }
1239 
1240  return SCIP_OKAY;
1241 }
1242 
1243 /** remove constraint's name from the namespace */
1245  SCIP_PROB* prob, /**< problem data */
1246  SCIP_CONS* cons /**< constraint */
1247  )
1248 {
1249  /* remove constraint's name from the namespace */
1250  if( consHasName(cons) && prob->consnames != NULL )
1251  {
1252  SCIP_CONS* currentcons;
1253  currentcons = (SCIP_CONS*)SCIPhashtableRetrieve(prob->consnames, (void*)(cons->name));
1254  if( currentcons == cons )
1255  {
1256  SCIP_CALL( SCIPhashtableRemove(prob->consnames, (void*)cons) );
1257  }
1258  }
1259 
1260  return SCIP_OKAY;
1261 }
1262 
1263 /** adds constraint to the problem and captures it;
1264  * a local constraint is automatically upgraded into a global constraint
1265  */
1267  SCIP_PROB* prob, /**< problem data */
1268  SCIP_SET* set, /**< global SCIP settings */
1269  SCIP_STAT* stat, /**< dynamic problem statistics */
1270  SCIP_CONS* cons /**< constraint to add */
1271  )
1272 {
1273  assert(prob != NULL);
1274  assert(cons != NULL);
1275  assert(cons->addconssetchg == NULL);
1276  assert(cons->addarraypos == -1);
1277 
1278 #ifndef NDEBUG
1279  /* check if we add this constraint to the same scip, where we create the constraint */
1280  if( cons->scip != set->scip )
1281  {
1282  SCIPerrorMessage("constraint belongs to different scip instance\n");
1283  return SCIP_INVALIDDATA;
1284  }
1285 #endif
1286  SCIPsetDebugMsg(set, "adding constraint <%s> to global problem -> %d constraints\n",
1287  SCIPconsGetName(cons), prob->nconss+1);
1288 
1289  /* mark the constraint as problem constraint, and remember the constraint's position */
1290  cons->addconssetchg = NULL;
1291  cons->addarraypos = prob->nconss;
1292 
1293  /* add the constraint to the problem's constraint array */
1294  SCIP_CALL( probEnsureConssMem(prob, set, prob->nconss+1) );
1295  prob->conss[prob->nconss] = cons;
1296  prob->nconss++;
1297  prob->maxnconss = MAX(prob->maxnconss, prob->nconss);
1298  stat->nactiveconssadded++;
1299 
1300  /* undelete constraint, if it was globally deleted in the past */
1301  cons->deleted = FALSE;
1302 
1303  /* mark constraint to be globally valid */
1304  SCIPconsSetLocal(cons, FALSE);
1305 
1306  /* capture constraint */
1307  SCIPconsCapture(cons);
1308 
1309  /* add constraint's name to the namespace */
1310  SCIP_CALL( SCIPprobAddConsName(prob, cons) );
1311 
1312  /* if the problem is the transformed problem, activate and lock constraint */
1313  if( prob->transformed )
1314  {
1315  /* activate constraint */
1316  if( !SCIPconsIsActive(cons) )
1317  {
1318  SCIP_CALL( SCIPconsActivate(cons, set, stat, -1, (stat->nnodes <= 1)) );
1319  }
1320 
1321  /* if constraint is a check-constraint, lock roundings of constraint's variables */
1322  if( SCIPconsIsChecked(cons) )
1323  {
1324  SCIP_CALL( SCIPconsAddLocks(cons, set, +1, 0) );
1325  }
1326  }
1327 
1328  return SCIP_OKAY;
1329 }
1330 
1331 /** releases and removes constraint from the problem; if the user has not captured the constraint for his own use, the
1332  * constraint may be invalid after the call
1333  */
1335  SCIP_PROB* prob, /**< problem data */
1336  BMS_BLKMEM* blkmem, /**< block memory */
1337  SCIP_SET* set, /**< global SCIP settings */
1338  SCIP_STAT* stat, /**< dynamic problem statistics */
1339  SCIP_CONS* cons /**< constraint to remove */
1340  )
1341 {
1342  int arraypos;
1343 
1344  assert(prob != NULL);
1345  assert(blkmem != NULL);
1346  assert(cons != NULL);
1347  assert(cons->addconssetchg == NULL);
1348  assert(0 <= cons->addarraypos && cons->addarraypos < prob->nconss);
1349  assert(prob->conss != NULL);
1350  assert(prob->conss[cons->addarraypos] == cons);
1351 
1352  /* if the problem is the transformed problem, deactivate and unlock constraint */
1353  if( prob->transformed )
1354  {
1355  /* if constraint is a check-constraint, unlock roundings of constraint's variables */
1356  if( SCIPconsIsChecked(cons) )
1357  {
1358  SCIP_CALL( SCIPconsAddLocks(cons, set, -1, 0) );
1359  }
1360 
1361  /* deactivate constraint, if it is currently active */
1362  if( cons->active && !cons->updatedeactivate )
1363  {
1364  SCIP_CALL( SCIPconsDeactivate(cons, set, stat) );
1365  }
1366  }
1367  assert(!cons->active || cons->updatedeactivate);
1368  assert(!cons->enabled || cons->updatedeactivate);
1369 
1370  /* remove constraint's name from the namespace */
1371  SCIP_CALL( SCIPprobRemoveConsName(prob, cons) );
1372 
1373  /* remove the constraint from the problem's constraint array */
1374  arraypos = cons->addarraypos;
1375  prob->conss[arraypos] = prob->conss[prob->nconss-1];
1376  assert(prob->conss[arraypos] != NULL);
1377  assert(prob->conss[arraypos]->addconssetchg == NULL);
1378  prob->conss[arraypos]->addarraypos = arraypos;
1379  prob->nconss--;
1380 
1381  /* mark the constraint to be no longer in the problem */
1382  cons->addarraypos = -1;
1383 
1384  /* release constraint */
1385  SCIP_CALL( SCIPconsRelease(&cons, blkmem, set) );
1386 
1387  return SCIP_OKAY;
1388 }
1389 
1390 /** remembers the current number of constraints in the problem's internal data structure
1391  * - resets maximum number of constraints to current number of constraints
1392  * - remembers current number of constraints as starting number of constraints
1393  */
1395  SCIP_PROB* prob /**< problem data */
1396  )
1397 {
1398  assert(prob != NULL);
1399 
1400  /* remember number of constraints for statistic */
1401  prob->maxnconss = prob->nconss;
1402  prob->startnvars = prob->nvars;
1403  prob->startnconss = prob->nconss;
1404 }
1405 
1406 /** sets objective sense: minimization or maximization */
1408  SCIP_PROB* prob, /**< problem data */
1409  SCIP_OBJSENSE objsense /**< new objective sense */
1410  )
1411 {
1412  assert(prob != NULL);
1413  assert(prob->objsense == SCIP_OBJSENSE_MAXIMIZE || prob->objsense == SCIP_OBJSENSE_MINIMIZE);
1414  assert(objsense == SCIP_OBJSENSE_MAXIMIZE || objsense == SCIP_OBJSENSE_MINIMIZE);
1415 
1416  prob->objsense = objsense;
1417 }
1418 
1419 /** adds value to objective offset */
1421  SCIP_PROB* prob, /**< problem data */
1422  SCIP_Real addval /**< value to add to objective offset */
1423  )
1424 {
1425  assert(prob != NULL);
1426  assert(prob->transformed);
1427 
1428  SCIPdebugMessage("adding %g to objective offset %g: new offset = %g\n", addval, prob->objoffset, prob->objoffset + addval);
1429  prob->objoffset += addval;
1430 }
1431 
1432 /** sets the dual bound on objective function */
1434  SCIP_PROB* prob, /**< problem data */
1435  SCIP_Real dualbound /**< external dual bound */
1436  )
1437 {
1438  assert(prob != NULL);
1439 
1440  prob->dualbound = dualbound;
1441 }
1442 
1443 /** sets limit on objective function, such that only solutions better than this limit are accepted */
1445  SCIP_PROB* prob, /**< problem data */
1446  SCIP_Real objlim /**< external objective limit */
1447  )
1448 {
1449  assert(prob != NULL);
1450 
1451  prob->objlim = objlim;
1452 }
1453 
1454 /** informs the problem, that its objective value is always integral in every feasible solution */
1456  SCIP_PROB* prob /**< problem data */
1457  )
1458 {
1459  assert(prob != NULL);
1460 
1461  prob->objisintegral = TRUE;
1462 }
1463 
1464 /** sets integral objective value flag, if all variables with non-zero objective values are integral and have
1465  * integral objective value and also updates the cutoff bound if primal solution is already known
1466  */
1468  SCIP_PROB* transprob, /**< tranformed problem data */
1469  SCIP_PROB* origprob, /**< original problem data */
1470  BMS_BLKMEM* blkmem, /**< block memory */
1471  SCIP_SET* set, /**< global SCIP settings */
1472  SCIP_STAT* stat, /**< problem statistics data */
1473  SCIP_PRIMAL* primal, /**< primal data */
1474  SCIP_TREE* tree, /**< branch and bound tree */
1475  SCIP_REOPT* reopt, /**< reoptimization data structure */
1476  SCIP_LP* lp, /**< current LP data */
1477  SCIP_EVENTQUEUE* eventqueue /**< event queue */
1478  )
1479 {
1480  SCIP_Real obj;
1481  int v;
1482 
1483  assert(transprob != NULL);
1484  assert(origprob != NULL);
1485 
1486  /* if we know already, that the objective value is integral, nothing has to be done */
1487  if( transprob->objisintegral )
1488  return SCIP_OKAY;
1489 
1490  /* if there exist unknown variables, we cannot conclude that the objective value is always integral */
1491  if( set->nactivepricers != 0 )
1492  return SCIP_OKAY;
1493 
1494  /* if the objective value offset is fractional, the value itself is possibly fractional */
1495  if( !SCIPsetIsIntegral(set, transprob->objoffset) )
1496  return SCIP_OKAY;
1497 
1498  /* scan through the variables */
1499  for( v = 0; v < transprob->nvars; ++v )
1500  {
1501  /* get objective value of variable */
1502  obj = SCIPvarGetObj(transprob->vars[v]);
1503 
1504  /* check, if objective value is non-zero */
1505  if( !SCIPsetIsZero(set, obj) )
1506  {
1507  /* if variable's objective value is fractional, the problem's objective value may also be fractional */
1508  if( !SCIPsetIsIntegral(set, obj) )
1509  break;
1510 
1511  /* if variable with non-zero objective value is continuous, the problem's objective value may be fractional */
1512  if( SCIPvarGetType(transprob->vars[v]) == SCIP_VARTYPE_CONTINUOUS )
1513  break;
1514  }
1515  }
1516 
1517  /* objective value is integral, if the variable loop scanned all variables */
1518  if( v == transprob->nvars )
1519  {
1520  transprob->objisintegral = TRUE;
1521 
1522  /* update upper bound and cutoff bound in primal data structure due to new internality information */
1523  SCIP_CALL( SCIPprimalUpdateObjoffset(primal, blkmem, set, stat, eventqueue, transprob, origprob, tree, reopt, lp) );
1524  }
1525 
1526  return SCIP_OKAY;
1527 }
1528 
1529 /** update the number of variables with non-zero objective coefficient */
1531  SCIP_PROB* prob, /**< problem data */
1532  SCIP_SET* set, /**< global SCIP settings */
1533  SCIP_Real oldobj, /**< old objective value for variable */
1534  SCIP_Real newobj /**< new objective value for variable */
1535  )
1536 {
1537  assert(prob->transformed);
1538 
1539  if( !SCIPsetIsZero(set, oldobj) )
1540  prob->nobjvars--;
1541 
1542  if( !SCIPsetIsZero(set, newobj) )
1543  prob->nobjvars++;
1544 }
1545 
1546 /** update the dual bound if its better as the current one */
1548  SCIP_PROB* prob, /**< problem data */
1549  SCIP_Real newbound /**< new dual bound for the node (if it's tighter than the old one) */
1550  )
1551 {
1552  if( prob->dualbound == SCIP_INVALID ) /*lint !e777*/
1553  SCIPprobSetDualbound(prob, newbound);
1554  else
1555  {
1556  switch( prob->objsense )
1557  {
1559  prob->dualbound = MAX(newbound, prob->dualbound);
1560  break;
1561 
1563  prob->dualbound = MIN(newbound, prob->dualbound);
1564  break;
1565 
1566  default:
1567  SCIPerrorMessage("invalid objective sense <%d>\n", prob->objsense);
1568  SCIPABORT();
1569  }
1570  }
1571 }
1572 
1573 /** invalidates the dual bound */
1575  SCIP_PROB* prob /**< problem data */
1576  )
1577 {
1578  assert(prob != NULL);
1579 
1580  prob->dualbound = SCIP_INVALID;
1581 }
1582 
1583 /** if possible, scales objective function such that it is integral with gcd = 1 */
1585  SCIP_PROB* transprob, /**< tranformed problem data */
1586  SCIP_PROB* origprob, /**< original problem data */
1587  BMS_BLKMEM* blkmem, /**< block memory */
1588  SCIP_SET* set, /**< global SCIP settings */
1589  SCIP_STAT* stat, /**< problem statistics data */
1590  SCIP_PRIMAL* primal, /**< primal data */
1591  SCIP_TREE* tree, /**< branch and bound tree */
1592  SCIP_REOPT* reopt, /**< reoptimization data structure */
1593  SCIP_LP* lp, /**< current LP data */
1594  SCIP_EVENTQUEUE* eventqueue /**< event queue */
1595  )
1596 {
1597  int v;
1598  int nints;
1599 
1600  assert(transprob != NULL);
1601  assert(set != NULL);
1602 
1603  /* do not change objective if there are pricers involved */
1604  if( set->nactivepricers != 0 )
1605  return SCIP_OKAY;
1606 
1607  nints = transprob->nvars - transprob->ncontvars;
1608 
1609  /* scan through the continuous variables */
1610  for( v = nints; v < transprob->nvars; ++v )
1611  {
1612  SCIP_Real obj;
1613 
1614  /* get objective value of variable; it it is non-zero, no scaling can be applied */
1615  obj = SCIPvarGetObj(transprob->vars[v]);
1616  if( !SCIPsetIsZero(set, obj) )
1617  break;
1618  }
1619 
1620  /* only continue if all continuous variables have obj = 0 */
1621  if( v == transprob->nvars )
1622  {
1623  SCIP_Real* objvals;
1624  SCIP_Real intscalar;
1625  SCIP_Bool success;
1626 
1627  /* get temporary memory */
1628  SCIP_CALL( SCIPsetAllocBufferArray(set, &objvals, nints) );
1629 
1630  /* get objective values of integer variables */
1631  for( v = 0; v < nints; ++v )
1632  objvals[v] = SCIPvarGetObj(transprob->vars[v]);
1633 
1634  /* calculate integral scalar */
1636  &intscalar, &success) );
1637 
1638  SCIPsetDebugMsg(set, "integral objective scalar: success=%u, intscalar=%g\n", success, intscalar);
1639 
1640  if( success )
1641  {
1642  SCIP_Longint gcd;
1643 
1644  assert(intscalar > 0.0);
1645 
1646  /* calculate gcd of resulting integral coefficients */
1647  gcd = 0;
1648  for( v = 0; v < nints && gcd != 1; ++v )
1649  {
1650  SCIP_Longint absobj;
1651 
1652  /* if absobj exceeds maximum SCIP_Longint value, return */
1653  if( REALABS(objvals[v]) * intscalar + 0.5 > SCIP_LONGINT_MAX )
1654  {
1655  SCIPsetFreeBufferArray(set, &objvals);
1656  return SCIP_OKAY;
1657  }
1658 
1659  absobj = (SCIP_Longint)(REALABS(objvals[v]) * intscalar + 0.5);
1660  if( gcd == 0 )
1661  gcd = absobj;
1662  else if( absobj > 0 )
1663  gcd = SCIPcalcGreComDiv(gcd, absobj);
1664  }
1665  if( gcd != 0 )
1666  intscalar /= gcd;
1667  SCIPsetDebugMsg(set, "integral objective scalar: gcd=%" SCIP_LONGINT_FORMAT ", intscalar=%g\n", gcd, intscalar);
1668 
1669  /* only apply scaling if the final scalar is small enough */
1670  if( intscalar <= OBJSCALE_MAXFINALSCALE )
1671  {
1672  /* apply scaling */
1673  if( !SCIPsetIsEQ(set, intscalar, 1.0) )
1674  {
1675  /* calculate scaled objective values */
1676  for( v = 0; v < nints; ++v )
1677  {
1678  SCIP_Real newobj;
1679 
1680  /* check if new obj is really integral */
1681  newobj = intscalar * SCIPvarGetObj(transprob->vars[v]);
1682  if( !SCIPsetIsFeasIntegral(set, newobj) )
1683  break;
1684  objvals[v] = SCIPsetFeasFloor(set, newobj);
1685  }
1686 
1687  /* change the variables' objective values and adjust objscale and objoffset */
1688  if( v == nints )
1689  {
1690  for( v = 0; v < nints; ++v )
1691  {
1692  SCIPsetDebugMsg(set, " -> var <%s>: newobj = %.6f\n", SCIPvarGetName(transprob->vars[v]), objvals[v]);
1693  SCIP_CALL( SCIPvarChgObj(transprob->vars[v], blkmem, set, transprob, primal, lp, eventqueue, objvals[v]) );
1694  }
1695  transprob->objoffset *= intscalar;
1696  transprob->objscale /= intscalar;
1697  transprob->objisintegral = TRUE;
1698  SCIPsetDebugMsg(set, "integral objective scalar: objscale=%g\n", transprob->objscale);
1699 
1700  /* update upperbound and cutoffbound in primal data structure */
1701  SCIP_CALL( SCIPprimalUpdateObjoffset(primal, blkmem, set, stat, eventqueue, transprob, origprob, tree, reopt, lp) );
1702  }
1703  }
1704  }
1705  }
1706 
1707  /* free temporary memory */
1708  SCIPsetFreeBufferArray(set, &objvals);
1709  }
1710 
1711  return SCIP_OKAY;
1712 }
1713 
1714 /** remembers the current solution as root solution in the problem variables */
1716  SCIP_PROB* prob, /**< problem data */
1717  SCIP_SET* set, /**< global SCIP settings */
1718  SCIP_STAT* stat, /**< SCIP statistics */
1719  SCIP_LP* lp, /**< current LP data */
1720  SCIP_Bool roothaslp /**< is the root solution from LP? */
1721  )
1722 {
1723  int v;
1724 
1725  assert(prob != NULL);
1726  assert(prob->transformed);
1727 
1728  if( roothaslp )
1729  {
1730  for( v = 0; v < prob->nvars; ++v )
1731  SCIPvarStoreRootSol(prob->vars[v], roothaslp);
1732 
1734  SCIPlpStoreRootObjval(lp, set, prob);
1735 
1736  /* compute root LP best-estimate */
1737  SCIPstatComputeRootLPBestEstimate(stat, set, SCIPlpGetColumnObjval(lp), prob->vars, prob->nbinvars + prob->nintvars + prob->nimplvars);
1738  }
1739 }
1740 
1741 /** remembers the best solution w.r.t. root reduced cost propagation as root solution in the problem variables */
1743  SCIP_PROB* prob, /**< problem data */
1744  SCIP_SET* set, /**< global SCIP settings */
1745  SCIP_STAT* stat, /**< problem statistics */
1746  SCIP_LP* lp /**< current LP data */
1747  )
1748 {
1749  SCIP_Real rootlpobjval;
1750  int v;
1751 
1752  assert(prob != NULL);
1753  assert(lp != NULL);
1754  assert(prob->transformed);
1755  assert(lp->lpsolstat == SCIP_LPSOLSTAT_OPTIMAL);
1756 
1757  /* in case we have a zero objective fucntion, we skip the root reduced cost update */
1758  if( SCIPprobGetNObjVars(prob, set) == 0 )
1759  return;
1760 
1761  if( !SCIPlpIsDualReliable(lp) )
1762  return;
1763 
1764  SCIPsetDebugMsg(set, "update root reduced costs\n");
1765 
1766  /* compute current root LP objective value */
1767  rootlpobjval = SCIPlpGetObjval(lp, set, prob);
1768  assert(rootlpobjval != SCIP_INVALID); /*lint !e777*/
1769 
1770  for( v = 0; v < prob->nvars; ++v )
1771  {
1772  SCIP_VAR* var;
1773  SCIP_COL* col;
1774  SCIP_Real rootsol = 0.0;
1775  SCIP_Real rootredcost = 0.0;
1776 
1777  var = prob->vars[v];
1778  assert(var != NULL);
1779 
1780  /* check if the variable is part of the LP */
1782  continue;
1783 
1784  col = SCIPvarGetCol(var);
1785  assert(col != NULL);
1786 
1788 
1789  if( !SCIPvarIsBinary(var) )
1790  {
1791  rootsol = SCIPvarGetSol(var, TRUE);
1792  rootredcost = SCIPcolGetRedcost(col, stat, lp);
1793  }
1794  else
1795  {
1796  SCIP_Real primsol;
1797  SCIP_BASESTAT basestat;
1798  SCIP_Bool lpissolbasic;
1799 
1800  basestat = SCIPcolGetBasisStatus(col);
1801  lpissolbasic = SCIPlpIsSolBasic(lp);
1802  primsol = SCIPcolGetPrimsol(col);
1803 
1804  if( (lpissolbasic && (basestat == SCIP_BASESTAT_LOWER || basestat == SCIP_BASESTAT_UPPER)) ||
1805  (!lpissolbasic && (SCIPsetIsFeasEQ(set, SCIPvarGetLbLocal(var), primsol) ||
1806  SCIPsetIsFeasEQ(set, SCIPvarGetUbLocal(var), primsol))) )
1807  {
1808  SCIP_Real lbrootredcost;
1809  SCIP_Real ubrootredcost;
1810 
1811  /* get reduced cost if the variable gets fixed to zero */
1812  lbrootredcost = SCIPvarGetImplRedcost(var, set, FALSE, stat, prob, lp);
1813  assert( !SCIPsetIsDualfeasPositive(set, lbrootredcost)
1815 
1816  /* get reduced cost if the variable gets fixed to one */
1817  ubrootredcost = SCIPvarGetImplRedcost(var, set, TRUE, stat, prob, lp);
1818  assert( !SCIPsetIsDualfeasNegative(set, ubrootredcost)
1820 
1821  if( -lbrootredcost > ubrootredcost )
1822  {
1823  rootredcost = lbrootredcost;
1824  rootsol = 1.0;
1825  }
1826  else
1827  {
1828  rootredcost = ubrootredcost;
1829  rootsol = 0.0;
1830  }
1831  }
1832  }
1833 
1834  /* update the current solution as best root solution in the problem variables if it is better */
1835  SCIPvarUpdateBestRootSol(var, set, rootsol, rootredcost, rootlpobjval);
1836  }
1837 }
1838 
1839 /** informs problem, that the presolving process was finished, and updates all internal data structures */
1841  SCIP_PROB* prob, /**< problem data */
1842  SCIP_SET* set /**< global SCIP settings */
1843  )
1844 { /*lint --e{715}*/
1845  return SCIP_OKAY;
1846 }
1847 
1848 /** initializes problem for branch and bound process and resets all constraint's ages and histories of current run */
1850  SCIP_PROB* prob, /**< problem data */
1851  SCIP_SET* set /**< global SCIP settings */
1852  )
1853 {
1854  int c;
1855  int v;
1856 
1857  assert(prob != NULL);
1858  assert(prob->transformed);
1859  assert(set != NULL);
1860 
1861  /* reset constraint's ages */
1862  for( c = 0; c < prob->nconss; ++c )
1863  {
1864  SCIP_CALL( SCIPconsResetAge(prob->conss[c], set) );
1865  }
1866 
1867  /* initialize variables for solving */
1868  for( v = 0; v < prob->nvars; ++v )
1869  SCIPvarInitSolve(prob->vars[v]);
1870 
1871  /* call user data function */
1872  if( prob->probinitsol != NULL )
1873  {
1874  SCIP_CALL( prob->probinitsol(set->scip, prob->probdata) );
1875  }
1876 
1877  /* assert that the counter for variables with nonzero objective is correct */
1878  assert(prob->nobjvars == SCIPprobGetNObjVars(prob, set));
1879 
1880  return SCIP_OKAY;
1881 }
1882 
1883 /** deinitializes problem after branch and bound process, and converts all COLUMN variables back into LOOSE variables */
1885  SCIP_PROB* prob, /**< problem data */
1886  BMS_BLKMEM* blkmem, /**< block memory */
1887  SCIP_SET* set, /**< global SCIP settings */
1888  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
1889  SCIP_LP* lp, /**< current LP data */
1890  SCIP_Bool restart /**< was this exit solve call triggered by a restart? */
1891  )
1892 {
1893  SCIP_VAR* var;
1894  int v;
1895 
1896  assert(prob != NULL);
1897  assert(prob->transformed);
1898  assert(set != NULL);
1899 
1900  /* call user data function */
1901  if( prob->probexitsol != NULL )
1902  {
1903  SCIP_CALL( prob->probexitsol(set->scip, prob->probdata, restart) );
1904  }
1905 
1906  /* convert all COLUMN variables back into LOOSE variables */
1907  if( prob->ncolvars > 0 )
1908  {
1909  for( v = 0; v < prob->nvars; ++v )
1910  {
1911  var = prob->vars[v];
1913  {
1914  SCIP_CALL( SCIPvarLoose(var, blkmem, set, eventqueue, prob, lp) );
1915  }
1916 
1917  /* invalided root reduced cost, root reduced solution, and root LP objective value for each variable */
1918  SCIPvarSetBestRootSol(var, 0.0, 0.0, SCIP_INVALID);
1919  }
1920  }
1921  assert(prob->ncolvars == 0);
1922 
1923  return SCIP_OKAY;
1924 }
1925 
1926 
1927 
1928 
1929 /*
1930  * problem information
1931  */
1932 
1933 /** sets problem name */
1935  SCIP_PROB* prob, /**< problem data */
1936  const char* name /**< name to be set */
1937  )
1938 {
1939  assert(prob != NULL);
1940 
1941  BMSfreeMemoryArray(&(prob->name));
1942  SCIP_ALLOC( BMSduplicateMemoryArray(&(prob->name), name, strlen(name)+1) );
1943 
1944  return SCIP_OKAY;
1945 }
1946 
1947 /** returns the number of implicit binary variables, meaning variable of vartype != SCIP_VARTYPE_BINARY and !=
1948  * SCIP_VARTYPE_CONTINUOUS but with global bounds [0,1]
1949  *
1950  * @note this number needs to be computed, because it cannot be updated like the other counters for binary and integer
1951  * variables, each time the variable type changes(, we would need to update this counter each time a global bound
1952  * changes), even at the end of presolving this cannot be computed, because some variable can change to an
1953  * implicit binary status
1954  */
1956  SCIP_PROB* prob /**< problem data */
1957  )
1958 {
1959  int v;
1960  int nimplbinvars = 0;
1961 
1962  for( v = prob->nbinvars + prob->nintvars + prob->nimplvars - 1; v >= prob->nbinvars; --v )
1963  {
1964  if( SCIPvarIsBinary(prob->vars[v]) )
1965  ++nimplbinvars;
1966  }
1967 
1968  return nimplbinvars;
1969 }
1970 
1971 /** returns the number of variables with non-zero objective coefficient */
1973  SCIP_PROB* prob, /**< problem data */
1974  SCIP_SET* set /**< global SCIP settings */
1975  )
1976 {
1977  if( prob->transformed )
1978  {
1979  /* this is much too expensive, to check it in each debug run */
1980 #ifdef SCIP_MORE_DEBUG
1981  int nobjvars;
1982  int v;
1983 
1984  nobjvars = 0;
1985 
1986  for( v = prob->nvars - 1; v >= 0; --v )
1987  {
1988  if( !SCIPsetIsZero(set, SCIPvarGetObj(prob->vars[v])) )
1989  nobjvars++;
1990  }
1991 
1992  /* check that the internal count is correct */
1993  assert(prob->nobjvars == nobjvars);
1994 #endif
1995  return prob->nobjvars;
1996  }
1997  else
1998  {
1999  int nobjvars;
2000  int v;
2001 
2002  nobjvars = 0;
2003 
2004  for( v = prob->nvars - 1; v >= 0; --v )
2005  {
2006  if( !SCIPsetIsZero(set, SCIPvarGetObj(prob->vars[v])) )
2007  nobjvars++;
2008  }
2009  return nobjvars;
2010  }
2011 }
2012 
2013 /** returns the minimal absolute non-zero objective coefficient
2014  *
2015  * @note currently, this is only used for statistics and printed after the solving process. if this information is
2016  * needed during the (pre)solving process this should be implemented more efficiently, e.g., updating the minimal
2017  * absolute non-zero coefficient every time an objective coefficient has changed.
2018  */
2020  SCIP_PROB* prob, /**< problem data */
2021  SCIP_SET* set /**< global SCIP settings */
2022  )
2023 {
2024  SCIP_Real absmin;
2025  int v;
2026 
2027  absmin = SCIPsetInfinity(set);
2028 
2029  for( v = 0; v < prob->nvars; v++ )
2030  {
2031  SCIP_Real objcoef = SCIPvarGetObj(prob->vars[v]);
2032 
2033  if( !SCIPsetIsZero(set, objcoef) && SCIPsetIsLT(set, REALABS(objcoef), absmin) )
2034  absmin = REALABS(objcoef);
2035  }
2036 
2037  return absmin;
2038 }
2039 
2040 /** returns the maximal absolute non-zero objective coefficient
2041  *
2042  * @note currently, this is only used for statistics and printed after the solving process. if this information is
2043  * needed during the (pre)solving process this should be implemented more efficiently, e.g., updating the maximal
2044  * absolute non-zero coefficient every time an objective coefficient has changed.
2045  */
2047  SCIP_PROB* prob, /**< problem data */
2048  SCIP_SET* set /**< global SCIP settings */
2049  )
2050 {
2051  SCIP_Real absmax;
2052  int v;
2053 
2054  absmax = -SCIPsetInfinity(set);
2055 
2056  for( v = 0; v < prob->nvars; v++ )
2057  {
2058  SCIP_Real objcoef = SCIPvarGetObj(prob->vars[v]);
2059 
2060  if( !SCIPsetIsZero(set, objcoef) && SCIPsetIsGT(set, REALABS(objcoef), absmax) )
2061  absmax = REALABS(objcoef);
2062  }
2063 
2064  return absmax;
2065 }
2066 
2067 
2068 /** returns the external value of the given internal objective value */
2070  SCIP_PROB* transprob, /**< tranformed problem data */
2071  SCIP_PROB* origprob, /**< original problem data */
2072  SCIP_SET* set, /**< global SCIP settings */
2073  SCIP_Real objval /**< internal objective value */
2074  )
2075 {
2076  assert(set != NULL);
2077  assert(origprob != NULL);
2078  assert(transprob != NULL);
2079  assert(transprob->transformed);
2080  assert(transprob->objscale > 0.0);
2081 
2082  if( SCIPsetIsInfinity(set, objval) )
2083  return (SCIP_Real)transprob->objsense * SCIPsetInfinity(set);
2084  else if( SCIPsetIsInfinity(set, -objval) )
2085  return -(SCIP_Real)transprob->objsense * SCIPsetInfinity(set);
2086  else
2087  return (SCIP_Real)transprob->objsense * transprob->objscale * (objval + transprob->objoffset) + origprob->objoffset;
2088 }
2089 
2090 /** returns the internal value of the given external objective value */
2092  SCIP_PROB* transprob, /**< tranformed problem data */
2093  SCIP_PROB* origprob, /**< original problem data */
2094  SCIP_SET* set, /**< global SCIP settings */
2095  SCIP_Real objval /**< external objective value */
2096  )
2097 {
2098  assert(set != NULL);
2099  assert(origprob != NULL);
2100  assert(transprob != NULL);
2101  assert(transprob->transformed);
2102  assert(transprob->objscale > 0.0);
2103 
2104  if( SCIPsetIsInfinity(set, objval) )
2105  return (SCIP_Real)transprob->objsense * SCIPsetInfinity(set);
2106  else if( SCIPsetIsInfinity(set, -objval) )
2107  return -(SCIP_Real)transprob->objsense * SCIPsetInfinity(set);
2108  else
2109  return (SCIP_Real)transprob->objsense * (objval - origprob->objoffset)/transprob->objscale - transprob->objoffset;
2110 }
2111 
2112 /** returns variable of the problem with given name */
2114  SCIP_PROB* prob, /**< problem data */
2115  const char* name /**< name of variable to find */
2116  )
2117 {
2118  assert(prob != NULL);
2119  assert(name != NULL);
2120 
2121  if( prob->varnames == NULL )
2122  {
2123  SCIPerrorMessage("Cannot find variable if variable-names hashtable was disabled (due to parameter <misc/usevartable>)\n");
2124  SCIPABORT();/*lint --e{527}*/ /* only in debug mode */
2125  return NULL;
2126  }
2127 
2128  return (SCIP_VAR*)(SCIPhashtableRetrieve(prob->varnames, (char*)name));
2129 }
2130 
2131 /** returns constraint of the problem with given name */
2133  SCIP_PROB* prob, /**< problem data */
2134  const char* name /**< name of variable to find */
2135  )
2136 {
2137  assert(prob != NULL);
2138  assert(name != NULL);
2139 
2140  if( prob->consnames == NULL )
2141  {
2142  SCIPerrorMessage("Cannot find constraint if constraint-names hashtable was disabled (due to parameter <misc/useconstable>)\n");
2143  SCIPABORT();/*lint --e{527}*/ /* only in debug mode */
2144  return NULL;
2145  }
2146 
2147  return (SCIP_CONS*)(SCIPhashtableRetrieve(prob->consnames, (char*)name));
2148 }
2149 
2150 /** displays current pseudo solution */
2152  SCIP_PROB* prob, /**< problem data */
2153  SCIP_SET* set, /**< global SCIP settings */
2154  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
2155  )
2156 {
2157  SCIP_VAR* var;
2158  SCIP_Real solval;
2159  int v;
2160 
2161  for( v = 0; v < prob->nvars; ++v )
2162  {
2163  var = prob->vars[v];
2164  assert(var != NULL);
2165  solval = SCIPvarGetPseudoSol(var);
2166  if( !SCIPsetIsZero(set, solval) )
2167  SCIPmessagePrintInfo(messagehdlr, " <%s>=%.15g", SCIPvarGetName(var), solval);
2168  }
2169  SCIPmessagePrintInfo(messagehdlr, "\n");
2170 }
2171 
2172 /** outputs problem statistics */
2174  SCIP_PROB* prob, /**< problem data */
2175  SCIP_SET* set, /**< global SCIP settings */
2176  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
2177  FILE* file /**< output file (or NULL for standard output) */
2178  )
2179 {
2180  assert(prob != NULL);
2181 
2182  SCIPmessageFPrintInfo(messagehdlr, file, " Problem name : %s\n", prob->name);
2183  SCIPmessageFPrintInfo(messagehdlr, file, " Variables : %d (%d binary, %d integer, %d implicit integer, %d continuous)\n",
2184  prob->nvars, prob->nbinvars, prob->nintvars, prob->nimplvars, prob->ncontvars);
2185  SCIPmessageFPrintInfo(messagehdlr, file, " Constraints : %d initial, %d maximal\n", prob->startnconss, prob->maxnconss);
2186  SCIPmessageFPrintInfo(messagehdlr, file, " Objective : %s, %d non-zeros (abs.min = %g, abs.max = %g)\n",
2187  !prob->transformed ? (prob->objsense == SCIP_OBJSENSE_MINIMIZE ? "minimize" : "maximize") : "minimize",
2188  SCIPprobGetNObjVars(prob, set), SCIPprobGetAbsMinObjCoef(prob, set), SCIPprobGetAbsMaxObjCoef(prob, set));
2189 }
2190 
2191 
2192 #ifndef NDEBUG
2193 
2194 /* In debug mode, the following methods are implemented as function calls to ensure
2195  * type validity.
2196  * In optimized mode, the methods are implemented as defines to improve performance.
2197  * However, we want to have them in the library anyways, so we have to undef the defines.
2198  */
2199 
2200 #undef SCIPprobIsPermuted
2201 #undef SCIPprobMarkPermuted
2202 #undef SCIPprobIsTransformed
2203 #undef SCIPprobIsObjIntegral
2204 #undef SCIPprobAllColsInLP
2205 #undef SCIPprobGetObjlim
2206 #undef SCIPprobGetData
2207 #undef SCIPprobGetName
2208 #undef SCIPprobGetNVars
2209 #undef SCIPprobGetNBinVars
2210 #undef SCIPprobGetNIntVars
2211 #undef SCIPprobGetNImplVars
2212 #undef SCIPprobGetNContVars
2213 #undef SCIPprobGetNConss
2214 #undef SCIPprobGetVars
2215 #undef SCIPprobGetObjoffset
2216 #undef SCIPisConsCompressedEnabled
2217 #undef SCIPprobEnableConsCompression
2218 
2219 /** is the problem permuted */
2221  SCIP_PROB* prob
2222  )
2223 {
2224  assert(prob != NULL);
2225 
2226  return prob->permuted;
2227 }
2228 
2229 /** mark the problem as permuted */
2231  SCIP_PROB* prob
2232  )
2233 {
2234  assert(prob != NULL);
2235 
2236  prob->permuted = TRUE;
2237 }
2238 
2239 /** is the problem data transformed */
2241  SCIP_PROB* prob /**< problem data */
2242  )
2243 {
2244  assert(prob != NULL);
2245 
2246  return prob->transformed;
2247 }
2248 
2249 /** returns whether the objective value is known to be integral in every feasible solution */
2251  SCIP_PROB* prob /**< problem data */
2252  )
2253 {
2254  assert(prob != NULL);
2255 
2256  return prob->objisintegral;
2257 }
2258 
2259 /** returns TRUE iff all columns, i.e. every variable with non-empty column w.r.t. all ever created rows, are present
2260  * in the LP, and FALSE, if there are additional already existing columns, that may be added to the LP in pricing
2261  */
2263  SCIP_PROB* prob, /**< problem data */
2264  SCIP_SET* set, /**< global SCIP settings */
2265  SCIP_LP* lp /**< current LP data */
2266  )
2267 {
2268  assert(SCIPlpGetNCols(lp) <= prob->ncolvars && prob->ncolvars <= prob->nvars);
2269 
2270  return (SCIPlpGetNCols(lp) == prob->ncolvars && set->nactivepricers == 0);
2271 }
2272 
2273 /** gets limit on objective function in external space */
2275  SCIP_PROB* prob, /**< problem data */
2276  SCIP_SET* set /**< global SCIP settings */
2277  )
2278 {
2279  assert(prob != NULL);
2280  assert(set != NULL);
2281 
2282  return prob->objlim >= SCIP_INVALID ? (SCIP_Real)(prob->objsense) * SCIPsetInfinity(set) : prob->objlim;
2283 }
2284 
2285 /** gets user problem data */
2287  SCIP_PROB* prob /**< problem */
2288  )
2289 {
2290  assert(prob != NULL);
2291 
2292  return prob->probdata;
2293 }
2294 
2295 /** gets problem name */
2296 const char* SCIPprobGetName(
2297  SCIP_PROB* prob /**< problem data */
2298  )
2299 {
2300  assert(prob != NULL);
2301  return prob->name;
2302 }
2303 
2304 /** gets number of problem variables */
2306  SCIP_PROB* prob /**< problem data */
2307  )
2308 {
2309  assert(prob != NULL);
2310  return prob->nvars;
2311 }
2312 
2313 /** gets number of binary problem variables */
2315  SCIP_PROB* prob /**< problem data */
2316  )
2317 {
2318  assert(prob != NULL);
2319  return prob->nbinvars;
2320 }
2321 
2322 /** gets number of integer problem variables */
2324  SCIP_PROB* prob /**< problem data */
2325  )
2326 {
2327  assert(prob != NULL);
2328  return prob->nintvars;
2329 }
2330 
2331 /** gets number of implicit integer problem variables */
2333  SCIP_PROB* prob /**< problem data */
2334  )
2335 {
2336  assert(prob != NULL);
2337  return prob->nimplvars;
2338 }
2339 
2340 /** gets number of continuous problem variables */
2342  SCIP_PROB* prob /**< problem data */
2343  )
2344 {
2345  assert(prob != NULL);
2346  return prob->ncontvars;
2347 }
2348 
2349 /** gets problem variables */
2351  SCIP_PROB* prob /**< problem data */
2352  )
2353 {
2354  assert(prob != NULL);
2355  return prob->vars;
2356 }
2357 
2358 /** gets number of problem constraints */
2360  SCIP_PROB* prob /**< problem data */
2361  )
2362 {
2363  assert(prob != NULL);
2364  return prob->nconss;
2365 }
2366 
2367 /** gets the objective offset */
2369  SCIP_PROB* prob /**< problem data */
2370  )
2371 {
2372  assert(prob != NULL);
2373  return prob->objoffset;
2374 }
2375 
2376 /** gets the objective scalar */
2378  SCIP_PROB* prob /**< problem data */
2379  )
2380 {
2381  assert(prob != NULL);
2382  return prob->objscale;
2383 }
2384 
2385 /** is constraint compression enabled for this problem? */
2387  SCIP_PROB* prob /**< problem data */
2388  )
2389 {
2390  assert(prob != NULL);
2391 
2392  return prob->conscompression;
2393 }
2394 
2395 /** enable problem compression, i.e., constraints can reduce memory size by removing fixed variables during creation */
2397  SCIP_PROB* prob /**< problem data */
2398  )
2399 {
2400  assert(prob != NULL);
2401 
2402  prob->conscompression = TRUE;
2403 }
2404 
2405 #endif
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
SCIP_Bool SCIPsetIsInfinity(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5776
internal methods for managing events
SCIP_VAR * SCIPprobFindVar(SCIP_PROB *prob, const char *name)
Definition: prob.c:2113
int SCIPprobGetNBinVars(SCIP_PROB *prob)
Definition: prob.c:2314
void SCIPvarUpdateBestRootSol(SCIP_VAR *var, SCIP_SET *set, SCIP_Real rootsol, SCIP_Real rootredcost, SCIP_Real rootlpobjval)
Definition: var.c:12688
SCIP_RETCODE SCIPlpUpdateAddVar(SCIP_LP *lp, SCIP_SET *set, SCIP_VAR *var)
Definition: lp.c:13539
static void probInsertVar(SCIP_PROB *prob, SCIP_VAR *var)
Definition: prob.c:701
void SCIPstatComputeRootLPBestEstimate(SCIP_STAT *stat, SCIP_SET *set, SCIP_Real rootlpobjval, SCIP_VAR **vars, int nvars)
Definition: stat.c:669
SCIP_HASHTABLE * varnames
Definition: struct_prob.h:54
SCIP_RETCODE SCIPconsActivate(SCIP_CONS *cons, SCIP_SET *set, SCIP_STAT *stat, int depth, SCIP_Bool focusnode)
Definition: cons.c:6638
#define BMSfreeMemoryArrayNull(ptr)
Definition: memory.h:130
int SCIPprobGetNConss(SCIP_PROB *prob)
Definition: prob.c:2359
unsigned int active
Definition: struct_cons.h:76
internal methods for branch and bound tree
SCIP_Bool SCIPprobIsConsCompressionEnabled(SCIP_PROB *prob)
Definition: prob.c:2386
void SCIPprobSetData(SCIP_PROB *prob, SCIP_PROBDATA *probdata)
Definition: prob.c:689
SCIP_PROBDATA * SCIPprobGetData(SCIP_PROB *prob)
Definition: prob.c:2286
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2265
void SCIPprobUpdateBestRootSol(SCIP_PROB *prob, SCIP_SET *set, SCIP_STAT *stat, SCIP_LP *lp)
Definition: prob.c:1742
SCIP_Bool SCIPsetIsFeasEQ(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:6174
enum SCIP_BaseStat SCIP_BASESTAT
Definition: type_lpi.h:86
#define SCIP_DECL_PROBINITSOL(x)
Definition: type_prob.h:97
void SCIPlpSetRootLPIsRelax(SCIP_LP *lp, SCIP_Bool isrelax)
Definition: lp.c:16861
SCIP_RETCODE SCIPeventqueueAdd(SCIP_EVENTQUEUE *eventqueue, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_PRIMAL *primal, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTFILTER *eventfilter, SCIP_EVENT **event)
Definition: event.c:2117
#define SCIP_MAXSTRLEN
Definition: def.h:259
SCIP_RETCODE SCIPconflictstoreTransform(SCIP_CONFLICTSTORE *conflictstore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_PROB *transprob, SCIP_REOPT *reopt)
#define SCIP_DECL_PROBDELORIG(x)
Definition: type_prob.h:55
SCIP_BASESTAT SCIPcolGetBasisStatus(SCIP_COL *col)
Definition: lp.c:16240
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
Definition: var.c:17332
SCIP_RETCODE SCIPprobChgVarType(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_BRANCHCAND *branchcand, SCIP_CLIQUETABLE *cliquetable, SCIP_VAR *var, SCIP_VARTYPE vartype)
Definition: prob.c:1125
SCIP_RETCODE SCIPvarAddLocks(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTQUEUE *eventqueue, int addnlocksdown, int addnlocksup)
Definition: var.c:3047
SCIP_RETCODE SCIPprobVarChangedStatus(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_BRANCHCAND *branchcand, SCIP_CLIQUETABLE *cliquetable, SCIP_VAR *var)
Definition: prob.c:1171
int nintvars
Definition: struct_prob.h:63
void SCIPprobAddObjoffset(SCIP_PROB *prob, SCIP_Real addval)
Definition: prob.c:1420
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
Definition: var.c:16842
SCIP_Real SCIPsetInfinity(SCIP_SET *set)
Definition: set.c:5636
SCIP_Longint nactiveconssadded
Definition: struct_stat.h:113
SCIP_Real SCIPvarGetSol(SCIP_VAR *var, SCIP_Bool getlpval)
Definition: var.c:12665
int SCIPprobGetNVars(SCIP_PROB *prob)
Definition: prob.c:2305
int startnconss
Definition: struct_prob.h:76
#define SCIP_DECL_PROBDELTRANS(x)
Definition: type_prob.h:86
void SCIPvarSetProbindex(SCIP_VAR *var, int probindex)
Definition: var.c:5735
static SCIP_Bool consHasName(SCIP_CONS *cons)
Definition: prob.c:151
#define FALSE
Definition: def.h:64
SCIP_Bool SCIPlpIsSolBasic(SCIP_LP *lp)
Definition: lp.c:16979
SCIP_Bool SCIPsetIsFeasIntegral(SCIP_SET *set, SCIP_Real val)
Definition: set.c:6317
SCIP_Real objoffset
Definition: struct_prob.h:41
SCIP_RETCODE SCIPvarTransform(SCIP_VAR *origvar, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_OBJSENSE objsense, SCIP_VAR **transvar)
Definition: var.c:3290
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10011
SCIP_Bool SCIPsetIsZero(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5888
#define TRUE
Definition: def.h:63
void SCIPprobSetExitsol(SCIP_PROB *prob, SCIP_DECL_PROBEXITSOL((*probexitsol)))
Definition: prob.c:372
void SCIPprobMarkNConss(SCIP_PROB *prob)
Definition: prob.c:1394
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
unsigned int enabled
Definition: struct_cons.h:82
SCIP_Real SCIPprobInternObjval(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_Real objval)
Definition: prob.c:2091
#define SCIPsetAllocBufferArray(set, ptr, num)
Definition: set.h:1877
int SCIPvarGetProbindex(SCIP_VAR *var)
Definition: var.c:16969
internal methods for branching rules and branching candidate storage
int SCIPsetCalcMemGrowSize(SCIP_SET *set, int num)
Definition: set.c:5326
void SCIPvarInitSolve(SCIP_VAR *var)
Definition: var.c:2810
SCIP_RETCODE SCIPprobInitSolve(SCIP_PROB *prob, SCIP_SET *set)
Definition: prob.c:1849
SCIP_VAR ** fixedvars
Definition: struct_prob.h:56
SCIP_RETCODE SCIPprobScaleObj(SCIP_PROB *transprob, SCIP_PROB *origprob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue)
Definition: prob.c:1584
#define SCIPdebugMessage
Definition: pub_message.h:77
void SCIPprobUpdateNObjVars(SCIP_PROB *prob, SCIP_SET *set, SCIP_Real oldobj, SCIP_Real newobj)
Definition: prob.c:1530
int nimplvars
Definition: struct_prob.h:64
#define SCIP_DECL_PROBCOPY(x)
Definition: type_prob.h:140
#define SCIP_LONGINT_MAX
Definition: def.h:135
#define SCIPsetFreeBufferArray(set, ptr)
Definition: set.h:1884
#define BMSfreeMemory(ptr)
Definition: memory.h:127
SCIP_LPSOLSTAT SCIPlpGetSolstat(SCIP_LP *lp)
Definition: lp.c:12612
internal methods for LP management
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
Definition: cons.c:8047
SCIP_RETCODE SCIPconsResetAge(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:7058
SCIP_HASHTABLE * consnames
Definition: struct_prob.h:58
internal methods for collecting primal CIP solutions and primal informations
SCIP_CONSSETCHG * addconssetchg
Definition: struct_cons.h:48
SCIP_RETCODE SCIPhashtableCreate(SCIP_HASHTABLE **hashtable, BMS_BLKMEM *blkmem, int tablesize, SCIP_DECL_HASHGETKEY((*hashgetkey)), SCIP_DECL_HASHKEYEQ((*hashkeyeq)), SCIP_DECL_HASHKEYVAL((*hashkeyval)), void *userptr)
Definition: misc.c:2014
void SCIPprobSetObjIntegral(SCIP_PROB *prob)
Definition: prob.c:1455
int SCIPlpGetNCols(SCIP_LP *lp)
Definition: lp.c:16744
SCIP_VAR * SCIPvarGetNegatedVar(SCIP_VAR *var)
Definition: var.c:17092
int nobjvars
Definition: struct_prob.h:71
SCIP_Real dualbound
Definition: struct_prob.h:45
void SCIPprobPrintPseudoSol(SCIP_PROB *prob, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
Definition: prob.c:2151
SCIP_RETCODE SCIPprobFree(SCIP_PROB **prob, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp)
Definition: prob.c:394
void SCIPprobPrintStatistics(SCIP_PROB *prob, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: prob.c:2173
SCIP_Real SCIPprobGetObjlim(SCIP_PROB *prob, SCIP_SET *set)
Definition: prob.c:2274
int ndeletedvars
Definition: struct_prob.h:70
unsigned int deleted
Definition: struct_cons.h:85
SCIP_RETCODE SCIPprobAddConsName(SCIP_PROB *prob, SCIP_CONS *cons)
Definition: prob.c:1229
void SCIPprobSetInitsol(SCIP_PROB *prob, SCIP_DECL_PROBINITSOL((*probinitsol)))
Definition: prob.c:361
SCIP_Bool SCIPsetIsLT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5816
SCIP_Real SCIPprobGetObjscale(SCIP_PROB *prob)
Definition: prob.c:2377
static SCIP_RETCODE probEnsureVarsMem(SCIP_PROB *prob, SCIP_SET *set, int num)
Definition: prob.c:55
SCIP_RETCODE SCIPvarChgType(SCIP_VAR *var, SCIP_VARTYPE vartype)
Definition: var.c:5850
void SCIPprobSetCopy(SCIP_PROB *prob, SCIP_DECL_PROBCOPY((*probcopy)))
Definition: prob.c:383
SCIP_Real SCIPvarGetImplRedcost(SCIP_VAR *var, SCIP_SET *set, SCIP_Bool varfixing, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_LP *lp)
Definition: var.c:12875
SCIP_RETCODE SCIPprobPerformVarDeletions(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_CLIQUETABLE *cliquetable, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand)
Definition: prob.c:1054
static SCIP_RETCODE probEnsureDeletedvarsMem(SCIP_PROB *prob, SCIP_SET *set, int num)
Definition: prob.c:103
SCIP_RETCODE SCIPprobRemoveVarName(SCIP_PROB *prob, SCIP_VAR *var)
Definition: prob.c:899
void SCIPprobSetObjsense(SCIP_PROB *prob, SCIP_OBJSENSE objsense)
Definition: prob.c:1407
SCIP_Real SCIPcolGetPrimsol(SCIP_COL *col)
Definition: lp.c:16205
int SCIPprobGetNImplVars(SCIP_PROB *prob)
Definition: prob.c:2332
#define BMSfreeMemoryArray(ptr)
Definition: memory.h:129
#define OBJSCALE_MAXFINALSCALE
Definition: prob.c:45
SCIP_Bool permuted
Definition: struct_prob.h:81
internal methods for storing and manipulating the main problem
#define SCIPerrorMessage
Definition: pub_message.h:45
SCIP_RETCODE SCIPconsTransform(SCIP_CONS *origcons, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_CONS **transcons)
Definition: cons.c:6319
SCIP_Bool SCIPlpIsDualReliable(SCIP_LP *lp)
Definition: lp.c:16969
SCIP_RETCODE SCIPprobExitSolve(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp, SCIP_Bool restart)
Definition: prob.c:1884
#define OBJSCALE_MAXDNOM
Definition: prob.c:43
SCIP_CONS * SCIPprobFindCons(SCIP_PROB *prob, const char *name)
Definition: prob.c:2132
SCIP_RETCODE SCIPvarChgObj(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_Real newobj)
Definition: var.c:5901
int varssize
Definition: struct_prob.h:60
void SCIPprobEnableConsCompression(SCIP_PROB *prob)
Definition: prob.c:2396
SCIP_RETCODE SCIPvarRelease(SCIP_VAR **var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp)
Definition: var.c:2765
SCIP_Bool SCIPvarIsTransformedOrigvar(SCIP_VAR *var)
Definition: var.c:12271
SCIP_RETCODE SCIPeventCreateVarAdded(SCIP_EVENT **event, BMS_BLKMEM *blkmem, SCIP_VAR *var)
Definition: event.c:478
SCIP_RETCODE SCIPconshdlrDelVars(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:4052
SCIP_Bool objisintegral
Definition: struct_prob.h:78
const char * SCIPconsGetName(SCIP_CONS *cons)
Definition: cons.c:7986
SCIP_OBJSENSE objsense
Definition: struct_prob.h:77
static SCIP_RETCODE probEnsureConssMem(SCIP_PROB *prob, SCIP_SET *set, int num)
Definition: prob.c:127
const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:16662
int SCIPprobGetNObjVars(SCIP_PROB *prob, SCIP_SET *set)
Definition: prob.c:1972
char * name
Definition: struct_prob.h:46
#define REALABS(x)
Definition: def.h:173
SCIP_RETCODE SCIPprobSetName(SCIP_PROB *prob, const char *name)
Definition: prob.c:1934
SCIP_Bool SCIPprobIsObjIntegral(SCIP_PROB *prob)
Definition: prob.c:2250
void SCIPsortPtr(void **ptrarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
internal methods for global SCIP settings
internal methods for storing conflicts
SCIP * scip
Definition: struct_cons.h:40
#define SCIP_CALL(x)
Definition: def.h:350
void SCIPmessageFPrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
Definition: message.c:441
SCIP_RETCODE SCIPprobAddVarName(SCIP_PROB *prob, SCIP_VAR *var)
Definition: prob.c:883
SCIP_RETCODE SCIPprobResetBounds(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: prob.c:605
void SCIPmessagePrintInfo(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
Definition: message.c:584
SCIP_RETCODE SCIPhashtableRemove(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2395
int SCIPprobGetNContVars(SCIP_PROB *prob)
Definition: prob.c:2341
SCIP_RETCODE SCIPconsAddLocks(SCIP_CONS *cons, SCIP_SET *set, int nlockspos, int nlocksneg)
Definition: cons.c:7159
SCIP_RETCODE SCIPprobCreate(SCIP_PROB **prob, BMS_BLKMEM *blkmem, SCIP_SET *set, const char *name, SCIP_DECL_PROBDELORIG((*probdelorig)), SCIP_DECL_PROBTRANS((*probtrans)), SCIP_DECL_PROBDELTRANS((*probdeltrans)), SCIP_DECL_PROBINITSOL((*probinitsol)), SCIP_DECL_PROBEXITSOL((*probexitsol)), SCIP_DECL_PROBCOPY((*probcopy)), SCIP_PROBDATA *probdata, SCIP_Bool transformed)
Definition: prob.c:249
SCIP_Bool SCIPsetIsEQ(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5798
SCIP_Bool conscompression
Definition: struct_prob.h:82
SCIP_Real SCIPlpGetObjval(SCIP_LP *lp, SCIP_SET *set, SCIP_PROB *prob)
Definition: lp.c:12628
void SCIPprobResortVars(SCIP_PROB *prob)
Definition: prob.c:631
int SCIPprobGetNIntVars(SCIP_PROB *prob)
Definition: prob.c:2323
SCIP_Bool SCIPconshdlrNeedsCons(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5029
#define BMSduplicateMemoryArray(ptr, source, num)
Definition: memory.h:125
SCIP_RETCODE SCIPconshdlrUnlockVars(SCIP_CONSHDLR *conshdlr, SCIP_SET *set)
Definition: cons.c:4098
void SCIPvarSetBestRootSol(SCIP_VAR *var, SCIP_Real rootsol, SCIP_Real rootredcost, SCIP_Real rootlpobjval)
Definition: var.c:13253
#define SCIP_DECL_PROBTRANS(x)
Definition: type_prob.h:74
data structures and methods for collecting reoptimization information
internal methods for problem variables
SCIP_Bool SCIPsetIsIntegral(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5921
public data structures and miscellaneous methods
SCIP_PROBDATA * probdata
Definition: struct_prob.h:53
#define SCIP_Bool
Definition: def.h:61
#define SCIP_DECL_PROBEXITSOL(x)
Definition: type_prob.h:110
void SCIPvarCapture(SCIP_VAR *var)
Definition: var.c:2753
SCIP_Bool SCIPprobIsPermuted(SCIP_PROB *prob)
Definition: prob.c:2220
char * name
Definition: struct_cons.h:43
int ncontvars
Definition: struct_prob.h:65
int nbinvars
Definition: struct_prob.h:62
SCIP_Real SCIPprobGetObjoffset(SCIP_PROB *prob)
Definition: prob.c:2368
enum SCIP_Objsense SCIP_OBJSENSE
Definition: type_prob.h:41
SCIP_RETCODE SCIPvarRemove(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_CLIQUETABLE *cliquetable, SCIP_SET *set, SCIP_Bool final)
Definition: var.c:5768
SCIP_RETCODE SCIPconsRelease(SCIP_CONS **cons, BMS_BLKMEM *blkmem, SCIP_SET *set)
Definition: cons.c:6112
void SCIPvarStoreRootSol(SCIP_VAR *var, SCIP_Bool roothaslp)
Definition: var.c:12677
#define MAX(x, y)
Definition: tclique_def.h:75
void SCIPprobSetTrans(SCIP_PROB *prob, SCIP_DECL_PROBTRANS((*probtrans)))
Definition: prob.c:339
SCIP_RETCODE SCIPprobCheckObjIntegral(SCIP_PROB *transprob, SCIP_PROB *origprob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue)
Definition: prob.c:1467
#define SCIPsetDebugMsg
Definition: set.h:1913
SCIP_RETCODE SCIPeventCreateVarDeleted(SCIP_EVENT **event, BMS_BLKMEM *blkmem, SCIP_VAR *var)
Definition: event.c:496
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
Definition: cons.c:8185
SCIP_Bool SCIPprobAllColsInLP(SCIP_PROB *prob, SCIP_SET *set, SCIP_LP *lp)
Definition: prob.c:2262
SCIP_RETCODE SCIPprobRemoveConsName(SCIP_PROB *prob, SCIP_CONS *cons)
Definition: prob.c:1244
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
Definition: var.c:17124
SCIP_VAR ** deletedvars
Definition: struct_prob.h:57
SCIP_RETCODE SCIPprobTransform(SCIP_PROB *source, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTFILTER *eventfilter, SCIP_EVENTQUEUE *eventqueue, SCIP_CONFLICTSTORE *conflictstore, SCIP_PROB **target)
Definition: prob.c:504
SCIP_COL * SCIPvarGetCol(SCIP_VAR *var)
Definition: var.c:16990
SCIP_RETCODE SCIPbranchcandUpdateVar(SCIP_BRANCHCAND *branchcand, SCIP_SET *set, SCIP_VAR *var)
Definition: branch.c:1137
SCIP_Real SCIPprobGetAbsMaxObjCoef(SCIP_PROB *prob, SCIP_SET *set)
Definition: prob.c:2046
void * SCIPhashtableRetrieve(SCIP_HASHTABLE *hashtable, void *key)
Definition: misc.c:2326
SCIP_Bool transformed
Definition: struct_prob.h:79
void SCIPprobSetObjlim(SCIP_PROB *prob, SCIP_Real objlim)
Definition: prob.c:1444
int maxnconss
Definition: struct_prob.h:74
SCIP_RETCODE SCIPprobDelCons(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_CONS *cons)
Definition: prob.c:1334
int nfixedvars
Definition: struct_prob.h:68
int ncolvars
Definition: struct_prob.h:66
SCIP * scip
Definition: struct_var.h:201
void SCIPprobStoreRootSol(SCIP_PROB *prob, SCIP_SET *set, SCIP_STAT *stat, SCIP_LP *lp, SCIP_Bool roothaslp)
Definition: prob.c:1715
SCIP_Bool SCIPprobIsTransformed(SCIP_PROB *prob)
Definition: prob.c:2240
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
Definition: misc.c:2064
#define SCIP_HASHSIZE_NAMES
Definition: def.h:269
SCIP_Bool SCIPsetIsDualfeasPositive(SCIP_SET *set, SCIP_Real val)
Definition: set.c:6506
SCIP_RETCODE SCIPvarLoose(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTQUEUE *eventqueue, SCIP_PROB *prob, SCIP_LP *lp)
Definition: var.c:3436
SCIP_Real SCIPprobGetAbsMinObjCoef(SCIP_PROB *prob, SCIP_SET *set)
Definition: prob.c:2019
SCIP_Real SCIPsetFeasFloor(SCIP_SET *set, SCIP_Real val)
Definition: set.c:6341
void SCIPlpStoreRootObjval(SCIP_LP *lp, SCIP_SET *set, SCIP_PROB *prob)
Definition: lp.c:12687
SCIP_Real objlim
Definition: struct_prob.h:44
void SCIPconsCapture(SCIP_CONS *cons)
Definition: cons.c:6100
struct SCIP_ProbData SCIP_PROBDATA
Definition: type_prob.h:44
SCIP_Bool nlpenabled
Definition: struct_prob.h:80
int fixedvarssize
Definition: struct_prob.h:67
static SCIP_RETCODE probEnsureFixedvarsMem(SCIP_PROB *prob, SCIP_SET *set, int num)
Definition: prob.c:79
static SCIP_RETCODE probRemoveVar(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_CLIQUETABLE *cliquetable, SCIP_SET *set, SCIP_VAR *var)
Definition: prob.c:789
SCIP_RETCODE SCIPprobCopy(SCIP_PROB **prob, BMS_BLKMEM *blkmem, SCIP_SET *set, const char *name, SCIP *sourcescip, SCIP_PROB *sourceprob, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global)
Definition: prob.c:186
int nconss
Definition: struct_prob.h:73
#define SCIP_HASHSIZE_NAMES_SMALL
Definition: def.h:272
public methods for message output
void SCIPprobUpdateDualbound(SCIP_PROB *prob, SCIP_Real newbound)
Definition: prob.c:1547
void SCIPprobSetDelorig(SCIP_PROB *prob, SCIP_DECL_PROBDELORIG((*probdelorig)))
Definition: prob.c:328
void SCIPmessageFPrintInfo(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr,...)
Definition: message.c:608
SCIP_Bool SCIPsetIsGT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5852
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
Definition: var.c:16781
SCIP_RETCODE SCIPvarResetBounds(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: var.c:8864
#define SCIP_Real
Definition: def.h:149
internal methods for problem statistics
SCIP_VAR ** vars
Definition: struct_prob.h:55
void SCIPprobSetDualbound(SCIP_PROB *prob, SCIP_Real dualbound)
Definition: prob.c:1433
int consssize
Definition: struct_prob.h:72
SCIP_VAR ** SCIPprobGetVars(SCIP_PROB *prob)
Definition: prob.c:2350
#define BMSallocMemory(ptr)
Definition: memory.h:101
SCIP_CONS ** conss
Definition: struct_prob.h:59
#define SCIP_INVALID
Definition: def.h:169
#define BMSreallocMemoryArray(ptr, num)
Definition: memory.h:109
internal methods for constraints and constraint handlers
int SCIPvarGetNUses(SCIP_VAR *var)
Definition: var.c:16672
SCIP_Bool SCIPlpIsRelax(SCIP_LP *lp)
Definition: lp.c:16939
SCIP_RETCODE SCIPprimalUpdateObjoffset(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp)
Definition: primal.c:443
#define SCIP_Longint
Definition: def.h:134
SCIP_RETCODE SCIPcalcIntegralScalar(SCIP_Real *vals, int nvals, SCIP_Real mindelta, SCIP_Real maxdelta, SCIP_Longint maxdnom, SCIP_Real maxscale, SCIP_Real *intscalar, SCIP_Bool *success)
Definition: misc.c:8881
int SCIPprobGetNImplBinVars(SCIP_PROB *prob)
Definition: prob.c:1955
SCIP_RETCODE SCIPbranchcandRemoveVar(SCIP_BRANCHCAND *branchcand, SCIP_VAR *var)
Definition: branch.c:1120
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
Definition: var.c:16827
SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2377
void SCIPprobInvalidateDualbound(SCIP_PROB *prob)
Definition: prob.c:1574
void SCIPprobSetDeltrans(SCIP_PROB *prob, SCIP_DECL_PROBDELTRANS((*probdeltrans)))
Definition: prob.c:350
SCIP_Real SCIPsetEpsilon(SCIP_SET *set)
Definition: set.c:5658
SCIP_STAGE SCIPsetGetStage(SCIP_SET *set)
Definition: set.c:2781
unsigned int updatedeactivate
Definition: struct_cons.h:89
enum SCIP_Vartype SCIP_VARTYPE
Definition: type_var.h:60
SCIP_Real SCIPprobExternObjval(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_Real objval)
Definition: prob.c:2069
static SCIP_Bool varHasName(SCIP_VAR *var)
Definition: prob.c:164
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
Definition: var.c:17342
SCIP_RETCODE SCIPprobAddCons(SCIP_PROB *prob, SCIP_SET *set, SCIP_STAT *stat, SCIP_CONS *cons)
Definition: prob.c:1266
int addarraypos
Definition: struct_cons.h:50
SCIP_RETCODE SCIPconsDeactivate(SCIP_CONS *cons, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:6680
SCIP_Bool SCIPsetIsDualfeasNegative(SCIP_SET *set, SCIP_Real val)
Definition: set.c:6517
void SCIPconsSetLocal(SCIP_CONS *cons, SCIP_Bool local)
Definition: cons.c:6556
SCIP_RETCODE SCIPprobDelVar(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTQUEUE *eventqueue, SCIP_VAR *var, SCIP_Bool *deleted)
Definition: prob.c:993
common defines and data types used in all packages of SCIP
SCIP_Longint nnodes
Definition: struct_stat.h:71
SCIP_RETCODE SCIPprobExitPresolve(SCIP_PROB *prob, SCIP_SET *set)
Definition: prob.c:1840
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:419
SCIP_RETCODE SCIPlpUpdateDelVar(SCIP_LP *lp, SCIP_SET *set, SCIP_VAR *var)
Definition: lp.c:13560
int startnvars
Definition: struct_prob.h:75
SCIP_Real SCIPvarGetPseudoSol(SCIP_VAR *var)
Definition: var.c:17728
SCIP_Real SCIPcolGetRedcost(SCIP_COL *col, SCIP_STAT *stat, SCIP_LP *lp)
Definition: lp.c:3855
#define SCIP_ALLOC(x)
Definition: def.h:361
SCIP_Real SCIPlpGetColumnObjval(SCIP_LP *lp)
Definition: lp.c:12656
#define SCIPABORT()
Definition: def.h:322
SCIP_LPSOLSTAT lpsolstat
Definition: struct_lp.h:334
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
Definition: var.c:16853
SCIP_RETCODE SCIPconshdlrLockVars(SCIP_CONSHDLR *conshdlr, SCIP_SET *set)
Definition: cons.c:4083
const char * SCIPprobGetName(SCIP_PROB *prob)
Definition: prob.c:2296
SCIP_Longint SCIPcalcGreComDiv(SCIP_Longint val1, SCIP_Longint val2)
Definition: misc.c:8448
void SCIPprobMarkPermuted(SCIP_PROB *prob)
Definition: prob.c:2230
void SCIPvarMarkDeleted(SCIP_VAR *var)
Definition: var.c:5804
#define OBJSCALE_MAXSCALE
Definition: prob.c:44
SCIP_RETCODE SCIPprobAddVar(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTFILTER *eventfilter, SCIP_EVENTQUEUE *eventqueue, SCIP_VAR *var)
Definition: prob.c:914
SCIP_Real objscale
Definition: struct_prob.h:42
int deletedvarssize
Definition: struct_prob.h:69