Scippy

SCIP

Solving Constraint Integer Programs

cons_fixedvar.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-2024 Zuse Institute Berlin (ZIB) */
7 /* */
8 /* Licensed under the Apache License, Version 2.0 (the "License"); */
9 /* you may not use this file except in compliance with the License. */
10 /* You may obtain a copy of the License at */
11 /* */
12 /* http://www.apache.org/licenses/LICENSE-2.0 */
13 /* */
14 /* Unless required by applicable law or agreed to in writing, software */
15 /* distributed under the License is distributed on an "AS IS" BASIS, */
16 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17 /* See the License for the specific language governing permissions and */
18 /* limitations under the License. */
19 /* */
20 /* You should have received a copy of the Apache-2.0 license */
21 /* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22 /* */
23 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24 
25 /**@file cons_fixedvar.c
26  * @ingroup DEFPLUGINS_CONS
27  * @brief constraint handler that checks bounds on fixed variables
28  * @author Stefan Vigerske
29  *
30  * For each original variable that has a counterpart in the transformed problem
31  * which is not active (i.e., fixed, negated, aggregated, or multiaggregated),
32  * check the original bounds. In enforcement, add a cut that enforces the bounds
33  * or tighten LP feasibility tolerance.
34  */
35 
36 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
37 
38 #include <assert.h>
39 
40 #include "scip/cons_fixedvar.h"
41 
42 
43 /* fundamental constraint handler properties */
44 #define CONSHDLR_NAME "fixedvar"
45 #define CONSHDLR_DESC "check bounds of original variables that are not active in transformed problem"
46 #define CONSHDLR_ENFOPRIORITY -7000000 /**< priority of the constraint handler for constraint enforcing */
47 #define CONSHDLR_CHECKPRIORITY -7000000 /**< priority of the constraint handler for checking feasibility */
48 #define CONSHDLR_EAGERFREQ -1 /**< frequency for using all instead of only the useful constraints in separation,
49  * propagation and enforcement, -1 for no eager evaluations, 0 for first only */
50 #define CONSHDLR_NEEDSCONS FALSE /**< should the constraint handler be skipped, if no constraints are available? */
51 
52 /* parameter default values */
53 #define DEFAULT_ENABLED TRUE /**< enable constraint handler */
54 #define DEFAULT_SUBSCIPS TRUE /**< also run in subSCIPs */
55 #define DEFAULT_PREFERCUT TRUE /**< whether to prefer separation over tightening LP feastol in enforcement */
56 
57 /*
58  * Data structures
59  */
60 
61 /** constraint handler data */
62 struct SCIP_ConshdlrData
63 {
64  SCIP_VAR** vars; /**< variables to check */
65  int nvars; /**< number of variables to check */
66  int varssize; /**< size of vars array */
67 
68  SCIP_Bool enabled; /**< whether to do anything */
69  SCIP_Bool subscips; /**< whether to be active in subSCIPs */
70  SCIP_Bool prefercut; /**< whether to prefer separation over tightening LP feastol in enforcement */
71 };
72 
73 
74 /*
75  * Local methods
76  */
77 
78 /** an assert for checking that the violation is not so large
79  *
80  * The idea of this constraint handler is the handling of tiny bound violations that are scaled up
81  * above the feasibility tolerance by aggregation factors. Usually, the violation should still be
82  * rather "small". For this test, we quantify "small" as 0.5.
83  */
84 #define assertSmallViolation(lb, val, ub) (assert((val) >= (lb) - 0.5 && (val) <= (ub) + 0.5));
85 
86 /** add cut to enforce global bounds on variable aggregation
87  *
88  * Given an original fixed variable x, add cut lb <= x <= ub.
89  * SCIP will replace x by the corresponding aggregation of x in the transformed problem.
90  * Though we only need to enforce original bounds on x, we use here the global bounds on x for lb/ub,
91  * as these should be as tight as or tighter than the original bounds.
92  */
93 static
95  SCIP* scip, /**< SCIP data structure */
96  SCIP_CONSHDLR* conshdlr, /**< fixedvar conshdlr */
97  SCIP_SOL* sol, /**< solution that is enforced */
98  SCIP_VAR* var, /**< fixed original variable which bound is violated */
99  SCIP_Bool* success, /**< buffer to store whether cut was added */
100  SCIP_Bool* cutoff /**< buffer to store whether a cutoff was detected */
101  )
102 {
103  SCIP_ROW* row;
104  char name[SCIP_MAXSTRLEN];
105 
106  assert(scip != NULL);
107  assert(var != NULL);
108  assert(success != NULL);
109  assert(cutoff != NULL);
110 
111  *cutoff = FALSE;
112 
113  SCIPdebugMsg(scip, "addCut for variable <%s> [%.15g,%.15g] with value <%.15g>\n", SCIPvarGetName(var), SCIPvarGetLbGlobal(var), SCIPvarGetUbGlobal(var), SCIPgetSolVal(scip, sol, var));
114 
115  (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s_bounds", SCIPvarGetName(var));
116 
117  assert(SCIPvarGetLbGlobal(var) >= SCIPvarGetLbOriginal(var)); /*lint !e777*/
118  assert(SCIPvarGetUbGlobal(var) <= SCIPvarGetUbOriginal(var)); /*lint !e777*/
119 
120  SCIP_CALL( SCIPcreateEmptyRowConshdlr(scip, &row, conshdlr, name, SCIPvarGetLbGlobal(var), SCIPvarGetUbGlobal(var), FALSE, FALSE, TRUE) );
121  SCIP_CALL( SCIPaddVarToRow(scip, row, var, 1.0) );
122 
123 #ifdef SCIP_DEBUG
124  SCIP_CALL( SCIPprintRow(scip, row, NULL) );
125 #endif
126 
127  /* solution should be violated in the row */
128  assert(SCIPisFeasNegative(scip, SCIPgetRowSolFeasibility(scip, row, sol)));
129 
130  SCIP_CALL( SCIPaddRow(scip, row, FALSE, cutoff) );
131  SCIP_CALL( SCIPreleaseRow(scip, &row) );
132 
133  *success = TRUE;
134 
135  return SCIP_OKAY;
136 }
137 
138 
139 /*
140  * Callback methods of constraint handler
141  */
142 
143 /** copy method for constraint handler plugins (called when SCIP copies plugins) */
144 static
145 SCIP_DECL_CONSHDLRCOPY(conshdlrCopyFixedvar)
146 { /*lint --e{715}*/
147  assert(scip != NULL);
148  assert(conshdlr != NULL);
149  assert(strcmp(SCIPconshdlrGetName(conshdlr), CONSHDLR_NAME) == 0);
150 
151  if( SCIPconshdlrGetData(conshdlr)->subscips )
152  {
154  }
155 
156  *valid = TRUE;
157 
158  return SCIP_OKAY;
159 }
160 
161 /** destructor of constraint handler to free constraint handler data (called when SCIP is exiting) */
162 static
163 SCIP_DECL_CONSFREE(consFreeFixedvar)
164 { /*lint --e{715}*/
165 
166  SCIP_CONSHDLRDATA* conshdlrdata;
167 
168  conshdlrdata = SCIPconshdlrGetData(conshdlr);
169  assert(conshdlrdata != NULL);
170  assert(conshdlrdata->vars == NULL); /* should have been freed in Exitsol */
171 
172  SCIPfreeBlockMemory(scip, &conshdlrdata);
173  SCIPconshdlrSetData(conshdlr, NULL);
174 
175  return SCIP_OKAY;
176 }
177 
178 /** solving process initialization method of constraint handler (called when branch and bound process is about to begin) */
179 static
180 SCIP_DECL_CONSINITSOL(consInitsolFixedvar)
181 { /*lint --e{715}*/
182  SCIP_CONSHDLRDATA* conshdlrdata;
183  SCIP_VAR** vars;
184  int nvars;
185  int i;
186 
187  conshdlrdata = SCIPconshdlrGetData(conshdlr);
188  assert(conshdlrdata != NULL);
189  assert(conshdlrdata->vars == NULL);
190  assert(conshdlrdata->varssize == 0);
191  assert(conshdlrdata->nvars == 0);
192 
193  if( !conshdlrdata->enabled )
194  return SCIP_OKAY;
195 
196  if( SCIPgetNFixedVars(scip) == 0 )
197  return SCIP_OKAY;
198 
199  vars = SCIPgetOrigVars(scip);
200  nvars = SCIPgetNOrigVars(scip);
201 
202  /* for faster checks, collect original variables that are fixed in transformed problem
203  * during solve, this list does not change
204  */
205  conshdlrdata->varssize = SCIPgetNFixedVars(scip);
206  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &conshdlrdata->vars, conshdlrdata->varssize) );
207 
208  for( i = 0; i < nvars; ++i )
209  {
210  SCIP_VAR* var;
211 
212  SCIP_CALL( SCIPgetTransformedVar(scip, vars[i], &var) );
213 
214  /* skip original variable without counterpart in transformed problem */
215  if( var == NULL )
216  continue;
217 
218  /* skip original variable that is still active in transformed problem
219  * the normal feasibility checks in SCIP should ensure that bounds are satisfied
220  */
221  if( SCIPvarIsActive(var) )
222  continue;
223 
224  /* skip free original variable */
226  continue;
227 
228  assert(conshdlrdata->nvars < conshdlrdata->varssize);
229  conshdlrdata->vars[conshdlrdata->nvars++] = vars[i];
230  }
231 
232  return SCIP_OKAY;
233 }
234 
235 
236 /** solving process deinitialization method of constraint handler (called before branch and bound process data is freed) */
237 static
238 SCIP_DECL_CONSEXITSOL(consExitsolFixedvar)
239 { /*lint --e{715}*/
240  SCIP_CONSHDLRDATA* conshdlrdata;
241 
242  conshdlrdata = SCIPconshdlrGetData(conshdlr);
243  assert(conshdlrdata != NULL);
244 
245  SCIPfreeBlockMemoryArrayNull(scip, &conshdlrdata->vars, conshdlrdata->varssize);
246  conshdlrdata->varssize = 0;
247  conshdlrdata->nvars = 0;
248 
249  return SCIP_OKAY;
250 }
251 
252 /** constraint enforcing method of constraint handler for LP solutions */
253 static
254 SCIP_DECL_CONSENFOLP(consEnfolpFixedvar)
255 { /*lint --e{715}*/
256  SCIP_CONSHDLRDATA* conshdlrdata;
257  SCIP_Bool addcut;
258  int i;
259 
260  assert(scip != NULL);
261  assert(result != NULL);
262 
263  *result = SCIP_FEASIBLE;
264 
265  conshdlrdata = SCIPconshdlrGetData(conshdlr);
266  assert(conshdlrdata != NULL);
267 
268  /* we will try separation if this is preferred or the LP feastol is too small already */
269  addcut = conshdlrdata->prefercut || !SCIPisPositive(scip, SCIPgetLPFeastol(scip));
270 
271  for( i = 0; i < conshdlrdata->nvars; ++i )
272  {
273  SCIP_VAR* var;
274  SCIP_Real lb;
275  SCIP_Real ub;
276  SCIP_Real val;
277 
278  var = conshdlrdata->vars[i];
279  assert(var != NULL);
280 
281  lb = SCIPvarGetLbOriginal(var);
282  ub = SCIPvarGetUbOriginal(var);
283  val = SCIPgetSolVal(scip, NULL, var);
284 
285  if( (!SCIPisInfinity(scip, -lb) && SCIPisFeasLT(scip, val, lb)) || (!SCIPisInfinity(scip, ub) && SCIPisFeasGT(scip, val, ub)) )
286  {
287  if( !solinfeasible )
288  assertSmallViolation(lb, val, ub);
289 
290  if( addcut )
291  {
292  SCIP_Bool success;
293  SCIP_Bool cutoff;
294 
295  SCIP_CALL( addCut(scip, conshdlr, NULL, var, &success, &cutoff) );
296 
297  if( cutoff )
298  {
299  *result = SCIP_CUTOFF;
300  break;
301  }
302 
303  if( success )
304  {
305  *result = SCIP_SEPARATED;
306  break;
307  }
308 
309  /* tighten LP feasibility tolerance, but check other variables first */
310  *result = SCIP_INFEASIBLE;
311  }
312  else
313  {
314  /* tighten LP feasibility tolerance */
315  *result = SCIP_INFEASIBLE;
316  break;
317  }
318  }
319  }
320 
321  if( *result == SCIP_INFEASIBLE )
322  {
323  /* if we could not add a cut or find a cutoff, then try to tighten LP feasibility tolerance
324  * otherwise, we have no mean to enforce the bound, and declare the solution as feasible instead
325  */
327  {
328  SCIP_Real redfeastol = SCIPgetLPFeastol(scip) / 10.0;
329 
330  SCIPsetLPFeastol(scip, MAX(redfeastol, SCIPepsilon(scip))); /*lint !e666*/
331  *result = SCIP_SOLVELP;
332  }
333  else
334  {
335  *result = SCIP_FEASIBLE;
336  SCIPwarningMessage(scip, "Declaring solution with violated bound in original problem as feasible because attempts to enforce the bound have failed. We are very sorry.\n");
337  }
338  }
339 
340  return SCIP_OKAY;
341 }
342 
343 
344 /** constraint enforcing method of constraint handler for relaxation solutions */
345 static
346 SCIP_DECL_CONSENFORELAX(consEnforelaxFixedvar)
347 { /*lint --e{715}*/
348  SCIP_CONSHDLRDATA* conshdlrdata;
349  int i;
350 
351  assert(scip != NULL);
352  assert(result != NULL);
353 
354  *result = SCIP_FEASIBLE;
355 
356  conshdlrdata = SCIPconshdlrGetData(conshdlr);
357  assert(conshdlrdata != NULL);
358 
359  for( i = 0; i < conshdlrdata->nvars; ++i )
360  {
361  SCIP_VAR* var;
362  SCIP_Real lb;
363  SCIP_Real ub;
364  SCIP_Real val;
365 
366  var = conshdlrdata->vars[i];
367  assert(var != NULL);
368 
369  lb = SCIPvarGetLbOriginal(var);
370  ub = SCIPvarGetUbOriginal(var);
371  val = SCIPgetSolVal(scip, sol, var);
372 
373  if( (!SCIPisInfinity(scip, -lb) && SCIPisFeasLT(scip, val, lb)) || (!SCIPisInfinity(scip, ub) && SCIPisFeasGT(scip, val, ub)) )
374  {
375  SCIP_Bool success;
376  SCIP_Bool cutoff;
377 
378  if( !solinfeasible )
379  assertSmallViolation(lb, val, ub);
380 
381  SCIP_CALL( addCut(scip, conshdlr, sol, var, &success, &cutoff) );
382 
383  if( cutoff )
384  {
385  *result = SCIP_CUTOFF;
386  break;
387  }
388 
389  if( success )
390  {
391  *result = SCIP_SEPARATED;
392  break;
393  }
394 
395  /* switch to solving the LP relaxation, but check other variables first */
396  *result = SCIP_SOLVELP;
397  }
398  }
399 
400  return SCIP_OKAY;
401 }
402 
403 
404 /** constraint enforcing method of constraint handler for pseudo solutions */
405 static
406 SCIP_DECL_CONSENFOPS(consEnfopsFixedvar)
407 { /*lint --e{715}*/
408  SCIP_CONSHDLRDATA* conshdlrdata;
409  int i;
410 
411  assert(scip != NULL);
412  assert(result != NULL);
413 
414  *result = SCIP_FEASIBLE;
415 
416  /* skip check for solutions that are already declared infeasible
417  * we could not do anything else than also signaling infeasibility
418  */
419  if( solinfeasible )
420  return SCIP_OKAY;
421 
422  conshdlrdata = SCIPconshdlrGetData(conshdlr);
423  assert(conshdlrdata != NULL);
424 
425  for( i = 0; i < conshdlrdata->nvars; ++i )
426  {
427  SCIP_VAR* var;
428  SCIP_Real lb;
429  SCIP_Real ub;
430  SCIP_Real val;
431 
432  var = conshdlrdata->vars[i];
433  assert(var != NULL);
434 
435  lb = SCIPvarGetLbOriginal(var);
436  ub = SCIPvarGetUbOriginal(var);
437  val = SCIPgetSolVal(scip, NULL, var);
438 
439  if( (!SCIPisInfinity(scip, -lb) && SCIPisFeasLT(scip, val, lb)) || (!SCIPisInfinity(scip, ub) && SCIPisFeasGT(scip, val, ub)) )
440  {
441  *result = SCIP_SOLVELP;
442 
443  assertSmallViolation(lb, val, ub);
444 
445  break;
446  }
447  }
448 
449  return SCIP_OKAY;
450 }
451 
452 
453 /** feasibility check method of constraint handler for integral solutions */
454 static
455 SCIP_DECL_CONSCHECK(consCheckFixedvar)
456 { /*lint --e{715}*/
457  SCIP_CONSHDLRDATA* conshdlrdata;
458  SCIP_VAR** vars;
459  int nvars;
460  int i;
461 
462  assert(scip != NULL);
463  assert(result != NULL);
464 
465  *result = SCIP_FEASIBLE;
466 
467  conshdlrdata = SCIPconshdlrGetData(conshdlr);
468  assert(conshdlrdata != NULL);
469 
470  if( !conshdlrdata->enabled )
471  return SCIP_OKAY;
472 
473  /* skip if no transformed problem yet */
475  return SCIP_OKAY;
476 
477  /* during solving use cached list of relevant original variables, otherwise loop through all variables */
479  {
480  nvars = conshdlrdata->nvars;
481  vars = conshdlrdata->vars;
482  }
483  else
484  {
485  nvars = SCIPgetNOrigVars(scip);
486  vars = SCIPgetOrigVars(scip);
487  }
488  assert(vars != NULL || nvars == 0);
489 
490  for( i = 0; i < nvars; ++i )
491  {
492  SCIP_VAR* var;
493  SCIP_Real lb;
494  SCIP_Real ub;
495  SCIP_Real val;
496 
497  SCIP_CALL( SCIPgetTransformedVar(scip, vars[i], &var) );
498 
499  if( var == NULL )
500  continue;
501 
502  if( SCIPvarIsActive(var) )
503  continue;
504 
505  lb = SCIPvarGetLbOriginal(vars[i]);
506  ub = SCIPvarGetUbOriginal(vars[i]);
507  val = SCIPgetSolVal(scip, sol, var);
508 
509  if( !SCIPisInfinity(scip, -lb) && SCIPisFeasLT(scip, val, lb) )
510  {
511  SCIPdebugMsg(scip, "lower bound of <%s> [%g,%g] violated, solution value <%g>\n",
512  SCIPvarGetName(var), lb, ub, val);
513 
514  if( printreason )
515  {
516  SCIPinfoMessage(scip, NULL, "solution violates lower bound of fixed variable <%s> [%g,%g], solution value <%g>\n",
517  SCIPvarGetName(vars[i]), lb, ub, val);
518  }
519 
520  *result = SCIP_INFEASIBLE;
521 
522  if( !completely )
523  {
524  assertSmallViolation(lb, val, ub);
525  return SCIP_OKAY;
526  }
527  }
528 
529  if( !SCIPisInfinity(scip, ub) && SCIPisFeasGT(scip, val, ub) )
530  {
531  SCIPdebugMsg(scip, "upper bound of <%s> [%g,%g] violated, solution value <%g>\n",
532  SCIPvarGetName(var), lb, ub, val);
533 
534  if( printreason )
535  {
536  SCIPinfoMessage(scip, NULL, "solution violates upper bound of fixed variable <%s> [%g,%g], solution value <%g>\n",
537  SCIPvarGetName(vars[i]), lb, ub, val);
538  }
539 
540  *result = SCIP_INFEASIBLE;
541 
542  if( !completely )
543  {
544  assertSmallViolation(lb, val, ub);
545  return SCIP_OKAY;
546  }
547  }
548  }
549 
550  return SCIP_OKAY;
551 }
552 
553 
554 /** variable rounding lock method of constraint handler */
555 static
556 SCIP_DECL_CONSLOCK(consLockFixedvar)
557 { /*lint --e{715}*/
558  return SCIP_OKAY;
559 }
560 
561 
562 /*
563  * constraint specific interface methods
564  */
565 
566 /** creates the fixedvar constraint handler and includes it in SCIP */
568  SCIP* scip /**< SCIP data structure */
569  )
570 {
571  SCIP_CONSHDLRDATA* conshdlrdata;
572  SCIP_CONSHDLR* conshdlr = NULL;
573 
574  /* create fixedvar constraint handler data */
575  SCIP_CALL( SCIPallocClearBlockMemory(scip, &conshdlrdata) );
576 
577  /* include constraint handler */
580  consEnfolpFixedvar, consEnfopsFixedvar, consCheckFixedvar, consLockFixedvar,
581  conshdlrdata) );
582  assert(conshdlr != NULL);
583 
584  /* set non-fundamental callbacks via specific setter functions */
585  SCIP_CALL( SCIPsetConshdlrCopy(scip, conshdlr, conshdlrCopyFixedvar, NULL) );
586  SCIP_CALL( SCIPsetConshdlrFree(scip, conshdlr, consFreeFixedvar) );
587  SCIP_CALL( SCIPsetConshdlrInitsol(scip, conshdlr, consInitsolFixedvar) );
588  SCIP_CALL( SCIPsetConshdlrExitsol(scip, conshdlr, consExitsolFixedvar) );
589  SCIP_CALL( SCIPsetConshdlrEnforelax(scip, conshdlr, consEnforelaxFixedvar) );
590 
591  /* add fixedvar constraint handler parameters */
592  SCIP_CALL( SCIPaddBoolParam(scip, "constraints/" CONSHDLR_NAME "/enabled",
593  "whether to check and enforce bounds on fixed variables",
594  &conshdlrdata->enabled, FALSE, DEFAULT_ENABLED, NULL, NULL) );
595 
596  SCIP_CALL( SCIPaddBoolParam(scip, "constraints/" CONSHDLR_NAME "/subscips",
597  "whether to act on subSCIPs",
598  &conshdlrdata->subscips, FALSE, DEFAULT_SUBSCIPS, NULL, NULL) );
599 
600  SCIP_CALL( SCIPaddBoolParam(scip, "constraints/" CONSHDLR_NAME "/prefercut",
601  "whether to prefer separation over tightening LP feastol in enforcement",
602  &conshdlrdata->prefercut, FALSE, DEFAULT_PREFERCUT, NULL, NULL) );
603 
604  return SCIP_OKAY;
605 }
#define CONSHDLR_ENFOPRIORITY
Definition: cons_fixedvar.c:46
void SCIPconshdlrSetData(SCIP_CONSHDLR *conshdlr, SCIP_CONSHDLRDATA *conshdlrdata)
Definition: cons.c:4229
static SCIP_DECL_CONSENFOPS(consEnfopsFixedvar)
#define NULL
Definition: def.h:267
#define CONSHDLR_NAME
Definition: cons_fixedvar.c:44
#define SCIPallocBlockMemoryArray(scip, ptr, num)
Definition: scip_mem.h:93
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip_general.c:380
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void SCIPsetLPFeastol(SCIP *scip, SCIP_Real newfeastol)
Definition: scip_lp.c:438
#define DEFAULT_ENABLED
Definition: cons_fixedvar.c:54
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
Definition: var.c:18079
#define SCIP_MAXSTRLEN
Definition: def.h:288
SCIP_RETCODE SCIPsetConshdlrEnforelax(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSENFORELAX((*consenforelax)))
Definition: scip_cons.c:323
SCIP_RETCODE SCIPaddVarToRow(SCIP *scip, SCIP_ROW *row, SCIP_VAR *var, SCIP_Real val)
Definition: scip_lp.c:1701
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
int SCIPgetNOrigVars(SCIP *scip)
Definition: scip_prob.c:2432
SCIP_RETCODE SCIPgetTransformedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **transvar)
Definition: scip_var.c:1438
SCIP_Bool SCIPisFeasNegative(SCIP *scip, SCIP_Real val)
#define FALSE
Definition: def.h:94
SCIP_RETCODE SCIPincludeConshdlrBasic(SCIP *scip, SCIP_CONSHDLR **conshdlrptr, const char *name, const char *desc, int enfopriority, int chckpriority, int eagerfreq, SCIP_Bool needscons, SCIP_DECL_CONSENFOLP((*consenfolp)), SCIP_DECL_CONSENFOPS((*consenfops)), SCIP_DECL_CONSCHECK((*conscheck)), SCIP_DECL_CONSLOCK((*conslock)), SCIP_CONSHDLRDATA *conshdlrdata)
Definition: scip_cons.c:181
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10877
#define TRUE
Definition: def.h:93
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
SCIP_Real SCIPgetLPFeastol(SCIP *scip)
Definition: scip_lp.c:428
#define DEFAULT_SUBSCIPS
Definition: cons_fixedvar.c:55
SCIP_VAR ** SCIPgetOrigVars(SCIP *scip)
Definition: scip_prob.c:2405
#define DEFAULT_PREFERCUT
Definition: cons_fixedvar.c:56
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip_mem.h:108
static SCIP_DECL_CONSFREE(consFreeFixedvar)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip_message.c:120
static SCIP_RETCODE addCut(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Bool *success, SCIP_Bool *cutoff)
Definition: cons_fixedvar.c:95
#define SCIPdebugMsg
Definition: scip_message.h:78
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
Definition: scip_message.c:208
SCIP_Real SCIPepsilon(SCIP *scip)
int SCIPgetNFixedVars(SCIP *scip)
Definition: scip_prob.c:2309
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
Definition: var.c:18089
SCIP_RETCODE SCIPsetConshdlrInitsol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITSOL((*consinitsol)))
Definition: scip_cons.c:444
SCIP_RETCODE SCIPsetConshdlrCopy(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), SCIP_DECL_CONSCOPY((*conscopy)))
Definition: scip_cons.c:347
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4199
SCIP_Real SCIPvarGetLbOriginal(SCIP_VAR *var)
Definition: var.c:18025
SCIP_Real SCIPvarGetUbOriginal(SCIP_VAR *var)
Definition: var.c:18045
#define CONSHDLR_NEEDSCONS
Definition: cons_fixedvar.c:51
static SCIP_DECL_CONSENFORELAX(consEnforelaxFixedvar)
constraint handler that checks bounds on fixed variables
SCIP_RETCODE SCIPincludeConshdlrFixedvar(SCIP *scip)
const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:17420
SCIP_RETCODE SCIPsetConshdlrFree(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSFREE((*consfree)))
Definition: scip_cons.c:372
SCIP_CONSHDLRDATA * SCIPconshdlrGetData(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4219
#define SCIP_CALL(x)
Definition: def.h:380
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPaddRow(SCIP *scip, SCIP_ROW *row, SCIP_Bool forcecut, SCIP_Bool *infeasible)
Definition: scip_cut.c:250
static SCIP_DECL_CONSINITSOL(consInitsolFixedvar)
#define assertSmallViolation(lb, val, ub)
Definition: cons_fixedvar.c:85
#define SCIP_Bool
Definition: def.h:91
static SCIP_DECL_CONSLOCK(consLockFixedvar)
#define CONSHDLR_EAGERFREQ
Definition: cons_fixedvar.c:48
#define CONSHDLR_CHECKPRIORITY
Definition: cons_fixedvar.c:47
static SCIP_DECL_CONSHDLRCOPY(conshdlrCopyFixedvar)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPreleaseRow(SCIP *scip, SCIP_ROW **row)
Definition: scip_lp.c:1562
static SCIP_DECL_CONSCHECK(consCheckFixedvar)
#define MAX(x, y)
Definition: def.h:239
#define SCIP_Real
Definition: def.h:173
SCIP_RETCODE SCIPprintRow(SCIP *scip, SCIP_ROW *row, FILE *file)
Definition: scip_lp.c:2212
SCIP_Real SCIPgetRowSolFeasibility(SCIP *scip, SCIP_ROW *row, SCIP_SOL *sol)
Definition: scip_lp.c:2167
static SCIP_DECL_CONSENFOLP(consEnfolpFixedvar)
struct SCIP_ConshdlrData SCIP_CONSHDLRDATA
Definition: type_cons.h:64
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
Definition: scip_mem.h:111
#define SCIPallocClearBlockMemory(scip, ptr)
Definition: scip_mem.h:91
SCIP_RETCODE SCIPcreateEmptyRowConshdlr(SCIP *scip, SCIP_ROW **row, SCIP_CONSHDLR *conshdlr, const char *name, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool removable)
Definition: scip_lp.c:1391
SCIP_RETCODE SCIPsetConshdlrExitsol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXITSOL((*consexitsol)))
Definition: scip_cons.c:468
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
Definition: scip_sol.c:1217
static SCIP_DECL_CONSEXITSOL(consExitsolFixedvar)
#define CONSHDLR_DESC
Definition: cons_fixedvar.c:45
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip_param.c:57
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
Definition: var.c:17749