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