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