Scippy

SCIP

Solving Constraint Integer Programs

sol.c
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2016 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file sol.c
17  * @brief methods for storing primal CIP solutions
18  * @author Tobias Achterberg
19  */
20 
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
23 #include <assert.h>
24 
25 #include "scip/def.h"
26 #include "scip/set.h"
27 #include "scip/stat.h"
28 #include "scip/clock.h"
29 #include "scip/misc.h"
30 #include "scip/lp.h"
31 #include "scip/nlp.h"
32 #include "scip/relax.h"
33 #include "scip/var.h"
34 #include "scip/prob.h"
35 #include "scip/sol.h"
36 #include "scip/primal.h"
37 #include "scip/tree.h"
38 #include "scip/cons.h"
39 #include "scip/pub_message.h"
40 
41 #ifndef NDEBUG
42 #include "scip/struct_sol.h"
43 #endif
44 
45 
46 
47 /** clears solution arrays of primal CIP solution */
48 static
50  SCIP_SOL* sol /**< primal CIP solution */
51  )
52 {
53  assert(sol != NULL);
54 
56  sol->hasinfval = FALSE;
57 
58  return SCIP_OKAY;
59 }
60 
61 /** sets value of variable in the solution's array */
62 static
64  SCIP_SOL* sol, /**< primal CIP solution */
65  SCIP_SET* set, /**< global SCIP settings */
66  SCIP_VAR* var, /**< problem variable */
67  SCIP_Real val /**< value to set variable to */
68  )
69 {
70  int idx;
71 
72  assert(sol != NULL);
73 
74  idx = SCIPvarGetIndex(var);
75 
76  /* from now on, variable must not be deleted */
78 
79  /* mark the variable valid */
80  SCIP_CALL( SCIPboolarraySetVal(sol->valid, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, TRUE) );
81 
82  /* set the value in the solution array */
83  SCIP_CALL( SCIPrealarraySetVal(sol->vals, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, val) );
84 
85  /* store whether the solution has infinite values assigned to variables */
86  if( val != SCIP_UNKNOWN ) /*lint !e777*/
87  sol->hasinfval = (sol->hasinfval || SCIPsetIsInfinity(set, val) || SCIPsetIsInfinity(set, -val));
88 
89  return SCIP_OKAY;
90 }
91 
92 /** increases value of variable in the solution's array */
93 static
95  SCIP_SOL* sol, /**< primal CIP solution */
96  SCIP_SET* set, /**< global SCIP settings */
97  SCIP_VAR* var, /**< problem variable */
98  SCIP_Real incval /**< increase of variable's solution value */
99  )
100 {
101  int idx;
102 
103  assert(sol != NULL);
104 
105  idx = SCIPvarGetIndex(var);
106 
107  /* from now on, variable must not be deleted */
109 
110  /* if the variable was not valid, mark it to be valid and set the value to the incval (it is 0.0 if not valid) */
111  if( !SCIPboolarrayGetVal(sol->valid, idx) )
112  {
113  /* mark the variable valid */
114  SCIP_CALL( SCIPboolarraySetVal(sol->valid, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, TRUE) );
115 
116  /* set the value in the solution array */
117  SCIP_CALL( SCIPrealarraySetVal(sol->vals, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, incval) );
118  }
119  else
120  {
121  /* increase the value in the solution array */
122  SCIP_CALL( SCIPrealarrayIncVal(sol->vals, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, incval) );
123  }
124 
125  /* store whether the solution has infinite values assigned to variables */
126  incval = SCIPrealarrayGetVal(sol->vals, idx);
127  if( incval != SCIP_UNKNOWN ) /*lint !e777*/
128  sol->hasinfval = (sol->hasinfval || SCIPsetIsInfinity(set, incval) || SCIPsetIsInfinity(set, -incval));
129 
130  return SCIP_OKAY;
131 }
132 
133 /** returns the value of the variable in the given solution */
134 static
136  SCIP_SOL* sol, /**< primal CIP solution */
137  SCIP_VAR* var /**< problem variable */
138  )
139 {
140  int idx;
141 
142  assert(sol != NULL);
143 
144  idx = SCIPvarGetIndex(var);
145 
146  /* check, if the variable's value is valid */
147  if( SCIPboolarrayGetVal(sol->valid, idx) )
148  {
149  return SCIPrealarrayGetVal(sol->vals, idx);
150  }
151  else
152  {
153  /* return the variable's value corresponding to the origin */
154  switch( sol->solorigin )
155  {
157  case SCIP_SOLORIGIN_ZERO:
158  return 0.0;
159 
161  return SCIPvarGetLPSol(var);
162 
164  return SCIPvarGetNLPSol(var);
165 
167  return SCIPvarGetRelaxSolTransVar(var);
168 
170  return SCIPvarGetPseudoSol(var);
171 
173  return SCIP_UNKNOWN;
174 
175  default:
176  SCIPerrorMessage("unknown solution origin <%d>\n", sol->solorigin);
177  SCIPABORT();
178  return 0.0; /*lint !e527*/
179  }
180  }
181 }
182 
183 /** stores solution value of variable in solution's own array */
184 static
186  SCIP_SOL* sol, /**< primal CIP solution */
187  SCIP_SET* set, /**< global SCIP settings */
188  SCIP_VAR* var /**< problem variable */
189  )
190 {
191  SCIP_Real solval;
192 
193  assert(sol != NULL);
194  assert(var != NULL);
195  assert(SCIPvarIsTransformed(var));
197 
198  /* if variable is already valid, nothing has to be done */
199  if( SCIPboolarrayGetVal(sol->valid, SCIPvarGetIndex(var)) )
200  return SCIP_OKAY;
201 
202  SCIPdebugMessage("unlinking solution value of variable <%s>\n", SCIPvarGetName(var));
203 
204  /* store the correct solution value into the solution array */
205  switch( sol->solorigin )
206  {
208  SCIPerrorMessage("cannot unlink solutions of original problem space\n");
209  return SCIP_INVALIDDATA;
210 
211  case SCIP_SOLORIGIN_ZERO:
212  return SCIP_OKAY;
213 
215  solval = SCIPvarGetLPSol(var);
216  SCIP_CALL( solSetArrayVal(sol, set, var, solval) );
217  return SCIP_OKAY;
218 
220  solval = SCIPvarGetNLPSol(var);
221  SCIP_CALL( solSetArrayVal(sol, set, var, solval) );
222  return SCIP_OKAY;
223 
225  solval = SCIPvarGetRelaxSolTransVar(var);
226  SCIP_CALL( solSetArrayVal(sol, set, var, solval) );
227  return SCIP_OKAY;
228 
230  solval = SCIPvarGetPseudoSol(var);
231  SCIP_CALL( solSetArrayVal(sol, set, var, solval) );
232  return SCIP_OKAY;
233 
235  SCIP_CALL( solSetArrayVal(sol, set, var, SCIP_UNKNOWN) );
236  return SCIP_OKAY;
237 
238  default:
239  SCIPerrorMessage("unknown solution origin <%d>\n", sol->solorigin);
240  return SCIP_INVALIDDATA;
241  }
242 }
243 
244 /** sets the solution time, nodenum, runnum, and depth stamp to the current values */
245 static
246 void solStamp(
247  SCIP_SOL* sol, /**< primal CIP solution */
248  SCIP_STAT* stat, /**< problem statistics data */
249  SCIP_TREE* tree, /**< branch and bound tree, or NULL */
250  SCIP_Bool checktime /**< should the time be updated? */
251  )
252 {
253  assert(sol != NULL);
254  assert(stat != NULL);
255 
256  if( checktime )
257  {
258  sol->time = SCIPclockGetTime(stat->solvingtime);
259 #ifndef NDEBUG
260  sol->lpcount = stat->lpcount;
261 #endif
262  }
263  else
264  sol->time = SCIPclockGetLastTime(stat->solvingtime);
265  sol->nodenum = stat->nnodes;
266  sol->runnum = stat->nruns;
267  if( tree == NULL )
268  sol->depth = -1;
269  else
270  sol->depth = SCIPtreeGetCurrentDepth(tree);
271 }
272 
273 /** creates primal CIP solution, initialized to zero */
275  SCIP_SOL** sol, /**< pointer to primal CIP solution */
276  BMS_BLKMEM* blkmem, /**< block memory */
277  SCIP_SET* set, /**< global SCIP settings */
278  SCIP_STAT* stat, /**< problem statistics data */
279  SCIP_PRIMAL* primal, /**< primal data */
280  SCIP_TREE* tree, /**< branch and bound tree */
281  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
282  )
283 {
284  assert(sol != NULL);
285  assert(blkmem != NULL);
286  assert(stat != NULL);
287 
288  SCIP_ALLOC( BMSallocBlockMemory(blkmem, sol) );
289  SCIP_CALL( SCIPrealarrayCreate(&(*sol)->vals, blkmem) );
290  SCIP_CALL( SCIPboolarrayCreate(&(*sol)->valid, blkmem) );
291  (*sol)->heur = heur;
292  (*sol)->solorigin = SCIP_SOLORIGIN_ZERO;
293  (*sol)->obj = 0.0;
294  (*sol)->primalindex = -1;
295  (*sol)->index = stat->solindex;
296  (*sol)->hasinfval = FALSE;
297  stat->solindex++;
298  solStamp(*sol, stat, tree, TRUE);
299 
300  SCIP_CALL( SCIPprimalSolCreated(primal, set, *sol) );
301 
302  return SCIP_OKAY;
303 }
304 
305 /** creates primal CIP solution in original problem space, initialized to the offset in the original problem */
307  SCIP_SOL** sol, /**< pointer to primal CIP solution */
308  BMS_BLKMEM* blkmem, /**< block memory */
309  SCIP_SET* set, /**< global SCIP settings */
310  SCIP_STAT* stat, /**< problem statistics data */
311  SCIP_PROB* origprob, /**< original problem data */
312  SCIP_PRIMAL* primal, /**< primal data */
313  SCIP_TREE* tree, /**< branch and bound tree */
314  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
315  )
316 {
317  assert(sol != NULL);
318  assert(blkmem != NULL);
319  assert(stat != NULL);
320 
321  SCIP_ALLOC( BMSallocBlockMemory(blkmem, sol) );
322  SCIP_CALL( SCIPrealarrayCreate(&(*sol)->vals, blkmem) );
323  SCIP_CALL( SCIPboolarrayCreate(&(*sol)->valid, blkmem) );
324  (*sol)->heur = heur;
325  (*sol)->solorigin = SCIP_SOLORIGIN_ORIGINAL;
326  (*sol)->obj = origprob->objoffset;
327  (*sol)->primalindex = -1;
328  (*sol)->index = stat->solindex;
329  (*sol)->hasinfval = FALSE;
330  stat->solindex++;
331  solStamp(*sol, stat, tree, TRUE);
332 
333  SCIP_CALL( SCIPprimalSolCreated(primal, set, *sol) );
334 
335  return SCIP_OKAY;
336 }
337 
338 /** creates a copy of a primal CIP solution */
340  SCIP_SOL** sol, /**< pointer to store the copy of the primal CIP solution */
341  BMS_BLKMEM* blkmem, /**< block memory */
342  SCIP_SET* set, /**< global SCIP settings */
343  SCIP_STAT* stat, /**< problem statistics data */
344  SCIP_PRIMAL* primal, /**< primal data */
345  SCIP_SOL* sourcesol /**< primal CIP solution to copy */
346  )
347 {
348  assert(sol != NULL);
349  assert(sourcesol != NULL);
350 
351  SCIP_ALLOC( BMSallocBlockMemory(blkmem, sol) );
352  SCIP_CALL( SCIPrealarrayCopy(&(*sol)->vals, blkmem, sourcesol->vals) );
353  SCIP_CALL( SCIPboolarrayCopy(&(*sol)->valid, blkmem, sourcesol->valid) );
354  (*sol)->heur = sourcesol->heur;
355  (*sol)->obj = sourcesol->obj;
356  (*sol)->primalindex = -1;
357  (*sol)->time = sourcesol->time;
358 #ifndef NDEBUG
359  (*sol)->lpcount = sourcesol->lpcount;
360 #endif
361  (*sol)->nodenum = sourcesol->nodenum;
362  (*sol)->solorigin = sourcesol->solorigin;
363  (*sol)->runnum = sourcesol->runnum;
364  (*sol)->depth = sourcesol->depth;
365  (*sol)->index = stat->solindex;
366  (*sol)->hasinfval = sourcesol->hasinfval;
367  stat->solindex++;
368 
369  SCIP_CALL( SCIPprimalSolCreated(primal, set, *sol) );
370 
371  return SCIP_OKAY;
372 }
373 
374 /** transformes given original solution to the transformed space; a corresponding transformed solution has to be given
375  * which is copied into the existing solution and freed afterwards
376  */
378  SCIP_SOL* sol, /**< primal CIP solution to change, living in original space */
379  SCIP_SOL** transsol, /**< pointer to corresponding transformed primal CIP solution */
380  BMS_BLKMEM* blkmem, /**< block memory */
381  SCIP_SET* set, /**< global SCIP settings */
382  SCIP_PRIMAL* primal /**< primal data */
383  )
384 { /*lint --e{715}*/
385  SCIP_REALARRAY* tmpvals;
386  SCIP_BOOLARRAY* tmpvalid;
387  SCIP_SOL* tsol;
388 
389  assert(sol != NULL);
390  assert(transsol != NULL);
391  assert(SCIPsolIsOriginal(sol));
392  assert(sol->primalindex > -1);
393 
394  tsol = *transsol;
395  assert(tsol != NULL);
396  assert(!SCIPsolIsOriginal(tsol));
397 
398  /* switch vals and valid arrays; the exisiting solution gets the arrays of the transformed solution;
399  * the transformed one gets the original arrays, because they have to be freed anyway and freeing the transsol
400  * automatically frees its arrays
401  */
402  tmpvals = sol->vals;
403  tmpvalid = sol->valid;
404  sol->vals = tsol->vals;
405  sol->valid = tsol->valid;
406  tsol->vals = tmpvals;
407  tsol->valid = tmpvalid;
408 
409  /* copy solorigin and objective (should be the same, only to avoid numerical issues);
410  * we keep the other statistics of the original solution, since that was the first time that this solution as found
411  */
412  sol->solorigin = tsol->solorigin;
413  sol->obj = tsol->obj;
414 
415  SCIP_CALL( SCIPsolFree(transsol, blkmem, primal) );
416 
417  return SCIP_OKAY;
418 }
419 
420 /** adjusts solution values of implicit integer variables in handed solution. Solution objective value is not
421  * deteriorated by this method.
422  */
424  SCIP_SOL* sol, /**< primal CIP solution */
425  SCIP_SET* set, /**< global SCIP settings */
426  SCIP_STAT* stat, /**< problem statistics data */
427  SCIP_PROB* prob, /**< either original or transformed problem, depending on sol origin */
428  SCIP_TREE* tree, /**< branch and bound tree */
429  SCIP_Bool uselprows /**< should LP row information be considered for none-objective variables */
430  )
431 {
432  SCIP_VAR** vars;
433  int nimplvars;
434  int nbinvars;
435  int nintvars;
436  int v;
437 
438  assert(sol != NULL);
439  assert(prob != NULL);
440 
441  /* get variable data */
442  vars = SCIPprobGetVars(prob);
443  nbinvars = SCIPprobGetNBinVars(prob);
444  nintvars = SCIPprobGetNIntVars(prob);
445  nimplvars = SCIPprobGetNImplVars(prob);
446 
447  if( nimplvars == 0 )
448  return SCIP_OKAY;
449 
450  /* calculate the last array position of implicit integer variables */
451  nimplvars = nbinvars + nintvars + nimplvars;
452 
453  /* loop over implicit integer variables and round them up or down */
454  for( v = nbinvars + nintvars; v < nimplvars; ++v )
455  {
456  SCIP_VAR* var;
457  SCIP_Real solval;
458  SCIP_Real obj;
459  SCIP_Real newsolval;
460  SCIP_Bool roundup;
461  SCIP_Bool rounddown;
462  int nuplocks;
463  int ndownlocks;
464 
465  var = vars[v];
466 
467  assert( SCIPvarGetType(var) == SCIP_VARTYPE_IMPLINT );
468  solval = SCIPsolGetVal(sol, set, stat, var);
469 
470  /* we do not need to round integral solution values or those of variables which are not column variables */
471  if( SCIPsetIsFeasIntegral(set, solval) || SCIPvarGetStatus(var) != SCIP_VARSTATUS_COLUMN )
472  continue;
473 
474  nuplocks = SCIPvarGetNLocksUp(var);
475  ndownlocks = SCIPvarGetNLocksDown(var);
476  obj = SCIPvarGetObj(var);
477 
478  roundup = FALSE;
479  rounddown = FALSE;
480 
481  /* in case of a non-zero objective coefficient, there is only one possible rounding direction */
482  if( SCIPsetIsFeasNegative(set, obj) )
483  roundup = TRUE;
484  else if( SCIPsetIsFeasPositive(set, obj) )
485  rounddown = TRUE;
486  else if( uselprows )
487  {
488  /* determine rounding direction based on row violations */
489  SCIP_COL* col;
490  SCIP_ROW** rows;
491  SCIP_Real* vals;
492  int nrows;
493  int r;
494 
495  col = SCIPvarGetCol(var);
496  vals = SCIPcolGetVals(col);
497  rows = SCIPcolGetRows(col);
498  nrows = SCIPcolGetNNonz(col);
499 
500  /* loop over rows and search for equations whose violation can be decreased by rounding */
501  for( r = 0; r < nrows && !(roundup && rounddown); ++r )
502  {
503  SCIP_ROW* row;
504  SCIP_Real activity;
505  SCIP_Real rhs;
506  SCIP_Real lhs;
507 
508  row = rows[r];
509  assert(!SCIPsetIsFeasZero(set, vals[r]));
510 
511  if( SCIProwIsLocal(row) || !SCIProwIsInLP(row) )
512  continue;
513 
514  rhs = SCIProwGetRhs(row);
515  lhs = SCIProwGetLhs(row);
516 
517  if( SCIPsetIsInfinity(set, rhs) || SCIPsetIsInfinity(set, -lhs) )
518  continue;
519 
520  activity = SCIProwGetSolActivity(row, set, stat, sol);
521  if( SCIPsetIsFeasLE(set, activity, rhs) && SCIPsetIsFeasLE(set, lhs, activity) )
522  continue;
523 
524  if( (SCIPsetIsFeasGT(set, activity, rhs) && SCIPsetIsPositive(set, vals[r]))
525  || (SCIPsetIsFeasLT(set, activity, lhs) && SCIPsetIsNegative(set, vals[r])) )
526  rounddown = TRUE;
527  else
528  roundup = TRUE;
529  }
530  }
531 
532  /* in case of a tie, we select the rounding step based on the number of variable locks */
533  if( roundup == rounddown )
534  {
535  rounddown = ndownlocks <= nuplocks;
536  roundup = !rounddown;
537  }
538 
539  /* round the variable up or down */
540  if( roundup )
541  {
542  newsolval = SCIPsetCeil(set, solval);
543  assert(SCIPsetIsFeasLE(set, newsolval, SCIPvarGetUbGlobal(var)));
544  }
545  else
546  {
547  assert( rounddown ); /* should be true because of the code above */
548  newsolval = SCIPsetFloor(set, solval);
549  assert(SCIPsetIsFeasGE(set, newsolval, SCIPvarGetLbGlobal(var)));
550  }
551 
552  SCIP_CALL( SCIPsolSetVal(sol, set, stat, tree, var, newsolval) );
553  }
554 
555  return SCIP_OKAY;
556 }
557 /** creates primal CIP solution, initialized to the current LP solution */
559  SCIP_SOL** sol, /**< pointer to primal CIP solution */
560  BMS_BLKMEM* blkmem, /**< block memory */
561  SCIP_SET* set, /**< global SCIP settings */
562  SCIP_STAT* stat, /**< problem statistics data */
563  SCIP_PROB* prob, /**< transformed problem data */
564  SCIP_PRIMAL* primal, /**< primal data */
565  SCIP_TREE* tree, /**< branch and bound tree */
566  SCIP_LP* lp, /**< current LP data */
567  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
568  )
569 {
570  assert(sol != NULL);
571  assert(lp != NULL);
572  assert(SCIPlpIsSolved(lp));
573 
574  SCIP_CALL( SCIPsolCreate(sol, blkmem, set, stat, primal, tree, heur) );
575  SCIP_CALL( SCIPsolLinkLPSol(*sol, set, stat, prob, tree, lp) );
576 
577  return SCIP_OKAY;
578 }
579 
580 /** creates primal CIP solution, initialized to the current NLP solution */
582  SCIP_SOL** sol, /**< pointer to primal CIP solution */
583  BMS_BLKMEM* blkmem, /**< block memory */
584  SCIP_SET* set, /**< global SCIP settings */
585  SCIP_STAT* stat, /**< problem statistics data */
586  SCIP_PRIMAL* primal, /**< primal data */
587  SCIP_TREE* tree, /**< branch and bound tree */
588  SCIP_NLP* nlp, /**< current NLP data */
589  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
590  )
591 {
592  assert(sol != NULL);
593  assert(nlp != NULL);
594 
595  SCIP_CALL( SCIPsolCreate(sol, blkmem, set, stat, primal, tree, heur) );
596  SCIP_CALL( SCIPsolLinkNLPSol(*sol, stat, tree, nlp) );
597 
598  return SCIP_OKAY;
599 }
600 
601 /** creates primal CIP solution, initialized to the current relaxation solution */
603  SCIP_SOL** sol, /**< pointer to primal CIP solution */
604  BMS_BLKMEM* blkmem, /**< block memory */
605  SCIP_SET* set, /**< global SCIP settings */
606  SCIP_STAT* stat, /**< problem statistics data */
607  SCIP_PRIMAL* primal, /**< primal data */
608  SCIP_TREE* tree, /**< branch and bound tree */
609  SCIP_RELAXATION* relaxation, /**< global relaxation data */
610  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
611  )
612 {
613  assert(sol != NULL);
614  assert(relaxation != NULL);
615  assert(SCIPrelaxationIsSolValid(relaxation));
616 
617  SCIP_CALL( SCIPsolCreate(sol, blkmem, set, stat, primal, tree, heur) );
618  SCIP_CALL( SCIPsolLinkRelaxSol(*sol, set, stat, tree, relaxation) );
619 
620  return SCIP_OKAY;
621 }
622 
623 /** creates primal CIP solution, initialized to the current pseudo solution */
625  SCIP_SOL** sol, /**< pointer to primal CIP solution */
626  BMS_BLKMEM* blkmem, /**< block memory */
627  SCIP_SET* set, /**< global SCIP settings */
628  SCIP_STAT* stat, /**< problem statistics data */
629  SCIP_PROB* prob, /**< transformed problem data */
630  SCIP_PRIMAL* primal, /**< primal data */
631  SCIP_TREE* tree, /**< branch and bound tree, or NULL */
632  SCIP_LP* lp, /**< current LP data */
633  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
634  )
635 {
636  assert(sol != NULL);
637 
638  SCIP_CALL( SCIPsolCreate(sol, blkmem, set, stat, primal, tree, heur) );
639  SCIP_CALL( SCIPsolLinkPseudoSol(*sol, set, stat, prob, tree, lp) );
640 
641  return SCIP_OKAY;
642 }
643 
644 /** creates primal CIP solution, initialized to the current solution */
646  SCIP_SOL** sol, /**< pointer to primal CIP solution */
647  BMS_BLKMEM* blkmem, /**< block memory */
648  SCIP_SET* set, /**< global SCIP settings */
649  SCIP_STAT* stat, /**< problem statistics data */
650  SCIP_PROB* prob, /**< transformed problem data */
651  SCIP_PRIMAL* primal, /**< primal data */
652  SCIP_TREE* tree, /**< branch and bound tree */
653  SCIP_LP* lp, /**< current LP data */
654  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
655  )
656 {
657  assert(tree != NULL);
658 
659  if( SCIPtreeHasCurrentNodeLP(tree) )
660  {
661  SCIP_CALL( SCIPsolCreateLPSol(sol, blkmem, set, stat, prob, primal, tree, lp, heur) );
662  }
663  else
664  {
665  SCIP_CALL( SCIPsolCreatePseudoSol(sol, blkmem, set, stat, prob, primal, tree, lp, heur) );
666  }
667 
668  return SCIP_OKAY;
669 }
670 
671 /** creates primal CIP solution, initialized to unknown values */
673  SCIP_SOL** sol, /**< pointer to primal CIP solution */
674  BMS_BLKMEM* blkmem, /**< block memory */
675  SCIP_SET* set, /**< global SCIP settings */
676  SCIP_STAT* stat, /**< problem statistics data */
677  SCIP_PRIMAL* primal, /**< primal data */
678  SCIP_TREE* tree, /**< branch and bound tree */
679  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
680  )
681 {
682  assert(sol != NULL);
683  assert(blkmem != NULL);
684  assert(stat != NULL);
685 
686  SCIP_ALLOC( BMSallocBlockMemory(blkmem, sol) );
687  SCIP_CALL( SCIPrealarrayCreate(&(*sol)->vals, blkmem) );
688  SCIP_CALL( SCIPboolarrayCreate(&(*sol)->valid, blkmem) );
689  (*sol)->heur = heur;
690  (*sol)->solorigin = SCIP_SOLORIGIN_UNKNOWN;
691  (*sol)->obj = 0.0;
692  (*sol)->primalindex = -1;
693  (*sol)->index = stat->solindex;
694  (*sol)->hasinfval = FALSE;
695  stat->solindex++;
696  solStamp(*sol, stat, tree, TRUE);
697 
698  SCIP_CALL( SCIPprimalSolCreated(primal, set, *sol) );
699 
700  return SCIP_OKAY;
701 }
702 
703 /** frees primal CIP solution */
705  SCIP_SOL** sol, /**< pointer to primal CIP solution */
706  BMS_BLKMEM* blkmem, /**< block memory */
707  SCIP_PRIMAL* primal /**< primal data */
708  )
709 {
710  assert(sol != NULL);
711  assert(*sol != NULL);
712 
713  SCIPprimalSolFreed(primal, *sol);
714 
715  SCIP_CALL( SCIPrealarrayFree(&(*sol)->vals) );
716  SCIP_CALL( SCIPboolarrayFree(&(*sol)->valid) );
717  BMSfreeBlockMemory(blkmem, sol);
718 
719  return SCIP_OKAY;
720 }
721 
722 /** copies current LP solution into CIP solution by linking */
724  SCIP_SOL* sol, /**< primal CIP solution */
725  SCIP_SET* set, /**< global SCIP settings */
726  SCIP_STAT* stat, /**< problem statistics data */
727  SCIP_PROB* prob, /**< transformed problem data */
728  SCIP_TREE* tree, /**< branch and bound tree */
729  SCIP_LP* lp /**< current LP data */
730  )
731 {
732  assert(sol != NULL);
733  assert(stat != NULL);
734  assert(tree != NULL);
735  assert(lp != NULL);
736  assert(lp->solved);
737  assert(SCIPlpDiving(lp) || SCIPtreeProbing(tree) || !SCIPlpDivingObjChanged(lp));
738 
739  SCIPdebugMessage("linking solution to LP\n");
740 
741  /* clear the old solution arrays */
742  SCIP_CALL( solClearArrays(sol) );
743 
744  /* link solution to LP solution */
745  if( SCIPlpDivingObjChanged(lp) )
746  {
747  /* the objective value has to be calculated manually, because the LP's value is invalid;
748  * use objective values of variables, because columns objective values are changed to dive values
749  */
750  sol->obj = SCIPlpGetLooseObjval(lp, set, prob);
751  if( !SCIPsetIsInfinity(set, -sol->obj) )
752  {
753  SCIP_VAR* var;
754  SCIP_COL** cols;
755  int ncols;
756  int c;
757 
758  cols = SCIPlpGetCols(lp);
759  ncols = SCIPlpGetNCols(lp);
760  for( c = 0; c < ncols; ++c )
761  {
762  var = SCIPcolGetVar(cols[c]);
763  sol->obj += SCIPvarGetUnchangedObj(var) * cols[c]->primsol;
764  }
765  }
766  }
767  else
768  {
769  /* the objective value in the columns is correct, s.t. the LP's objective value is also correct */
770  sol->obj = SCIPlpGetObjval(lp, set, prob);
771  }
773  solStamp(sol, stat, tree, TRUE);
774 
775  SCIPdebugMessage(" -> objective value: %g\n", sol->obj);
776 
777  return SCIP_OKAY;
778 }
779 
780 /** copies current NLP solution into CIP solution by linking */
782  SCIP_SOL* sol, /**< primal CIP solution */
783  SCIP_STAT* stat, /**< problem statistics data */
784  SCIP_TREE* tree, /**< branch and bound tree */
785  SCIP_NLP* nlp /**< current NLP data */
786  )
787 {
788  assert(sol != NULL);
789  assert(stat != NULL);
790  assert(tree != NULL);
791  assert(nlp != NULL);
793 
794  SCIPdebugMessage("linking solution to NLP\n");
795 
796  /* clear the old solution arrays */
797  SCIP_CALL( solClearArrays(sol) );
798 
799  /* get objective value of NLP solution */
800  if( SCIPnlpIsDivingObjChanged(nlp) )
801  {
802  /* the objective value has to be calculated manually, because the NLP's value is invalid */
803 
804  SCIP_VAR** vars;
805  int nvars;
806  int v;
807 
808  sol->obj = 0.0;
809 
810  vars = SCIPnlpGetVars(nlp);
811  nvars = SCIPnlpGetNVars(nlp);
812  for( v = 0; v < nvars; ++v )
813  {
814  assert(SCIPvarIsActive(vars[v]));
815  sol->obj += SCIPvarGetObj(vars[v]) * SCIPvarGetNLPSol(vars[v]);
816  }
817  }
818  else
819  {
820  sol->obj = SCIPnlpGetObjval(nlp);
821  }
822 
824  solStamp(sol, stat, tree, TRUE);
825 
826  SCIPdebugMessage(" -> objective value: %g\n", sol->obj);
827 
828  return SCIP_OKAY;
829 }
830 
831 /** copies current relaxation solution into CIP solution by linking */
833  SCIP_SOL* sol, /**< primal CIP solution */
834  SCIP_SET* set, /**< global SCIP settings */
835  SCIP_STAT* stat, /**< problem statistics data */
836  SCIP_TREE* tree, /**< branch and bound tree */
837  SCIP_RELAXATION* relaxation /**< global relaxation data */
838  )
839 { /*lint --e{715}*/
840  assert(sol != NULL);
841  assert(stat != NULL);
842  assert(tree != NULL);
843  assert(relaxation != NULL);
844  assert(SCIPrelaxationIsSolValid(relaxation));
845 
846  SCIPdebugMessage("linking solution to relaxation\n");
847 
848  /* clear the old solution arrays */
849  SCIP_CALL( solClearArrays(sol) );
850 
851  /* the objective value in the columns is correct, s.t. the LP's objective value is also correct */
852  sol->obj = SCIPrelaxationGetSolObj(relaxation);
854  solStamp(sol, stat, tree, TRUE);
855 
856  SCIPdebugMessage(" -> objective value: %g\n", sol->obj);
857 
858  return SCIP_OKAY;
859 }
860 
861 /** copies current pseudo solution into CIP solution by linking */
863  SCIP_SOL* sol, /**< primal CIP solution */
864  SCIP_SET* set, /**< global SCIP settings */
865  SCIP_STAT* stat, /**< problem statistics data */
866  SCIP_PROB* prob, /**< transformed problem data */
867  SCIP_TREE* tree, /**< branch and bound tree, or NULL */
868  SCIP_LP* lp /**< current LP data */
869  )
870 {
871  assert(sol != NULL);
872  assert(stat != NULL);
873  assert(tree != NULL);
874 
875  SCIPdebugMessage("linking solution to pseudo solution\n");
876 
877  /* clear the old solution arrays */
878  SCIP_CALL( solClearArrays(sol) );
879 
880  /* link solution to pseudo solution */
881  sol->obj = SCIPlpGetPseudoObjval(lp, set, prob);
883  solStamp(sol, stat, tree, TRUE);
884 
885  SCIPdebugMessage(" -> objective value: %g\n", sol->obj);
886 
887  return SCIP_OKAY;
888 }
889 
890 /** copies current solution (LP or pseudo solution) into CIP solution by linking */
892  SCIP_SOL* sol, /**< primal CIP solution */
893  SCIP_SET* set, /**< global SCIP settings */
894  SCIP_STAT* stat, /**< problem statistics data */
895  SCIP_PROB* prob, /**< transformed problem data */
896  SCIP_TREE* tree, /**< branch and bound tree */
897  SCIP_LP* lp /**< current LP data */
898  )
899 {
900  assert(tree != NULL);
901 
902  SCIPdebugMessage("linking solution to current solution\n");
903 
904  if( SCIPtreeHasCurrentNodeLP(tree) && SCIPlpIsSolved(lp) )
905  {
906  SCIP_CALL( SCIPsolLinkLPSol(sol, set, stat, prob, tree, lp) );
907  }
908  else
909  {
910  SCIP_CALL( SCIPsolLinkPseudoSol(sol, set, stat, prob, tree, lp) );
911  }
912 
913  return SCIP_OKAY;
914 }
915 
916 /** clears primal CIP solution */
918  SCIP_SOL* sol, /**< primal CIP solution */
919  SCIP_STAT* stat, /**< problem statistics data */
920  SCIP_TREE* tree /**< branch and bound tree */
921  )
922 {
923  assert(sol != NULL);
924 
925  SCIP_CALL( solClearArrays(sol) );
927  sol->obj = 0.0;
928  solStamp(sol, stat, tree, TRUE);
929 
930  return SCIP_OKAY;
931 }
932 
933 /** declares all entries in the primal CIP solution to be unknown */
935  SCIP_SOL* sol, /**< primal CIP solution */
936  SCIP_STAT* stat, /**< problem statistics data */
937  SCIP_TREE* tree /**< branch and bound tree */
938  )
939 {
940  assert(sol != NULL);
941 
942  SCIP_CALL( solClearArrays(sol) );
944  sol->obj = 0.0;
945  solStamp(sol, stat, tree, TRUE);
946 
947  return SCIP_OKAY;
948 }
949 
950 /** stores solution values of variables in solution's own array */
952  SCIP_SOL* sol, /**< primal CIP solution */
953  SCIP_SET* set, /**< global SCIP settings */
954  SCIP_PROB* prob /**< transformed problem data */
955  )
956 {
957  int v;
958 
959  assert(sol != NULL);
960  assert(prob != NULL);
961  assert(prob->nvars == 0 || prob->vars != NULL);
962 
963  if( !SCIPsolIsOriginal(sol) && sol->solorigin != SCIP_SOLORIGIN_ZERO
964  && sol->solorigin != SCIP_SOLORIGIN_UNKNOWN )
965  {
966  SCIPdebugMessage("completing solution %p\n", (void*)sol);
967 
968  for( v = 0; v < prob->nvars; ++v )
969  {
970  SCIP_CALL( solUnlinkVar(sol, set, prob->vars[v]) );
971  }
972 
974  }
975 
976  return SCIP_OKAY;
977 }
978 
979 /** sets value of variable in primal CIP solution */
981  SCIP_SOL* sol, /**< primal CIP solution */
982  SCIP_SET* set, /**< global SCIP settings */
983  SCIP_STAT* stat, /**< problem statistics data */
984  SCIP_TREE* tree, /**< branch and bound tree, or NULL */
985  SCIP_VAR* var, /**< variable to add to solution */
986  SCIP_Real val /**< solution value of variable */
987  )
988 {
989  SCIP_Real oldval;
990 
991  assert(sol != NULL);
992  assert(sol->solorigin == SCIP_SOLORIGIN_ORIGINAL
993  || sol->solorigin == SCIP_SOLORIGIN_ZERO
995  || (sol->nodenum == stat->nnodes && sol->runnum == stat->nruns));
996  assert(stat != NULL);
997  assert(var != NULL);
998  assert(SCIPisFinite(val));
999 
1000  SCIPdebugMessage("setting value of <%s> in solution %p to %g\n", SCIPvarGetName(var), (void*)sol, val);
1001 
1002  /* we want to store only values for non fixed variables (LOOSE or COLUMN); others have to be transformed */
1003  switch( SCIPvarGetStatus(var) )
1004  {
1006  if( SCIPsolIsOriginal(sol) )
1007  {
1008  oldval = solGetArrayVal(sol, var);
1009  if( !SCIPsetIsEQ(set, val, oldval) )
1010  {
1011  SCIP_Real obj;
1012  SCIP_Real objcont;
1013 
1014  SCIP_CALL( solSetArrayVal(sol, set, var, val) );
1015 
1016  /* update objective: an unknown solution value does not count towards the objective */
1017  obj = SCIPvarGetObj(var);
1018  if( oldval != SCIP_UNKNOWN ) /*lint !e777*/
1019  {
1020  objcont = obj * oldval;
1021 
1022  /* we want to use a clean infinity */
1023  if( SCIPsetIsInfinity(set, -objcont) || SCIPsetIsInfinity(set, sol->obj-objcont) )
1024  sol->obj = SCIPsetInfinity(set);
1025  else if( SCIPsetIsInfinity(set, objcont) || SCIPsetIsInfinity(set, -(sol->obj-objcont)) )
1026  sol->obj = -SCIPsetInfinity(set);
1027  else
1028  sol->obj -= objcont;
1029  }
1030  if( val != SCIP_UNKNOWN ) /*lint !e777*/
1031  {
1032  objcont = obj * val;
1033 
1034  /* we want to use a clean infinity */
1035  if( SCIPsetIsInfinity(set, objcont) || SCIPsetIsInfinity(set, sol->obj+objcont) )
1036  sol->obj = SCIPsetInfinity(set);
1037  else if( SCIPsetIsInfinity(set, objcont) || SCIPsetIsInfinity(set, -(sol->obj+objcont)) )
1038  sol->obj = -SCIPsetInfinity(set);
1039  else
1040  sol->obj += objcont;
1041  }
1042 
1043  solStamp(sol, stat, tree, FALSE);
1044 
1045  }
1046  return SCIP_OKAY;
1047  }
1048  else
1049  return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetTransVar(var), val);
1050 
1051  case SCIP_VARSTATUS_LOOSE:
1052  case SCIP_VARSTATUS_COLUMN:
1053  assert(!SCIPsolIsOriginal(sol));
1055  || sol->lpcount == stat->lpcount);
1056  oldval = solGetArrayVal(sol, var);
1057  if( !SCIPsetIsEQ(set, val, oldval) )
1058  {
1059  SCIP_Real obj;
1060  SCIP_Real objcont;
1061 
1062  SCIP_CALL( solSetArrayVal(sol, set, var, val) );
1063 
1064  /* update objective: an unknown solution value does not count towards the objective */
1065  obj = SCIPvarGetUnchangedObj(var);
1066 
1067  if( oldval != SCIP_UNKNOWN ) /*lint !e777*/
1068  {
1069  objcont = obj * oldval;
1070 
1071  /* we want to use a clean infinity */
1072  if( SCIPsetIsInfinity(set, -objcont) || SCIPsetIsInfinity(set, sol->obj-objcont) )
1073  sol->obj = SCIPsetInfinity(set);
1074  else if( SCIPsetIsInfinity(set, objcont) || SCIPsetIsInfinity(set, -(sol->obj-objcont)) )
1075  sol->obj = -SCIPsetInfinity(set);
1076  else
1077  sol->obj -= objcont;
1078  }
1079  if( val != SCIP_UNKNOWN ) /*lint !e777*/
1080  {
1081  objcont = obj * val;
1082 
1083  /* we want to use a clean infinity */
1084  if( SCIPsetIsInfinity(set, objcont) || SCIPsetIsInfinity(set, sol->obj+objcont) )
1085  sol->obj = SCIPsetInfinity(set);
1086  else if( SCIPsetIsInfinity(set, -objcont) || SCIPsetIsInfinity(set, -(sol->obj+objcont)) )
1087  sol->obj = -SCIPsetInfinity(set);
1088  else
1089  sol->obj += objcont;
1090  }
1091 
1092  solStamp(sol, stat, tree, FALSE);
1093  }
1094  return SCIP_OKAY;
1095 
1096  case SCIP_VARSTATUS_FIXED:
1097  assert(!SCIPsolIsOriginal(sol));
1098  oldval = SCIPvarGetLbGlobal(var);
1099  if( !SCIPsetIsEQ(set, val, oldval) )
1100  {
1101  SCIPerrorMessage("cannot set solution value for variable <%s> fixed to %.15g to different value %.15g\n",
1102  SCIPvarGetName(var), oldval, val);
1103  return SCIP_INVALIDDATA;
1104  }
1105  return SCIP_OKAY;
1106 
1107  case SCIP_VARSTATUS_AGGREGATED: /* x = a*y + c => y = (x-c)/a */
1108  assert(!SCIPsetIsZero(set, SCIPvarGetAggrScalar(var)));
1111 
1112  if( val == SCIP_UNKNOWN )/*lint !e777*/
1113  return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetAggrVar(var), val);
1114  if( SCIPsetIsInfinity(set, val) || SCIPsetIsInfinity(set, -val) )
1115  return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetAggrVar(var), SCIPvarGetAggrScalar(var) > 0 ? val : -val);
1116  else
1117  return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetAggrVar(var), (val - SCIPvarGetAggrConstant(var))/SCIPvarGetAggrScalar(var));
1118 
1120  if ( SCIPvarGetMultaggrNVars(var) == 1 )
1121  {
1122  SCIP_VAR** multaggrvars;
1123  SCIP_Real* multaggrscalars;
1124  SCIP_Real multaggrconstant;
1125 
1126  multaggrvars = SCIPvarGetMultaggrVars(var);
1127  multaggrscalars = SCIPvarGetMultaggrScalars(var);
1128  multaggrconstant = SCIPvarGetMultaggrConstant(var);
1129 
1130  if( SCIPsetIsInfinity(set, multaggrconstant) || SCIPsetIsInfinity(set, -multaggrconstant) )
1131  {
1132  if( (SCIPsetIsInfinity(set, multaggrconstant) && !SCIPsetIsInfinity(set, val))
1133  || (SCIPsetIsInfinity(set, -multaggrconstant) && !SCIPsetIsInfinity(set, -val)) )
1134  {
1135  SCIPerrorMessage("cannot set solution value for variable <%s> fixed to %.15g to different value %.15g\n",
1136  SCIPvarGetName(var), multaggrconstant, val);
1137  return SCIP_INVALIDDATA;
1138  }
1139  return SCIP_OKAY;
1140  }
1141  else
1142  {
1143  if( SCIPsetIsInfinity(set, val) || SCIPsetIsInfinity(set, -val) )
1144  return SCIPsolSetVal(sol, set, stat, tree, multaggrvars[0], multaggrscalars[0] > 0 ? val : -val);
1145  else
1146  return SCIPsolSetVal(sol, set, stat, tree, multaggrvars[0], (val - multaggrconstant)/multaggrscalars[0]);
1147  }
1148  }
1149  SCIPerrorMessage("cannot set solution value for multiple aggregated variable\n");
1150  return SCIP_INVALIDDATA;
1151 
1154 
1155  if( val == SCIP_UNKNOWN )/*lint !e777*/
1156  return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetNegationVar(var), val);
1157  else if( SCIPsetIsInfinity(set, val) || SCIPsetIsInfinity(set, -val) )
1158  return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetNegationVar(var), -val);
1159  else
1160  return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetNegationVar(var), SCIPvarGetNegationConstant(var) - val);
1161 
1162  default:
1163  SCIPerrorMessage("unknown variable status\n");
1164  return SCIP_INVALIDDATA;
1165  }
1166 }
1167 
1168 /** increases value of variable in primal CIP solution */
1170  SCIP_SOL* sol, /**< primal CIP solution */
1171  SCIP_SET* set, /**< global SCIP settings */
1172  SCIP_STAT* stat, /**< problem statistics data */
1173  SCIP_TREE* tree, /**< branch and bound tree */
1174  SCIP_VAR* var, /**< variable to increase solution value for */
1175  SCIP_Real incval /**< increment for solution value of variable */
1176  )
1177 {
1178  SCIP_Real oldval;
1179 
1180  assert(sol != NULL);
1181  assert(sol->solorigin == SCIP_SOLORIGIN_ORIGINAL
1182  || sol->solorigin == SCIP_SOLORIGIN_ZERO
1183  || (sol->nodenum == stat->nnodes && sol->runnum == stat->nruns));
1184  assert(stat != NULL);
1185  assert(var != NULL);
1186  assert(!SCIPsetIsInfinity(set, incval) && !SCIPsetIsInfinity(set, -incval));
1187 
1188  SCIPdebugMessage("increasing value of <%s> in solution %p by %g\n", SCIPvarGetName(var), (void*)sol, incval);
1189 
1190  if( SCIPsetIsZero(set, incval) )
1191  return SCIP_OKAY;
1192 
1194  || sol->lpcount == stat->lpcount);
1195 
1196  oldval = solGetArrayVal(sol, var);
1197  if( SCIPsetIsInfinity(set, oldval) || SCIPsetIsInfinity(set, -oldval) )
1198  return SCIP_OKAY;
1199 
1200  /* we want to store only values for non fixed variables (LOOSE or COLUMN); others have to be transformed */
1201  /* @todo: handle strange cases, such as sums that yield infinite values */
1202  switch( SCIPvarGetStatus(var) )
1203  {
1205  if( SCIPsolIsOriginal(sol) )
1206  {
1207  SCIP_CALL( solIncArrayVal(sol, set, var, incval) );
1208  sol->obj += SCIPvarGetObj(var) * incval;
1209  solStamp(sol, stat, tree, FALSE);
1210  return SCIP_OKAY;
1211  }
1212  else
1213  return SCIPsolIncVal(sol, set, stat, tree, SCIPvarGetTransVar(var), incval);
1214 
1215  case SCIP_VARSTATUS_LOOSE:
1216  case SCIP_VARSTATUS_COLUMN:
1217  assert(!SCIPsolIsOriginal(sol));
1218  SCIP_CALL( solIncArrayVal(sol, set, var, incval) );
1219  sol->obj += SCIPvarGetUnchangedObj(var) * incval;
1220  solStamp(sol, stat, tree, FALSE);
1221  return SCIP_OKAY;
1222 
1223  case SCIP_VARSTATUS_FIXED:
1224  SCIPerrorMessage("cannot increase solution value for fixed variable\n");
1225  return SCIP_INVALIDDATA;
1226 
1227  case SCIP_VARSTATUS_AGGREGATED: /* x = a*y + c => y = (x-c)/a */
1228  assert(!SCIPsetIsZero(set, SCIPvarGetAggrScalar(var)));
1229  return SCIPsolIncVal(sol, set, stat, tree, SCIPvarGetAggrVar(var), incval/SCIPvarGetAggrScalar(var));
1230 
1232  SCIPerrorMessage("cannot increase solution value for multiple aggregated variable\n");
1233  return SCIP_INVALIDDATA;
1234 
1236  return SCIPsolIncVal(sol, set, stat, tree, SCIPvarGetNegationVar(var), -incval);
1237 
1238  default:
1239  SCIPerrorMessage("unknown variable status\n");
1240  return SCIP_INVALIDDATA;
1241  }
1242 }
1243 
1244 /** returns value of variable in primal CIP solution */
1246  SCIP_SOL* sol, /**< primal CIP solution */
1247  SCIP_SET* set, /**< global SCIP settings */
1248  SCIP_STAT* stat, /**< problem statistics data */
1249  SCIP_VAR* var /**< variable to get value for */
1250  )
1251 {
1252  SCIP_VAR** vars;
1253  SCIP_Real* scalars;
1254  SCIP_Real solval;
1255  SCIP_Real solvalsum;
1256  int nvars;
1257  int i;
1258 
1259  assert(sol != NULL);
1260  assert(sol->solorigin == SCIP_SOLORIGIN_ORIGINAL
1261  || sol->solorigin == SCIP_SOLORIGIN_ZERO
1263  || (sol->nodenum == stat->nnodes && sol->runnum == stat->nruns));
1264  assert(var != NULL);
1265 
1266  /* if the value of a transformed variable in an original solution is requested, we need to project the variable back
1267  * to the original space, the opposite case is handled below
1268  */
1269  if( SCIPsolIsOriginal(sol) && SCIPvarIsTransformed(var) )
1270  {
1271  SCIP_RETCODE retcode;
1272  SCIP_VAR* origvar;
1273  SCIP_Real scalar;
1274  SCIP_Real constant;
1275 
1276  /* we cannot get the value of a transformed variable for a solution that lives in the original problem space
1277  * -> get the corresponding original variable first
1278  */
1279  origvar = var;
1280  scalar = 1.0;
1281  constant = 0.0;
1282  retcode = SCIPvarGetOrigvarSum(&origvar, &scalar, &constant);
1283  if ( retcode != SCIP_OKAY )
1284  return SCIP_INVALID;
1285  if( origvar == NULL )
1286  {
1287  /* the variable has no original counterpart: in the original solution, it has a value of zero */
1288  return 0.0;
1289  }
1290  assert(!SCIPvarIsTransformed(origvar));
1291  return scalar * SCIPsolGetVal(sol, set, stat, origvar) + constant;
1292  }
1293 
1294  /* only values for non fixed variables (LOOSE or COLUMN) are stored; others have to be transformed */
1295  switch( SCIPvarGetStatus(var) )
1296  {
1298  if( SCIPsolIsOriginal(sol) )
1299  return solGetArrayVal(sol, var);
1300  else
1301  return SCIPsolGetVal(sol, set, stat, SCIPvarGetTransVar(var));
1302 
1303  case SCIP_VARSTATUS_LOOSE:
1304  case SCIP_VARSTATUS_COLUMN:
1305  assert(!SCIPsolIsOriginal(sol));
1307  || sol->lpcount == stat->lpcount);
1308  return solGetArrayVal(sol, var);
1309 
1310  case SCIP_VARSTATUS_FIXED:
1311  assert(!SCIPsolIsOriginal(sol));
1312  assert(SCIPvarGetLbGlobal(var) == SCIPvarGetUbGlobal(var)); /*lint !e777*/
1313  assert(SCIPvarGetLbLocal(var) == SCIPvarGetUbLocal(var)); /*lint !e777*/
1314  assert(SCIPvarGetLbGlobal(var) == SCIPvarGetLbLocal(var)); /*lint !e777*/
1315  return SCIPvarGetLbGlobal(var);
1316 
1317  case SCIP_VARSTATUS_AGGREGATED: /* x = a*y + c => y = (x-c)/a */
1318  solval = SCIPsolGetVal(sol, set, stat, SCIPvarGetAggrVar(var));
1319  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
1320  return SCIP_UNKNOWN;
1321  if( SCIPsetIsInfinity(set, solval) || SCIPsetIsInfinity(set, -solval) )
1322  {
1323  if( SCIPvarGetAggrScalar(var) * solval > 0.0 )
1324  return SCIPsetInfinity(set);
1325  if( SCIPvarGetAggrScalar(var) * solval < 0.0 )
1326  return -SCIPsetInfinity(set);
1327  }
1328  return SCIPvarGetAggrScalar(var) * solval + SCIPvarGetAggrConstant(var);
1329 
1331  nvars = SCIPvarGetMultaggrNVars(var);
1332  vars = SCIPvarGetMultaggrVars(var);
1333  scalars = SCIPvarGetMultaggrScalars(var);
1334  solvalsum = SCIPvarGetMultaggrConstant(var);
1335  for( i = 0; i < nvars; ++i )
1336  {
1337  solval = SCIPsolGetVal(sol, set, stat, vars[i]);
1338  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
1339  return SCIP_UNKNOWN;
1340  if( SCIPsetIsInfinity(set, solval) || SCIPsetIsInfinity(set, -solval) )
1341  {
1342  if( scalars[i] * solval > 0.0 )
1343  return SCIPsetInfinity(set);
1344  if( scalars[i] * solval < 0.0 )
1345  return -SCIPsetInfinity(set);
1346  }
1347  solvalsum += scalars[i] * solval;
1348  }
1349  return solvalsum;
1350 
1352  solval = SCIPsolGetVal(sol, set, stat, SCIPvarGetNegationVar(var));
1353  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
1354  return SCIP_UNKNOWN;
1355  if( SCIPsetIsInfinity(set, solval) )
1356  return -SCIPsetInfinity(set);
1357  if( SCIPsetIsInfinity(set, -solval) )
1358  return SCIPsetInfinity(set);
1359  return SCIPvarGetNegationConstant(var) - solval;
1360 
1361  default:
1362  SCIPerrorMessage("unknown variable status\n");
1363  SCIPABORT();
1364  return 0.0; /*lint !e527*/
1365  }
1366 }
1367 
1368 /** returns value of variable in primal ray represented by primal CIP solution */
1370  SCIP_SOL* sol, /**< primal CIP solution, representing a primal ray */
1371  SCIP_SET* set, /**< global SCIP settings */
1372  SCIP_STAT* stat, /**< problem statistics data */
1373  SCIP_VAR* var /**< variable to get value for */
1374  )
1375 {
1376  SCIP_VAR** vars;
1377  SCIP_Real* scalars;
1378  SCIP_Real solval;
1379  SCIP_Real solvalsum;
1380  int nvars;
1381  int i;
1382 
1383  assert(sol != NULL);
1384  assert(sol->solorigin == SCIP_SOLORIGIN_ZERO);
1385  assert(var != NULL);
1386 
1387  /* only values for non fixed variables (LOOSE or COLUMN) are stored; others have to be transformed */
1388  switch( SCIPvarGetStatus(var) )
1389  {
1391  return SCIPsolGetRayVal(sol, set, stat, SCIPvarGetTransVar(var));
1392 
1393  case SCIP_VARSTATUS_LOOSE:
1394  case SCIP_VARSTATUS_COLUMN:
1395  return solGetArrayVal(sol, var);
1396 
1397  case SCIP_VARSTATUS_FIXED:
1398  assert(!SCIPsolIsOriginal(sol));
1399  assert(SCIPvarGetLbGlobal(var) == SCIPvarGetUbGlobal(var)); /*lint !e777*/
1400  assert(SCIPvarGetLbLocal(var) == SCIPvarGetUbLocal(var)); /*lint !e777*/
1401  assert(SCIPvarGetLbGlobal(var) == SCIPvarGetLbLocal(var)); /*lint !e777*/
1402  return 0.0; /* constants are ignored for computing the ray direction */
1403 
1404  case SCIP_VARSTATUS_AGGREGATED: /* x = a*y + c => y = (x-c)/a */
1405  solval = SCIPsolGetRayVal(sol, set, stat, SCIPvarGetAggrVar(var));
1406  assert(solval != SCIP_UNKNOWN); /*lint !e777*/
1407  assert(!SCIPsetIsInfinity(set, REALABS(solval)));
1408  return SCIPvarGetAggrScalar(var) * solval; /* constants are ignored for computing the ray direction */
1409 
1411  nvars = SCIPvarGetMultaggrNVars(var);
1412  vars = SCIPvarGetMultaggrVars(var);
1413  scalars = SCIPvarGetMultaggrScalars(var);
1414  solvalsum = 0.0; /* constants are ignored for computing the ray direction */
1415  for( i = 0; i < nvars; ++i )
1416  {
1417  solval = SCIPsolGetRayVal(sol, set, stat, vars[i]);
1418  assert(solval != SCIP_UNKNOWN ); /*lint !e777*/
1419  assert(!SCIPsetIsInfinity(set, REALABS(solval)));
1420  solvalsum += scalars[i] * solval;
1421  }
1422  return solvalsum;
1423 
1425  solval = SCIPsolGetRayVal(sol, set, stat, SCIPvarGetNegationVar(var));
1426  assert(solval != SCIP_UNKNOWN); /*lint !e777*/
1427  assert(!SCIPsetIsInfinity(set, REALABS(solval)));
1428  return -solval; /* constants are ignored for computing the ray direction */
1429 
1430  default:
1431  SCIPerrorMessage("unknown variable status\n");
1432  SCIPABORT();
1433  return 0.0; /*lint !e527*/
1434  }
1435 }
1436 
1437 /** gets objective value of primal CIP solution in transformed problem */
1439  SCIP_SOL* sol, /**< primal CIP solution */
1440  SCIP_SET* set, /**< global SCIP settings */
1441  SCIP_PROB* transprob, /**< tranformed problem data */
1442  SCIP_PROB* origprob /**< original problem data */
1443  )
1444 {
1445  assert(sol != NULL);
1446 
1447  /* for original solutions, sol->obj contains the external objective value */
1448  if( SCIPsolIsOriginal(sol) )
1449  return SCIPprobInternObjval(transprob, origprob, set, sol->obj);
1450  else
1451  return sol->obj;
1452 }
1453 
1454 /** updates primal solutions after a change in a variable's objective value */
1456  SCIP_SOL* sol, /**< primal CIP solution */
1457  SCIP_VAR* var, /**< problem variable */
1458  SCIP_Real oldobj, /**< old objective value */
1459  SCIP_Real newobj /**< new objective value */
1460  )
1461 {
1462  SCIP_Real solval;
1463 
1464  assert(sol != NULL);
1465  assert(!SCIPsolIsOriginal(sol));
1467 
1468  solval = solGetArrayVal(sol, var);
1469  if( solval != SCIP_UNKNOWN ) /*lint !e777*/
1470  sol->obj += (newobj - oldobj) * solval;
1471 }
1472 
1473 /** checks primal CIP solution for feasibility */
1475  SCIP_SOL* sol, /**< primal CIP solution */
1476  SCIP_SET* set, /**< global SCIP settings */
1477  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1478  BMS_BLKMEM* blkmem, /**< block memory */
1479  SCIP_STAT* stat, /**< problem statistics */
1480  SCIP_PROB* prob, /**< transformed problem data */
1481  SCIP_Bool printreason, /**< Should all reasons of violations be printed? */
1482  SCIP_Bool checkbounds, /**< Should the bounds of the variables be checked? */
1483  SCIP_Bool checkintegrality, /**< Has integrality to be checked? */
1484  SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
1485  SCIP_Bool* feasible /**< stores whether solution is feasible */
1486  )
1487 {
1488  SCIP_RESULT result;
1489  int h;
1490 
1491  assert(sol != NULL);
1492  assert(!SCIPsolIsOriginal(sol));
1493  assert(set != NULL);
1494  assert(prob != NULL);
1495  assert(feasible != NULL);
1496 
1497  SCIPdebugMessage("checking solution with objective value %g (nodenum=%" SCIP_LONGINT_FORMAT ", origin=%u)\n",
1498  sol->obj, sol->nodenum, sol->solorigin);
1499 
1500  *feasible = TRUE;
1501 
1502  /* check whether the solution respects the global bounds of the variables */
1503  if( checkbounds )
1504  {
1505  int v;
1506 
1507  for( v = 0; v < prob->nvars && (*feasible || printreason); ++v )
1508  {
1509  SCIP_VAR* var;
1510  SCIP_Real solval;
1511 
1512  var = prob->vars[v];
1513  solval = SCIPsolGetVal(sol, set, stat, var);
1514 
1515  if( solval != SCIP_UNKNOWN ) /*lint !e777*/
1516  {
1517  SCIP_Real lb;
1518  SCIP_Real ub;
1519 
1520  lb = SCIPvarGetLbGlobal(var);
1521  ub = SCIPvarGetUbGlobal(var);
1522 
1523  /* check finite lower bound */
1524  if( !SCIPsetIsInfinity(set, -lb) )
1525  *feasible = *feasible && SCIPsetIsFeasGE(set, solval, lb);
1526 
1527  /* check finite upper bound */
1528  if( !SCIPsetIsInfinity(set, ub) )
1529  *feasible = *feasible && SCIPsetIsFeasLE(set, solval, ub);
1530 
1531  if( printreason && (SCIPsetIsFeasLT(set, solval, lb) || SCIPsetIsFeasGT(set, solval, ub)) )
1532  {
1533  SCIPmessagePrintInfo(messagehdlr, "solution value %g violates bounds of <%s>[%g,%g] by %g\n", solval, SCIPvarGetName(var),
1534  SCIPvarGetLbGlobal(var), SCIPvarGetUbGlobal(var), MAX(lb - solval, 0.0) + MAX(solval - ub, 0.0));
1535  }
1536  }
1537 
1538 #ifdef SCIP_DEBUG
1539  if( !(*feasible) && !printreason )
1540  {
1541  SCIPdebugPrintf(" -> solution value %g violates bounds of <%s>[%g,%g]\n", solval, SCIPvarGetName(var),
1543  }
1544 #endif
1545  }
1546  }
1547 
1548  /* check whether there are infinite variable values that lead to an objective value of +infinity */
1549  if( *feasible && sol->hasinfval )
1550  {
1551  int v;
1552 
1553  for( v = 0; v < prob->nvars && (*feasible || printreason); ++v )
1554  {
1555  SCIP_VAR* var;
1556  SCIP_Real solval;
1557 
1558  var = prob->vars[v];
1559  solval = SCIPsolGetVal(sol, set, stat, var);
1560  assert(solval != SCIP_INVALID); /*lint !e777*/
1561 
1562  if( solval != SCIP_UNKNOWN ) /*lint !e777*/
1563  {
1564  *feasible = *feasible && (!SCIPsetIsInfinity(set, solval) || SCIPsetIsLE(set, SCIPvarGetObj(var), 0.0) );
1565  *feasible = *feasible && (!SCIPsetIsInfinity(set, -solval) || SCIPsetIsGE(set, SCIPvarGetObj(var), 0.0) );
1566 
1567  if( printreason && ((SCIPsetIsInfinity(set, solval) && SCIPsetIsGT(set, SCIPvarGetObj(var), 0.0)) ||
1568  (SCIPsetIsInfinity(set, -solval) && SCIPsetIsLT(set, SCIPvarGetObj(var), 0.0))) )
1569  {
1570  SCIPmessagePrintInfo(messagehdlr, "infinite solution value %g for variable <%s> with obj %g implies objective value +infinity\n",
1571  solval, SCIPvarGetName(var), SCIPvarGetObj(var));
1572  }
1573  }
1574 
1575 #ifdef SCIP_DEBUG
1576  if( !(*feasible) && !printreason )
1577  {
1578  SCIPdebugPrintf("infinite solution value %g for variable <%s> with obj %g implies objective value +infinity\n",
1579  solval, SCIPvarGetName(var), SCIPvarGetObj(var));
1580  }
1581 #endif
1582  }
1583  }
1584 
1585  /* check whether the solution fulfills all constraints */
1586  for( h = 0; h < set->nconshdlrs && (*feasible || printreason); ++h )
1587  {
1588  SCIP_CALL( SCIPconshdlrCheck(set->conshdlrs[h], blkmem, set, stat, sol,
1589  checkintegrality, checklprows, printreason, &result) );
1590  *feasible = *feasible && (result == SCIP_FEASIBLE);
1591 
1592 #ifdef SCIP_DEBUG
1593  if( !(*feasible) )
1594  {
1595  SCIPdebugPrintf(" -> infeasibility detected in constraint handler <%s>\n",
1596  SCIPconshdlrGetName(set->conshdlrs[h]));
1597  }
1598 #endif
1599  }
1600 
1601  return SCIP_OKAY;
1602 }
1603 
1604 /** try to round given solution */
1606  SCIP_SOL* sol, /**< primal solution */
1607  SCIP_SET* set, /**< global SCIP settings */
1608  SCIP_STAT* stat, /**< problem statistics data */
1609  SCIP_PROB* prob, /**< transformed problem data */
1610  SCIP_TREE* tree, /**< branch and bound tree */
1611  SCIP_Bool* success /**< pointer to store whether rounding was successful */
1612  )
1613 {
1614  int nvars;
1615  int v;
1616 
1617  assert(sol != NULL);
1618  assert(!SCIPsolIsOriginal(sol));
1619  assert(prob != NULL);
1620  assert(prob->transformed);
1621  assert(success != NULL);
1622 
1623  /* round all roundable fractional variables in the corresponding direction as long as no unroundable var was found */
1624  nvars = prob->nbinvars + prob->nintvars;
1625  for( v = 0; v < nvars; ++v )
1626  {
1627  SCIP_VAR* var;
1628  SCIP_Real solval;
1629  SCIP_Bool mayrounddown;
1630  SCIP_Bool mayroundup;
1631 
1632  var = prob->vars[v];
1635  || sol->lpcount == stat->lpcount);
1636  solval = solGetArrayVal(sol, var);
1637 
1638  /* solutions with unknown entries cannot be rounded */
1639  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
1640  break;
1641 
1642  /* if solution value is already integral with feastol, continue */
1643  if( SCIPsetIsFeasIntegral(set, solval) )
1644  continue;
1645 
1646  /* get rounding possibilities */
1647  mayrounddown = SCIPvarMayRoundDown(var);
1648  mayroundup = SCIPvarMayRoundUp(var);
1649 
1650  /* choose rounding direction */
1651  if( mayrounddown && mayroundup )
1652  {
1653  /* we can round in both directions: round in objective function direction */
1654  if( SCIPvarGetUnchangedObj(var) >= 0.0 )
1655  solval = SCIPsetFeasFloor(set, solval);
1656  else
1657  solval = SCIPsetFeasCeil(set, solval);
1658  }
1659  else if( mayrounddown )
1660  solval = SCIPsetFeasFloor(set, solval);
1661  else if( mayroundup )
1662  solval = SCIPsetFeasCeil(set, solval);
1663  else
1664  break;
1665 
1666  /* store new solution value */
1667  SCIP_CALL( SCIPsolSetVal(sol, set, stat, tree, var, solval) );
1668  }
1669 
1670  /* check, if rounding was successful */
1671  *success = (v == nvars);
1672 
1673  return SCIP_OKAY;
1674 }
1675 
1676 /** updates the solution value sums in variables by adding the value in the given solution */
1678  SCIP_SOL* sol, /**< primal CIP solution */
1679  SCIP_SET* set, /**< global SCIP settings */
1680  SCIP_STAT* stat, /**< problem statistics data */
1681  SCIP_PROB* prob, /**< transformed problem data */
1682  SCIP_Real weight /**< weight of solution in weighted average */
1683  )
1684 {
1685  SCIP_Real solval;
1686  int v;
1687 
1688  assert(sol != NULL);
1689  assert(!SCIPsolIsOriginal(sol));
1690  assert(0.0 <= weight && weight <= 1.0);
1691 
1692  for( v = 0; v < prob->nvars; ++v )
1693  {
1694  assert(prob->vars[v] != NULL);
1695  solval = SCIPsolGetVal(sol, set, stat, prob->vars[v]);
1696  if( solval != SCIP_UNKNOWN ) /*lint !e777*/
1697  {
1698  prob->vars[v]->primsolavg *= (1.0-weight);
1699  prob->vars[v]->primsolavg += weight*solval;
1700  }
1701  }
1702 }
1703 
1704 /** retransforms solution to original problem space */
1706  SCIP_SOL* sol, /**< primal CIP solution */
1707  SCIP_SET* set, /**< global SCIP settings */
1708  SCIP_STAT* stat, /**< problem statistics data */
1709  SCIP_PROB* origprob, /**< original problem */
1710  SCIP_PROB* transprob, /**< transformed problem */
1711  SCIP_Bool* hasinfval /**< pointer to store whether the solution has infinite values */
1712  )
1713 {
1714  SCIP_VAR** transvars;
1715  SCIP_VAR** vars;
1716  SCIP_VAR** activevars;
1717  SCIP_Real* solvals;
1718  SCIP_Real* activevals;
1719  SCIP_Real* transsolvals;
1720  SCIP_Real constant;
1721  int requiredsize;
1722  int ntransvars;
1723  int nactivevars;
1724  int nvars;
1725  int v;
1726  int i;
1727 
1728  assert(sol != NULL);
1729  assert(sol->solorigin == SCIP_SOLORIGIN_ZERO);
1730  assert(origprob != NULL);
1731  assert(transprob != NULL);
1732  assert(hasinfval != NULL);
1733  assert(!origprob->transformed);
1734  assert(transprob->transformed);
1735 
1736  *hasinfval = FALSE;
1737 
1738  /* This method was a performance bottleneck when retransforming a solution during presolving, before flattening the
1739  * aggregation graph. In that case, calling SCIPsolGetVal() on the original variable consumed too much
1740  * time. Therefore, we now first compute the active representation of each original variable using
1741  * SCIPvarGetActiveRepresentatives(), which is much faster, and sum up the solution values of the active variables by
1742  * hand for each original variable.
1743  */
1744  vars = origprob->vars;
1745  nvars = origprob->nvars;
1746  transvars = transprob->vars;
1747  ntransvars = transprob->nvars;
1748 
1749  /* allocate temporary memory for getting the active representation of the original variables, buffering the solution
1750  * values of all active variables and storing the original solution values
1751  */
1752  SCIP_CALL( SCIPsetAllocBufferArray(set, &transsolvals, ntransvars + 1) );
1753  SCIP_CALL( SCIPsetAllocBufferArray(set, &activevars, ntransvars + 1) );
1754  SCIP_CALL( SCIPsetAllocBufferArray(set, &activevals, ntransvars + 1) );
1755  SCIP_CALL( SCIPsetAllocBufferArray(set, &solvals, nvars) );
1756  assert(transsolvals != NULL); /* for flexelint */
1757  assert(solvals != NULL); /* for flexelint */
1758 
1759  /* get the solution values of all active variables */
1760  for( v = 0; v < ntransvars; ++v )
1761  {
1762  transsolvals[v] = SCIPsolGetVal(sol, set, stat, transvars[v]);
1763  }
1764 
1765  /* get the solution in original problem variables */
1766  for( v = 0; v < nvars; ++v )
1767  {
1768  activevars[0] = vars[v];
1769  activevals[0] = 1.0;
1770  nactivevars = 1;
1771  constant = 0.0;
1772 
1773  /* get active representation of the original variable */
1774  SCIP_CALL( SCIPvarGetActiveRepresentatives(set, activevars, activevals, &nactivevars, ntransvars + 1, &constant,
1775  &requiredsize, TRUE) );
1776  assert(requiredsize <= ntransvars);
1777 
1778  /* compute solution value of the original variable */
1779  solvals[v] = constant;
1780  for( i = 0; i < nactivevars; ++i )
1781  {
1782  assert(0 <= SCIPvarGetProbindex(activevars[i]) && SCIPvarGetProbindex(activevars[i]) < ntransvars);
1783  assert(!SCIPsetIsInfinity(set, -solvals[v]) || !SCIPsetIsInfinity(set, activevals[i] * transsolvals[SCIPvarGetProbindex(activevars[i])]));
1784  assert(!SCIPsetIsInfinity(set, solvals[v]) || !SCIPsetIsInfinity(set, -activevals[i] * transsolvals[SCIPvarGetProbindex(activevars[i])]));
1785  solvals[v] += activevals[i] * transsolvals[SCIPvarGetProbindex(activevars[i])];
1786  }
1787 
1788  if( SCIPsetIsInfinity(set, solvals[v]) )
1789  {
1790  solvals[v] = SCIPsetInfinity(set);
1791  *hasinfval = TRUE;
1792  }
1793  else if( SCIPsetIsInfinity(set, -solvals[v]) )
1794  {
1795  solvals[v] = -SCIPsetInfinity(set);
1796  *hasinfval = TRUE;
1797  }
1798  }
1799 
1800  /* clear the solution and convert it into original space */
1801  SCIP_CALL( solClearArrays(sol) );
1803  sol->obj = 0.0;
1804 
1805  /* reinsert the values of the original variables */
1806  for( v = 0; v < nvars; ++v )
1807  {
1808  if( !SCIPsetIsZero(set, solvals[v]) )
1809  {
1810  SCIP_CALL( solSetArrayVal(sol, set, vars[v], solvals[v]) );
1811  if( solvals[v] != SCIP_UNKNOWN ) /*lint !e777*/
1812  sol->obj += SCIPvarGetObj(vars[v]) * solvals[v];
1813  }
1814  }
1815 
1816  /**@todo remember the variables without original counterpart (priced variables) in the solution */
1817 
1818  /* free temporary memory */
1819  SCIPsetFreeBufferArray(set, &solvals);
1820  SCIPsetFreeBufferArray(set, &activevals);
1821  SCIPsetFreeBufferArray(set, &activevars);
1822  SCIPsetFreeBufferArray(set, &transsolvals);
1823 
1824  return SCIP_OKAY;
1825 }
1826 
1827 /** recomputes the objective value of an original solution, e.g., when transferring solutions
1828  * from the solution pool (objective coefficients might have changed in the meantime)
1829  */
1831  SCIP_SOL* sol, /**< primal CIP solution */
1832  SCIP_SET* set, /**< global SCIP settings */
1833  SCIP_STAT* stat, /**< problem statistics data */
1834  SCIP_PROB* origprob /**< original problem */
1835  )
1836 {
1837  SCIP_VAR** vars;
1838  SCIP_Real solval;
1839  int nvars;
1840  int v;
1841 
1842  assert(sol != NULL);
1843  assert(SCIPsolIsOriginal(sol));
1844  assert(origprob != NULL);
1845 
1846  vars = origprob->vars;
1847  nvars = origprob->nvars;
1848 
1849  /* recompute the objective value */
1850  sol->obj = SCIPprobGetObjoffset(origprob);
1851  for( v = 0; v < nvars; ++v )
1852  {
1853  solval = SCIPsolGetVal(sol, set, stat, vars[v]);
1854  if( !SCIPsetIsZero(set, solval) && solval != SCIP_UNKNOWN ) /*lint !e777*/
1855  {
1856  sol->obj += SCIPvarGetUnchangedObj(vars[v]) * solval;
1857  }
1858  }
1859 
1860  if( SCIPsetIsInfinity(set, -sol->obj) )
1861  sol->obj = -SCIPsetInfinity(set);
1862 }
1863 
1864 /** returns whether the given solutions are equal */
1866  SCIP_SOL* sol1, /**< first primal CIP solution */
1867  SCIP_SOL* sol2, /**< second primal CIP solution */
1868  SCIP_SET* set, /**< global SCIP settings */
1869  SCIP_STAT* stat, /**< problem statistics data */
1870  SCIP_PROB* origprob, /**< original problem */
1871  SCIP_PROB* transprob /**< transformed problem after presolve, or NULL if both solution are
1872  * defined in the original problem space */
1873  )
1874 {
1875  SCIP_PROB* prob;
1876  SCIP_Real obj1;
1877  SCIP_Real obj2;
1878  int v;
1879 
1880  assert(sol1 != NULL);
1881  assert(sol2 != NULL);
1882  assert((SCIPsolIsOriginal(sol1) && SCIPsolIsOriginal(sol2)) || transprob != NULL);
1883 
1884  /* if both solutions are original or both are transformed, take the objective values stored in the solutions */
1885  if( SCIPsolIsOriginal(sol1) == SCIPsolIsOriginal(sol2) )
1886  {
1887  obj1 = sol1->obj;
1888  obj2 = sol2->obj;
1889  }
1890  /* one solution is original and the other not, so we have to get for both the objective in the transformed problem */
1891  else
1892  {
1893  obj1 = SCIPsolGetObj(sol1, set, transprob, origprob);
1894  obj2 = SCIPsolGetObj(sol2, set, transprob, origprob);
1895  }
1896 
1897  /* solutions with different objective values cannot be the same */
1898  if( !SCIPsetIsEQ(set, obj1, obj2) )
1899  return FALSE;
1900 
1901  /* if one of the solutions is defined in the original space, the comparison has to be performed in the original
1902  * space
1903  */
1904  prob = transprob;
1905  if( SCIPsolIsOriginal(sol1) || SCIPsolIsOriginal(sol2) )
1906  prob = origprob;
1907  assert(prob != NULL);
1908 
1909  /* compare each variable value */
1910  for( v = 0; v < prob->nvars; ++v )
1911  {
1912  SCIP_Real val1;
1913  SCIP_Real val2;
1914 
1915  val1 = SCIPsolGetVal(sol1, set, stat, prob->vars[v]);
1916  val2 = SCIPsolGetVal(sol2, set, stat, prob->vars[v]);
1917  if( !SCIPsetIsEQ(set, val1, val2) )
1918  return FALSE;
1919  }
1920 
1921  return TRUE;
1922 }
1923 
1924 /** outputs non-zero elements of solution to file stream */
1926  SCIP_SOL* sol, /**< primal CIP solution */
1927  SCIP_SET* set, /**< global SCIP settings */
1928  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1929  SCIP_STAT* stat, /**< problem statistics data */
1930  SCIP_PROB* prob, /**< problem data (original or transformed) */
1931  SCIP_PROB* transprob, /**< transformed problem data or NULL (to display priced variables) */
1932  FILE* file, /**< output file (or NULL for standard output) */
1933  SCIP_Bool printzeros /**< should variables set to zero be printed? */
1934  )
1935 {
1936  SCIP_Real solval;
1937  int v;
1938 
1939  assert(sol != NULL);
1940  assert(prob != NULL);
1941  assert(SCIPsolIsOriginal(sol) || prob->transformed || transprob != NULL);
1942 
1943  /* display variables of problem data */
1944  for( v = 0; v < prob->nfixedvars; ++v )
1945  {
1946  assert(prob->fixedvars[v] != NULL);
1947  solval = SCIPsolGetVal(sol, set, stat, prob->fixedvars[v]);
1948  if( printzeros || !SCIPsetIsZero(set, solval) )
1949  {
1950  SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(prob->fixedvars[v]));
1951  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
1952  SCIPmessageFPrintInfo(messagehdlr, file, " unknown");
1953  else if( SCIPsetIsInfinity(set, solval) )
1954  SCIPmessageFPrintInfo(messagehdlr, file, " +infinity");
1955  else if( SCIPsetIsInfinity(set, -solval) )
1956  SCIPmessageFPrintInfo(messagehdlr, file, " -infinity");
1957  else
1958  SCIPmessageFPrintInfo(messagehdlr, file, " % 20.15g", solval);
1959  SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetUnchangedObj(prob->fixedvars[v]));
1960  }
1961  }
1962 
1963  for( v = 0; v < prob->nvars; ++v )
1964  {
1965  assert(prob->vars[v] != NULL);
1966  solval = SCIPsolGetVal(sol, set, stat, prob->vars[v]);
1967  if( printzeros || !SCIPsetIsZero(set, solval) )
1968  {
1969  SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(prob->vars[v]));
1970  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
1971  SCIPmessageFPrintInfo(messagehdlr, file, " unknown");
1972  else if( SCIPsetIsInfinity(set, solval) )
1973  SCIPmessageFPrintInfo(messagehdlr, file, " +infinity");
1974  else if( SCIPsetIsInfinity(set, -solval) )
1975  SCIPmessageFPrintInfo(messagehdlr, file, " -infinity");
1976  else
1977  SCIPmessageFPrintInfo(messagehdlr, file, " %20.15g", solval);
1978  SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetUnchangedObj(prob->vars[v]));
1979  }
1980  }
1981 
1982  /* display additional priced variables (if given problem data is original problem) */
1983  if( !prob->transformed && !SCIPsolIsOriginal(sol) )
1984  {
1985  assert(transprob != NULL);
1986  for( v = 0; v < transprob->nfixedvars; ++v )
1987  {
1988  assert(transprob->fixedvars[v] != NULL);
1989  if( SCIPvarIsTransformedOrigvar(transprob->fixedvars[v]) )
1990  continue;
1991 
1992  solval = SCIPsolGetVal(sol, set, stat, transprob->fixedvars[v]);
1993  if( printzeros || !SCIPsetIsZero(set, solval) )
1994  {
1995  SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(transprob->fixedvars[v]));
1996  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
1997  SCIPmessageFPrintInfo(messagehdlr, file, " unknown");
1998  else if( SCIPsetIsInfinity(set, solval) )
1999  SCIPmessageFPrintInfo(messagehdlr, file, " +infinity");
2000  else if( SCIPsetIsInfinity(set, -solval) )
2001  SCIPmessageFPrintInfo(messagehdlr, file, " -infinity");
2002  else
2003  SCIPmessageFPrintInfo(messagehdlr, file, " % 20.15g", solval);
2004  SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetUnchangedObj(transprob->fixedvars[v]));
2005  }
2006  }
2007  for( v = 0; v < transprob->nvars; ++v )
2008  {
2009  assert(transprob->vars[v] != NULL);
2010  if( SCIPvarIsTransformedOrigvar(transprob->vars[v]) )
2011  continue;
2012 
2013  solval = SCIPsolGetVal(sol, set, stat, transprob->vars[v]);
2014  if( printzeros || !SCIPsetIsZero(set, solval) )
2015  {
2016  SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(transprob->vars[v]));
2017  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
2018  SCIPmessageFPrintInfo(messagehdlr, file, " unknown");
2019  else if( SCIPsetIsInfinity(set, solval) )
2020  SCIPmessageFPrintInfo(messagehdlr, file, " +infinity");
2021  else if( SCIPsetIsInfinity(set, -solval) )
2022  SCIPmessageFPrintInfo(messagehdlr, file, " -infinity");
2023  else
2024  SCIPmessageFPrintInfo(messagehdlr, file, " % 20.15g", solval);
2025  SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetUnchangedObj(transprob->vars[v]));
2026  }
2027  }
2028  }
2029 
2030  return SCIP_OKAY;
2031 }
2032 
2033 /** outputs non-zero elements of solution representing a ray to file stream */
2035  SCIP_SOL* sol, /**< primal CIP solution */
2036  SCIP_SET* set, /**< global SCIP settings */
2037  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
2038  SCIP_STAT* stat, /**< problem statistics data */
2039  SCIP_PROB* prob, /**< problem data (original or transformed) */
2040  SCIP_PROB* transprob, /**< transformed problem data or NULL (to display priced variables) */
2041  FILE* file, /**< output file (or NULL for standard output) */
2042  SCIP_Bool printzeros /**< should variables set to zero be printed? */
2043  )
2044 {
2045  SCIP_Real solval;
2046  int v;
2047 
2048  assert(sol != NULL);
2049  assert(prob != NULL);
2050  assert(SCIPsolIsOriginal(sol) || prob->transformed || transprob != NULL);
2051 
2052  /* display variables of problem data */
2053  for( v = 0; v < prob->nfixedvars; ++v )
2054  {
2055  assert(prob->fixedvars[v] != NULL);
2056  solval = SCIPsolGetRayVal(sol, set, stat, prob->fixedvars[v]);
2057  if( printzeros || !SCIPsetIsZero(set, solval) )
2058  {
2059  SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(prob->fixedvars[v]));
2060  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
2061  SCIPmessageFPrintInfo(messagehdlr, file, " unknown");
2062  else if( SCIPsetIsInfinity(set, solval) )
2063  SCIPmessageFPrintInfo(messagehdlr, file, " +infinity");
2064  else if( SCIPsetIsInfinity(set, -solval) )
2065  SCIPmessageFPrintInfo(messagehdlr, file, " -infinity");
2066  else
2067  SCIPmessageFPrintInfo(messagehdlr, file, " % 20.15g", solval);
2068  SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetUnchangedObj(prob->fixedvars[v]));
2069  }
2070  }
2071  for( v = 0; v < prob->nvars; ++v )
2072  {
2073  assert(prob->vars[v] != NULL);
2074  solval = SCIPsolGetRayVal(sol, set, stat, prob->vars[v]);
2075  if( printzeros || !SCIPsetIsZero(set, solval) )
2076  {
2077  SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(prob->vars[v]));
2078  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
2079  SCIPmessageFPrintInfo(messagehdlr, file, " unknown");
2080  else if( SCIPsetIsInfinity(set, solval) )
2081  SCIPmessageFPrintInfo(messagehdlr, file, " +infinity");
2082  else if( SCIPsetIsInfinity(set, -solval) )
2083  SCIPmessageFPrintInfo(messagehdlr, file, " -infinity");
2084  else
2085  SCIPmessageFPrintInfo(messagehdlr, file, " %20.15g", solval);
2086  SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetUnchangedObj(prob->vars[v]));
2087  }
2088  }
2089 
2090  /* display additional priced variables (if given problem data is original problem) */
2091  if( !prob->transformed && !SCIPsolIsOriginal(sol) )
2092  {
2093  assert(transprob != NULL);
2094  for( v = 0; v < transprob->nfixedvars; ++v )
2095  {
2096  assert(transprob->fixedvars[v] != NULL);
2097  if( SCIPvarIsTransformedOrigvar(transprob->fixedvars[v]) )
2098  continue;
2099 
2100  solval = SCIPsolGetRayVal(sol, set, stat, transprob->fixedvars[v]);
2101  if( printzeros || !SCIPsetIsZero(set, solval) )
2102  {
2103  SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(transprob->fixedvars[v]));
2104  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
2105  SCIPmessageFPrintInfo(messagehdlr, file, " unknown");
2106  else if( SCIPsetIsInfinity(set, solval) )
2107  SCIPmessageFPrintInfo(messagehdlr, file, " +infinity");
2108  else if( SCIPsetIsInfinity(set, -solval) )
2109  SCIPmessageFPrintInfo(messagehdlr, file, " -infinity");
2110  else
2111  SCIPmessageFPrintInfo(messagehdlr, file, " % 20.15g", solval);
2112  SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetUnchangedObj(transprob->fixedvars[v]));
2113  }
2114  }
2115  for( v = 0; v < transprob->nvars; ++v )
2116  {
2117  assert(transprob->vars[v] != NULL);
2118  if( SCIPvarIsTransformedOrigvar(transprob->vars[v]) )
2119  continue;
2120 
2121  solval = SCIPsolGetRayVal(sol, set, stat, transprob->vars[v]);
2122  if( printzeros || !SCIPsetIsZero(set, solval) )
2123  {
2124  SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(transprob->vars[v]));
2125  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
2126  SCIPmessageFPrintInfo(messagehdlr, file, " unknown");
2127  else if( SCIPsetIsInfinity(set, solval) )
2128  SCIPmessageFPrintInfo(messagehdlr, file, " +infinity");
2129  else if( SCIPsetIsInfinity(set, -solval) )
2130  SCIPmessageFPrintInfo(messagehdlr, file, " -infinity");
2131  else
2132  SCIPmessageFPrintInfo(messagehdlr, file, " % 20.15g", solval);
2133  SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetUnchangedObj(transprob->vars[v]));
2134  }
2135  }
2136  }
2137 
2138  return SCIP_OKAY;
2139 }
2140 
2141 
2142 
2143 
2144 /*
2145  * simple functions implemented as defines
2146  */
2147 
2148 /* In debug mode, the following methods are implemented as function calls to ensure
2149  * type validity.
2150  * In optimized mode, the methods are implemented as defines to improve performance.
2151  * However, we want to have them in the library anyways, so we have to undef the defines.
2152  */
2153 
2154 #undef SCIPsolGetOrigin
2155 #undef SCIPsolIsOriginal
2156 #undef SCIPsolGetOrigObj
2157 #undef SCIPsolGetTime
2158 #undef SCIPsolGetNodenum
2159 #undef SCIPsolGetRunnum
2160 #undef SCIPsolGetDepth
2161 #undef SCIPsolGetHeur
2162 #undef SCIPsolOrigAddObjval
2163 #undef SCIPsolGetPrimalIndex
2164 #undef SCIPsolSetPrimalIndex
2165 #undef SCIPsolGetIndex
2166 #undef SCIPsolSetHeur
2167 
2168 /** gets origin of solution */
2170  SCIP_SOL* sol /**< primal CIP solution */
2171  )
2172 {
2173  assert(sol != NULL);
2174 
2175  return sol->solorigin;
2176 }
2177 
2178 /** returns whether the given solution is defined on original variables */
2180  SCIP_SOL* sol /**< primal CIP solution */
2181  )
2182 {
2183  assert(sol != NULL);
2184 
2185  return (sol->solorigin == SCIP_SOLORIGIN_ORIGINAL);
2186 }
2187 
2188 /** gets objective value of primal CIP solution which lives in the original problem space */
2190  SCIP_SOL* sol /**< primal CIP solution */
2191  )
2192 {
2193  assert(sol != NULL);
2194  assert(SCIPsolIsOriginal(sol));
2195 
2196  return sol->obj;
2197 }
2198 
2199 /** adds value to the objective value of a given original primal CIP solution */
2201  SCIP_SOL* sol, /**< primal CIP solution */
2202  SCIP_Real addval /**< offset value to add */
2203  )
2204 {
2205  assert(sol != NULL);
2206  assert(sol->solorigin == SCIP_SOLORIGIN_ORIGINAL);
2207 
2208  sol->obj += addval;
2209 }
2210 
2211 /** gets clock time, when this solution was found */
2213  SCIP_SOL* sol /**< primal CIP solution */
2214  )
2215 {
2216  assert(sol != NULL);
2217 
2218  return sol->time;
2219 }
2220 
2221 /** gets branch and bound run number, where this solution was found */
2223  SCIP_SOL* sol /**< primal CIP solution */
2224  )
2225 {
2226  assert(sol != NULL);
2227 
2228  return sol->runnum;
2229 }
2230 
2231 /** gets node number, where this solution was found */
2233  SCIP_SOL* sol /**< primal CIP solution */
2234  )
2235 {
2236  assert(sol != NULL);
2237 
2238  return sol->nodenum;
2239 }
2240 
2241 /** gets node's depth, where this solution was found */
2243  SCIP_SOL* sol /**< primal CIP solution */
2244  )
2245 {
2246  assert(sol != NULL);
2247 
2248  return sol->depth;
2249 }
2250 
2251 /** gets heuristic, that found this solution (or NULL if it's from the tree) */
2253  SCIP_SOL* sol /**< primal CIP solution */
2254  )
2255 {
2256  assert(sol != NULL);
2257 
2258  return sol->heur;
2259 }
2260 
2261 /** gets current position of solution in array of existing solutions of primal data */
2263  SCIP_SOL* sol /**< primal CIP solution */
2264  )
2265 {
2266  assert(sol != NULL);
2267 
2268  return sol->primalindex;
2269 }
2270 
2271 /** sets current position of solution in array of existing solutions of primal data */
2273  SCIP_SOL* sol, /**< primal CIP solution */
2274  int primalindex /**< new primal index of solution */
2275  )
2276 {
2277  assert(sol != NULL);
2278 
2279  sol->primalindex = primalindex;
2280 }
2281 
2282 /** returns unique index of given solution */
2284  SCIP_SOL* sol /**< primal CIP solution */
2285  )
2286 {
2287  assert(sol != NULL);
2288 
2289  return sol->index;
2290 }
2291 
2292 /** informs the solution that it now belongs to the given primal heuristic */
2294  SCIP_SOL* sol, /**< primal CIP solution */
2295  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
2296  )
2297 {
2298  assert(sol != NULL);
2299 
2300  sol->heur = heur;
2301 }
2302 
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:51
SCIP_VAR * SCIPvarGetTransVar(SCIP_VAR *var)
Definition: var.c:16760
SCIP_Real SCIPvarGetMultaggrConstant(SCIP_VAR *var)
Definition: var.c:16861
SCIP_VAR * SCIPvarGetNegationVar(SCIP_VAR *var)
Definition: var.c:16883
SCIP_RETCODE SCIPsolCreateRelaxSol(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_RELAXATION *relaxation, SCIP_HEUR *heur)
Definition: sol.c:602
SCIP_RETCODE SCIPsolUnlink(SCIP_SOL *sol, SCIP_SET *set, SCIP_PROB *prob)
Definition: sol.c:951
SCIP_Bool SCIPsetIsInfinity(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5180
SCIP_RETCODE SCIPsolRound(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_Bool *success)
Definition: sol.c:1605
#define BMSallocBlockMemory(mem, ptr)
Definition: memory.h:406
SCIP_RETCODE SCIPsolLinkPseudoSol(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_LP *lp)
Definition: sol.c:862
SCIP_Bool SCIPsetIsLE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5238
const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:16443
SCIP_Bool SCIPsetIsFeasZero(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5688
internal methods for storing primal CIP solutions
int solindex
Definition: struct_stat.h:217
int SCIPprobGetNBinVars(SCIP_PROB *prob)
Definition: prob.c:2192
SCIP_Bool SCIPlpDiving(SCIP_LP *lp)
Definition: lp.c:19403
void SCIPprimalSolFreed(SCIP_PRIMAL *primal, SCIP_SOL *sol)
Definition: primal.c:1450
SCIP_Real SCIPrelaxationGetSolObj(SCIP_RELAXATION *relaxation)
Definition: relax.c:652
internal methods for branch and bound tree
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
Definition: var.c:12033
SCIP_Real SCIPsetFloor(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5367
SCIP_Bool SCIPvarMayRoundDown(SCIP_VAR *var)
Definition: var.c:3259
int depth
Definition: struct_sol.h:65
SCIP_RETCODE SCIPsolLinkNLPSol(SCIP_SOL *sol, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_NLP *nlp)
Definition: sol.c:781
#define SCIPsetAllocBufferArray(set, ptr, num)
Definition: set.h:1788
internal methods for clocks and timing issues
SCIP_Bool SCIPsetIsPositive(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5303
SCIP_Longint nodenum
Definition: struct_sol.h:54
#define NULL
Definition: lpi_spx.cpp:130
SCIP_RETCODE SCIPrealarrayCreate(SCIP_REALARRAY **realarray, BMS_BLKMEM *blkmem)
Definition: misc.c:2359
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
Definition: var.c:17113
SCIP_Bool SCIPboolarrayGetVal(SCIP_BOOLARRAY *boolarray, int idx)
Definition: misc.c:3342
SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
Definition: lp.c:18915
SCIP_Real SCIPvarGetPseudoSol(SCIP_VAR *var)
Definition: var.c:17509
int nintvars
Definition: struct_prob.h:62
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
Definition: var.c:17067
SCIP_RETCODE SCIPsolLinkLPSol(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_LP *lp)
Definition: sol.c:723
SCIP_RETCODE SCIPsolCreateUnknown(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_HEUR *heur)
Definition: sol.c:672
SCIP_Real SCIPsetInfinity(SCIP_SET *set)
Definition: set.c:5042
SCIP_RETCODE SCIPsolLinkCurrentSol(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_LP *lp)
Definition: sol.c:891
SCIP_HEUR * heur
Definition: struct_sol.h:63
#define FALSE
Definition: def.h:56
SCIP_Bool SCIPsetIsFeasIntegral(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5721
SCIP_Real objoffset
Definition: struct_prob.h:40
SCIP_Bool solved
Definition: struct_lp.h:338
SCIP_RETCODE SCIPsolCopy(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_SOL *sourcesol)
Definition: sol.c:339
SCIP_Bool SCIPsetIsZero(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5292
#define TRUE
Definition: def.h:55
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
#define SCIP_CALL(x)
Definition: def.h:266
void SCIPsolSetPrimalIndex(SCIP_SOL *sol, int primalindex)
Definition: sol.c:2272
SCIP_Real SCIPprobInternObjval(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_Real objval)
Definition: prob.c:1975
int SCIPtreeGetCurrentDepth(SCIP_TREE *tree)
Definition: tree.c:7957
SCIP_Real SCIPsolGetRayVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var)
Definition: sol.c:1369
SCIP_RETCODE SCIPsolSetUnknown(SCIP_SOL *sol, SCIP_STAT *stat, SCIP_TREE *tree)
Definition: sol.c:934
SCIP_RETCODE SCIPboolarrayCopy(SCIP_BOOLARRAY **boolarray, BMS_BLKMEM *blkmem, SCIP_BOOLARRAY *sourceboolarray)
Definition: misc.c:3116
SCIP_Bool SCIPsolsAreEqual(SCIP_SOL *sol1, SCIP_SOL *sol2, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob)
Definition: sol.c:1865
SCIP_VAR ** fixedvars
Definition: struct_prob.h:55
SCIP_Bool SCIPsolIsOriginal(SCIP_SOL *sol)
Definition: sol.c:2179
#define SCIPdebugMessage
Definition: pub_message.h:77
SCIP_Real SCIPlpGetPseudoObjval(SCIP_LP *lp, SCIP_SET *set, SCIP_PROB *prob)
Definition: lp.c:15256
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
Definition: var.c:16905
SCIP_Bool SCIPrelaxationIsSolValid(SCIP_RELAXATION *relaxation)
Definition: relax.c:631
SCIP_Bool SCIPsetIsNegative(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5314
SCIP_RETCODE SCIPsolClear(SCIP_SOL *sol, SCIP_STAT *stat, SCIP_TREE *tree)
Definition: sol.c:917
SCIP_Real SCIPsetCeil(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5378
int runnum
Definition: struct_sol.h:64
SCIP_Real SCIPvarGetRelaxSolTransVar(SCIP_VAR *var)
Definition: var.c:13249
internal methods for LP management
SCIP_Longint SCIPsolGetNodenum(SCIP_SOL *sol)
Definition: sol.c:2232
int SCIPsolGetRunnum(SCIP_SOL *sol)
Definition: sol.c:2222
SCIP_Real SCIPvarGetAggrConstant(SCIP_VAR *var)
Definition: var.c:16814
internal methods for collecting primal CIP solutions and primal informations
SCIP_Real SCIPsolGetVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var)
Definition: sol.c:1245
int SCIPsolGetIndex(SCIP_SOL *sol)
Definition: sol.c:2283
SCIP_RETCODE SCIPboolarraySetVal(SCIP_BOOLARRAY *boolarray, int arraygrowinit, SCIP_Real arraygrowfac, int idx, SCIP_Bool val)
Definition: misc.c:3363
int SCIPlpGetNCols(SCIP_LP *lp)
Definition: lp.c:19178
SCIP_Bool SCIPsetIsGE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5274
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
Definition: var.c:16562
SCIP_RETCODE SCIPrealarrayIncVal(SCIP_REALARRAY *realarray, int arraygrowinit, SCIP_Real arraygrowfac, int idx, SCIP_Real incval)
Definition: misc.c:2693
SCIP_VAR * SCIPvarGetAggrVar(SCIP_VAR *var)
Definition: var.c:16792
SCIP_Bool SCIPsetIsLT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5220
SCIP_Real SCIPclockGetLastTime(SCIP_CLOCK *clck)
Definition: clock.c:508
SCIP_Bool SCIPtreeProbing(SCIP_TREE *tree)
Definition: tree.c:7839
SCIP_Bool SCIPnlpIsDivingObjChanged(SCIP_NLP *nlp)
Definition: nlp.c:6300
SCIP_Bool SCIPvarIsTransformed(SCIP_VAR *var)
Definition: var.c:16585
static void solStamp(SCIP_SOL *sol, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_Bool checktime)
Definition: sol.c:246
SCIP_Real SCIPsolGetObj(SCIP_SOL *sol, SCIP_SET *set, SCIP_PROB *transprob, SCIP_PROB *origprob)
Definition: sol.c:1438
int SCIPprobGetNImplVars(SCIP_PROB *prob)
Definition: prob.c:2210
SCIP_ROW ** SCIPcolGetRows(SCIP_COL *col)
Definition: lp.c:18784
void SCIPsolUpdateVarsum(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_Real weight)
Definition: sol.c:1677
SCIP_RETCODE SCIPrealarrayCopy(SCIP_REALARRAY **realarray, BMS_BLKMEM *blkmem, SCIP_REALARRAY *sourcerealarray)
Definition: misc.c:2379
internal methods for storing and manipulating the main problem
#define SCIPerrorMessage
Definition: pub_message.h:45
SCIP_Real SCIProwGetRhs(SCIP_ROW *row)
Definition: lp.c:18925
#define SCIPdebugPrintf
Definition: pub_message.h:80
SCIP_Longint lpcount
Definition: struct_stat.h:141
SCIP_RETCODE SCIPsolCreateCurrentSol(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LP *lp, SCIP_HEUR *heur)
Definition: sol.c:645
SCIP_Real SCIPvarGetAggrScalar(SCIP_VAR *var)
Definition: var.c:16803
SCIP_RETCODE SCIPboolarrayCreate(SCIP_BOOLARRAY **boolarray, BMS_BLKMEM *blkmem)
Definition: misc.c:3096
SCIP_COL ** SCIPlpGetCols(SCIP_LP *lp)
Definition: lp.c:19168
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:3897
SCIP_Real SCIPrealarrayGetVal(SCIP_REALARRAY *realarray, int idx)
Definition: misc.c:2603
SCIP_Real primsolavg
Definition: struct_var.h:210
SCIP_Real SCIPnlpGetObjval(SCIP_NLP *nlp)
Definition: nlp.c:5538
SCIP_RETCODE SCIPsolSetVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_VAR *var, SCIP_Real val)
Definition: sol.c:980
SCIP_Bool SCIProwIsInLP(SCIP_ROW *row)
Definition: lp.c:19126
SCIP_Bool SCIProwIsLocal(SCIP_ROW *row)
Definition: lp.c:19024
SCIP_Real SCIPclockGetTime(SCIP_CLOCK *clck)
Definition: clock.c:428
internal methods for NLP management
SCIP_Real SCIPsolGetTime(SCIP_SOL *sol)
Definition: sol.c:2212
SCIP_Real SCIPsetFeasCeil(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5758
static SCIP_RETCODE solIncArrayVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_VAR *var, SCIP_Real incval)
Definition: sol.c:94
internal miscellaneous methods
SCIP_RETCODE SCIPboolarrayClear(SCIP_BOOLARRAY *boolarray)
Definition: misc.c:3311
SCIP_RETCODE SCIPsolPrint(SCIP_SOL *sol, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PROB *transprob, FILE *file, SCIP_Bool printzeros)
Definition: sol.c:1925
SCIP_COL * SCIPvarGetCol(SCIP_VAR *var)
Definition: var.c:16771
SCIP_VAR ** SCIPvarGetMultaggrVars(SCIP_VAR *var)
Definition: var.c:16837
int SCIPvarGetNLocksUp(SCIP_VAR *var)
Definition: var.c:3204
static SCIP_RETCODE solUnlinkVar(SCIP_SOL *sol, SCIP_SET *set, SCIP_VAR *var)
Definition: sol.c:185
SCIP_RETCODE SCIPsolCreateOriginal(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_HEUR *heur)
Definition: sol.c:306
internal methods for global SCIP settings
SCIP_Longint lpcount
Definition: struct_sol.h:56
SCIP_Bool SCIPsetIsFeasGE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5666
void SCIPmessagePrintInfo(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
Definition: message.c:578
int primalindex
Definition: struct_sol.h:66
internal methods for relaxators
SCIP_Bool SCIPsetIsEQ(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5202
SCIP_Real SCIPlpGetObjval(SCIP_LP *lp, SCIP_SET *set, SCIP_PROB *prob)
Definition: lp.c:15076
SCIP_Real SCIPsolGetOrigObj(SCIP_SOL *sol)
Definition: sol.c:2189
SCIP_Bool SCIPsetIsFeasLE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5622
datastructures for storing primal CIP solutions
int SCIPprobGetNIntVars(SCIP_PROB *prob)
Definition: prob.c:2201
SCIP_RETCODE SCIPsolTransform(SCIP_SOL *sol, SCIP_SOL **transsol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_PRIMAL *primal)
Definition: sol.c:377
void SCIPsolRecomputeObj(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob)
Definition: sol.c:1830
SCIP_Real SCIProwGetSolActivity(SCIP_ROW *row, SCIP_SET *set, SCIP_STAT *stat, SCIP_SOL *sol)
Definition: lp.c:6230
internal methods for problem variables
void SCIPvarMarkNotDeletable(SCIP_VAR *var)
Definition: var.c:16687
#define SCIP_UNKNOWN
Definition: def.h:148
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
Definition: var.c:17123
int SCIPsolGetDepth(SCIP_SOL *sol)
Definition: sol.c:2242
SCIP_RETCODE SCIPprimalSolCreated(SCIP_PRIMAL *primal, SCIP_SET *set, SCIP_SOL *sol)
Definition: primal.c:1428
SCIP_Real SCIPvarGetNLPSol(SCIP_VAR *var)
Definition: var.c:17444
int SCIPvarGetIndex(SCIP_VAR *var)
Definition: var.c:16740
SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
Definition: sol.c:2252
#define SCIP_Bool
Definition: def.h:53
int nbinvars
Definition: struct_prob.h:61
SCIP_Real SCIPprobGetObjoffset(SCIP_PROB *prob)
Definition: prob.c:2237
SCIP_NLPSOLSTAT SCIPnlpGetSolstat(SCIP_NLP *nlp)
Definition: nlp.c:5928
SCIP_RETCODE SCIPsolIncVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_VAR *var, SCIP_Real incval)
Definition: sol.c:1169
SCIP_RETCODE SCIPsolCreate(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_HEUR *heur)
Definition: sol.c:274
SCIP_Real SCIPvarGetUnchangedObj(SCIP_VAR *var)
Definition: var.c:16915
SCIP_RETCODE SCIPrealarrayFree(SCIP_REALARRAY **realarray)
Definition: misc.c:2403
SCIP_Bool SCIPlpDivingObjChanged(SCIP_LP *lp)
Definition: lp.c:19413
#define MAX(x, y)
Definition: tclique_def.h:75
SCIP_RETCODE SCIPsolRetransform(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_Bool *hasinfval)
Definition: sol.c:1705
void SCIPsolOrigAddObjval(SCIP_SOL *sol, SCIP_Real addval)
Definition: sol.c:2200
#define BMSfreeBlockMemory(mem, ptr)
Definition: memory.h:419
SCIP_Real SCIPvarGetNegationConstant(SCIP_VAR *var)
Definition: var.c:16894
static SCIP_RETCODE solSetArrayVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_VAR *var, SCIP_Real val)
Definition: sol.c:63
SCIP_Bool SCIPtreeHasCurrentNodeLP(SCIP_TREE *tree)
Definition: tree.c:7984
int SCIPvarGetMultaggrNVars(SCIP_VAR *var)
Definition: var.c:16825
int SCIPnlpGetNVars(SCIP_NLP *nlp)
Definition: nlp.c:5751
SCIP_Real * SCIPvarGetMultaggrScalars(SCIP_VAR *var)
Definition: var.c:16849
SCIP_Bool transformed
Definition: struct_prob.h:78
SCIP_Bool SCIPsetIsFeasLT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5600
int nfixedvars
Definition: struct_prob.h:67
SCIP_RETCODE SCIPsolPrintRay(SCIP_SOL *sol, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PROB *transprob, FILE *file, SCIP_Bool printzeros)
Definition: sol.c:2034
SCIP_RETCODE SCIPsolAdjustImplicitSolVals(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_Bool uselprows)
Definition: sol.c:423
SCIP_Real SCIPvarGetLPSol(SCIP_VAR *var)
Definition: var.c:17431
SCIP_SOLORIGIN solorigin
Definition: struct_sol.h:68
static SCIP_RETCODE solClearArrays(SCIP_SOL *sol)
Definition: sol.c:49
SCIP_Real SCIPlpGetLooseObjval(SCIP_LP *lp, SCIP_SET *set, SCIP_PROB *prob)
Definition: lp.c:15115
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
Definition: var.c:16608
SCIP_RETCODE SCIPsolLinkRelaxSol(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_RELAXATION *relaxation)
Definition: sol.c:832
SCIP_Real SCIPsetFeasFloor(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5747
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
Definition: var.c:17057
SCIP_SOLORIGIN SCIPsolGetOrigin(SCIP_SOL *sol)
Definition: sol.c:2169
void SCIPsolSetHeur(SCIP_SOL *sol, SCIP_HEUR *heur)
Definition: sol.c:2293
static const SCIP_Real scalars[]
Definition: lp.c:5506
#define REALABS(x)
Definition: def.h:151
SCIP_Bool SCIPvarIsTransformedOrigvar(SCIP_VAR *var)
Definition: var.c:12120
SCIP_RETCODE SCIPsolCreateLPSol(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LP *lp, SCIP_HEUR *heur)
Definition: sol.c:558
SCIP_RETCODE SCIPvarGetActiveRepresentatives(SCIP_SET *set, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize, SCIP_Bool mergemultiples)
Definition: var.c:3729
SCIP_CLOCK * solvingtime
Definition: struct_stat.h:115
SCIP_RETCODE SCIPconshdlrCheck(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_SOL *sol, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_RESULT *result)
Definition: cons.c:3465
SCIP_RETCODE SCIPboolarrayFree(SCIP_BOOLARRAY **boolarray)
Definition: misc.c:3140
public methods for message output
int SCIPvarGetProbindex(SCIP_VAR *var)
Definition: var.c:16750
void SCIPmessageFPrintInfo(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr,...)
Definition: message.c:602
SCIP_Bool SCIPsetIsGT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5256
static SCIP_Real solGetArrayVal(SCIP_SOL *sol, SCIP_VAR *var)
Definition: sol.c:135
int SCIPsolGetPrimalIndex(SCIP_SOL *sol)
Definition: sol.c:2262
void SCIPsolUpdateVarObj(SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real oldobj, SCIP_Real newobj)
Definition: sol.c:1455
SCIP_Real time
Definition: struct_sol.h:53
#define SCIP_Real
Definition: def.h:127
internal methods for problem statistics
SCIP_RETCODE SCIPsolCheck(SCIP_SOL *sol, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_Bool printreason, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *feasible)
Definition: sol.c:1474
SCIP_VAR ** vars
Definition: struct_prob.h:54
SCIP_Bool SCIPlpIsSolved(SCIP_LP *lp)
Definition: lp.c:19383
SCIP_Bool SCIPsetIsFeasPositive(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5699
SCIP_VAR ** SCIPprobGetVars(SCIP_PROB *prob)
Definition: prob.c:2228
SCIP_Bool SCIPvarMayRoundUp(SCIP_VAR *var)
Definition: var.c:3267
#define SCIPsetFreeBufferArray(set, ptr)
Definition: set.h:1795
#define SCIP_INVALID
Definition: def.h:147
enum SCIP_SolOrigin SCIP_SOLORIGIN
Definition: type_sol.h:43
internal methods for constraints and constraint handlers
SCIP_Real primsol
Definition: struct_lp.h:136
SCIP_REALARRAY * vals
Definition: struct_sol.h:60
#define SCIP_Longint
Definition: def.h:112
SCIP_VAR ** SCIPnlpGetVars(SCIP_NLP *nlp)
Definition: nlp.c:5741
SCIP_RETCODE SCIPsolCreateNLPSol(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_NLP *nlp, SCIP_HEUR *heur)
Definition: sol.c:581
#define SCIPisFinite(x)
Definition: pub_misc.h:5428
SCIP_Bool SCIPsetIsFeasGT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5644
SCIP_RETCODE SCIPrealarraySetVal(SCIP_REALARRAY *realarray, int arraygrowinit, SCIP_Real arraygrowfac, int idx, SCIP_Real val)
Definition: misc.c:2624
SCIP_BOOLARRAY * valid
Definition: struct_sol.h:61
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
Definition: var.c:16730
SCIP_RETCODE SCIPsolCreatePseudoSol(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LP *lp, SCIP_HEUR *heur)
Definition: sol.c:624
common defines and data types used in all packages of SCIP
SCIP_Longint nnodes
Definition: struct_stat.h:64
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:392
SCIP_VAR * SCIPcolGetVar(SCIP_COL *col)
Definition: lp.c:18685
SCIP_Real * SCIPcolGetVals(SCIP_COL *col)
Definition: lp.c:18794
int SCIPcolGetNNonz(SCIP_COL *col)
Definition: lp.c:18759
#define SCIP_ALLOC(x)
Definition: def.h:277
#define SCIPABORT()
Definition: def.h:238
SCIP_Bool hasinfval
Definition: struct_sol.h:69
SCIP_Real obj
Definition: struct_sol.h:52
int SCIPvarGetNLocksDown(SCIP_VAR *var)
Definition: var.c:3149
int index
Definition: struct_sol.h:67
SCIP_Bool SCIPsetIsFeasNegative(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5710
SCIP_RETCODE SCIPsolFree(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_PRIMAL *primal)
Definition: sol.c:704