Scippy

SCIP

Solving Constraint Integer Programs

cons_samediff.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 cons_samediff.c
17  * @brief Constraint handler stores the local branching decision data
18  * @author Timo Berthold
19  * @author Stefan Heinz
20  *
21  * This constraint handler is used to store the branching decision of the \ref BRANCHING "Ryan/Foster branching rule"
22  * which is implemented in \ref branch_ryanfoster.c.
23  */
24 
25 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
26 
27 #include <assert.h>
28 #include <string.h>
29 
30 #include "cons_samediff.h"
31 #include "probdata_binpacking.h"
32 #include "vardata_binpacking.h"
33 
34 
35 /**@name Constraint handler properties
36  *
37  * @{
38  */
39 
40 #define CONSHDLR_NAME "samediff"
41 #define CONSHDLR_DESC "stores the local branching decisions"
42 #define CONSHDLR_ENFOPRIORITY 0 /**< priority of the constraint handler for constraint enforcing */
43 #define CONSHDLR_CHECKPRIORITY 9999999 /**< priority of the constraint handler for checking feasibility */
44 #define CONSHDLR_PROPFREQ 1 /**< frequency for propagating domains; zero means only preprocessing propagation */
45 #define CONSHDLR_EAGERFREQ 1 /**< frequency for using all instead of only the useful constraints in separation,
46  * propagation and enforcement, -1 for no eager evaluations, 0 for first only */
47 #define CONSHDLR_DELAYPROP FALSE /**< should propagation method be delayed, if other propagators found reductions? */
48 #define CONSHDLR_NEEDSCONS TRUE /**< should the constraint handler be skipped, if no constraints are available? */
49 
50 #define CONSHDLR_PROP_TIMING SCIP_PROPTIMING_BEFORELP
51 
52 /**@} */
53 
54 /*
55  * Data structures
56  */
57 
58 /** Constraint data for \ref cons_samediff.c "SameDiff" constraints */
59 struct SCIP_ConsData
60 {
61  int itemid1; /**< item id one */
62  int itemid2; /**< item id two */
63  CONSTYPE type; /**< stores whether the items have to be in the SAME or DIFFER packing */
64  int npropagatedvars; /**< number of variables that existed, the last time, the related node was
65  * propagated, used to determine whether the constraint should be
66  * repropagated*/
67  int npropagations; /**< stores the number propagations runs of this constraint */
68  unsigned int propagated:1; /**< is constraint already propagated? */
69  SCIP_NODE* node; /**< the node in the B&B-tree at which the cons is sticking */
70 };
71 
72 /**@name Local methods
73  *
74  * @{
75  */
76 
77 /** create constraint data */
78 static
79 SCIP_RETCODE consdataCreate(
80  SCIP* scip, /**< SCIP data structure */
81  SCIP_CONSDATA** consdata, /**< pointer to store the constraint data */
82  int itemid1, /**< item id one */
83  int itemid2, /**< item id two */
84  CONSTYPE type, /**< stores whether the items have to be in the SAME or DIFFER packing */
85  SCIP_NODE* node /**< the node in the B&B-tree at which the cons is sticking */
86  )
87 {
88  assert( scip != NULL );
89  assert( consdata != NULL );
90  assert( itemid1 >= 0 );
91  assert( itemid2 >= 0 );
92  assert( type == DIFFER || type == SAME );
93 
94  SCIP_CALL( SCIPallocBlockMemory(scip, consdata) );
95 
96  (*consdata)->itemid1 = itemid1;
97  (*consdata)->itemid2 = itemid2;
98  (*consdata)->type = type;
99  (*consdata)->npropagatedvars = 0;
100  (*consdata)->npropagations = 0;
101  (*consdata)->propagated = FALSE;
102  (*consdata)->node = node;
103 
104  return SCIP_OKAY;
105 }
106 
107 /** display constraints */
108 static
109 void consdataPrint(
110  SCIP* scip, /**< SCIP data structure */
111  SCIP_CONSDATA* consdata, /**< constraint data */
112  FILE* file /**< file stream */
113  )
114 {
115  SCIP_PROBDATA* probdata;
116  int* ids;
117 
118  probdata = SCIPgetProbData(scip);
119  assert(probdata != NULL);
120 
121  ids = SCIPprobdataGetIds(probdata);
122  assert(ids != NULL);
123 
124  SCIPinfoMessage(scip, file, "%s(%d,%d) at node %d\n",
125  consdata->type == SAME ? "same" : "diff",
126  ids[consdata->itemid1], ids[consdata->itemid2], SCIPnodeGetNumber(consdata->node) );
127 }
128 
129 /** fixes a variable to zero if the corresponding packings are not valid for this constraint/node (due to branching) */
130 static
131 SCIP_RETCODE checkVariable(
132  SCIP* scip, /**< SCIP data structure */
133  SCIP_CONSDATA* consdata, /**< constraint data */
134  SCIP_VAR* var, /**< variables to check */
135  int* nfixedvars, /**< pointer to store the number of fixed variables */
136  SCIP_Bool* cutoff /**< pointer to store if a cutoff was detected */
137  )
138 {
139  SCIP_VARDATA* vardata;
140  int* consids;
141  int nconsids;
142 
143  SCIP_Bool existid1;
144  SCIP_Bool existid2;
145  CONSTYPE type;
146 
147  SCIP_Bool fixed;
148  SCIP_Bool infeasible;
149 
150  int pos;
151 
152  assert(scip != NULL);
153  assert(consdata != NULL);
154  assert(var != NULL);
155  assert(nfixedvars != NULL);
156  assert(cutoff != NULL);
157 
158  /* if variables is locally fixed to zero continue */
159  if( SCIPvarGetUbLocal(var) < 0.5 )
160  return SCIP_OKAY;
161 
162  /* check if the packing which corresponds to the variable feasible for this constraint */
163  vardata = SCIPvarGetData(var);
164 
165  nconsids = SCIPvardataGetNConsids(vardata);
166  consids = SCIPvardataGetConsids(vardata);
167 
168  existid1 = SCIPsortedvecFindInt(consids, consdata->itemid1, nconsids, &pos);
169  existid2 = SCIPsortedvecFindInt(consids, consdata->itemid2, nconsids, &pos);
170  type = consdata->type;
171 
172  if( (type == SAME && existid1 != existid2) || (type == DIFFER && existid1 && existid2) )
173  {
174  SCIP_CALL( SCIPfixVar(scip, var, 0.0, &infeasible, &fixed) );
175 
176  if( infeasible )
177  {
178  assert( SCIPvarGetLbLocal(var) > 0.5 );
179  SCIPdebugMessage("-> cutoff\n");
180  (*cutoff) = TRUE;
181  }
182  else
183  {
184  assert(fixed);
185  (*nfixedvars)++;
186  }
187  }
188 
189  return SCIP_OKAY;
190 }
191 
192 /** fixes variables to zero if the corresponding packings are not valid for this sonstraint/node (due to branching) */
193 static
194 SCIP_RETCODE consdataFixVariables(
195  SCIP* scip, /**< SCIP data structure */
196  SCIP_CONSDATA* consdata, /**< constraint data */
197  SCIP_VAR** vars, /**< generated variables */
198  int nvars, /**< number of generated variables */
199  SCIP_RESULT* result /**< pointer to store the result of the fixing */
200  )
201 {
202  int nfixedvars;
203  int v;
204  SCIP_Bool cutoff;
205 
206  nfixedvars = 0;
207  cutoff = FALSE;
208 
209  SCIPdebugMessage("check variables %d to %d\n", consdata->npropagatedvars, nvars);
210 
211  for( v = consdata->npropagatedvars; v < nvars && !cutoff; ++v )
212  {
213  SCIP_CALL( checkVariable(scip, consdata, vars[v], &nfixedvars, &cutoff) );
214  }
215 
216  SCIPdebugMessage("fixed %d variables locally\n", nfixedvars);
217 
218  if( cutoff )
219  *result = SCIP_CUTOFF;
220  else if( nfixedvars > 0 )
221  *result = SCIP_REDUCEDDOM;
222 
223  return SCIP_OKAY;
224 }
225 
226 
227 /** check if all variables are valid for the given consdata */
228 #ifndef NDEBUG
229 static
230 SCIP_Bool consdataCheck(
231  SCIP* scip, /**< SCIP data structure */
232  SCIP_PROBDATA* probdata, /**< problem data */
233  SCIP_CONSDATA* consdata, /**< constraint data */
234  SCIP_Bool beforeprop /**< is this check performed before propagation? */
235  )
236 {
237  SCIP_VAR** vars;
238  int nvars;
239 
240  SCIP_VARDATA* vardata;
241  SCIP_VAR* var;
242 
243  int* consids;
244  int nconsids;
245  SCIP_Bool existid1;
246  SCIP_Bool existid2;
247  CONSTYPE type;
248 
249  int pos;
250  int v;
251 
252  vars = SCIPprobdataGetVars(probdata);
253  nvars = (beforeprop ? consdata->npropagatedvars : SCIPprobdataGetNVars(probdata));
254  assert(nvars <= SCIPprobdataGetNVars(probdata));
255 
256  for( v = 0; v < nvars; ++v )
257  {
258  var = vars[v];
259 
260  /* if variables is locally fixed to zero continue */
261  if( SCIPvarGetLbLocal(var) < 0.5 )
262  continue;
263 
264  /* check if the packing which corresponds to the variable is feasible for this constraint */
265  vardata = SCIPvarGetData(var);
266 
267  nconsids = SCIPvardataGetNConsids(vardata);
268  consids = SCIPvardataGetConsids(vardata);
269 
270  existid1 = SCIPsortedvecFindInt(consids, consdata->itemid1, nconsids, &pos);
271  existid2 = SCIPsortedvecFindInt(consids, consdata->itemid2, nconsids, &pos);
272  type = consdata->type;
273 
274  if( (type == SAME && existid1 != existid2) || (type == DIFFER && existid1 && existid2) )
275  {
276  SCIPdebug( SCIPvardataPrint(scip, vardata, NULL) );
277  SCIPdebug( consdataPrint(scip, consdata, NULL) );
278  SCIPdebug( SCIPprintVar(scip, var, NULL) );
279  return FALSE;
280  }
281 
282  }
283 
284  return TRUE;
285 }
286 #endif
287 
288 /** frees samediff constraint data */
289 static
290 SCIP_RETCODE consdataFree(
291  SCIP* scip, /**< SCIP data structure */
292  SCIP_CONSDATA** consdata /**< pointer to the constraint data */
293  )
294 {
295  assert(consdata != NULL);
296  assert(*consdata != NULL);
297 
298  SCIPfreeBlockMemory(scip, consdata);
299 
300  return SCIP_OKAY;
301 }
302 
303 /**@} */
304 
305 
306 /**@name Callback methods
307  *
308  * @{
309  */
310 
311 /** frees specific constraint data */
312 static
313 SCIP_DECL_CONSDELETE(consDeleteSamediff)
314 { /*lint --e{715}*/
315  assert(conshdlr != NULL);
316  assert(strcmp(SCIPconshdlrGetName(conshdlr), CONSHDLR_NAME) == 0);
317  assert(consdata != NULL);
318  assert(*consdata != NULL);
319 
320  /* free samediff constraint */
321  SCIP_CALL( consdataFree(scip, consdata) );
322 
323  return SCIP_OKAY;
324 }
325 
326 /** transforms constraint data into data belonging to the transformed problem */
327 static
328 SCIP_DECL_CONSTRANS(consTransSamediff)
329 { /*lint --e{715}*/
330  SCIP_CONSDATA* sourcedata;
331  SCIP_CONSDATA* targetdata;
332 
333  assert(conshdlr != NULL);
334  assert(strcmp(SCIPconshdlrGetName(conshdlr), CONSHDLR_NAME) == 0);
335  assert(SCIPgetStage(scip) == SCIP_STAGE_TRANSFORMING);
336  assert(sourcecons != NULL);
337  assert(targetcons != NULL);
338 
339  sourcedata = SCIPconsGetData(sourcecons);
340  assert(sourcedata != NULL);
341 
342  /* create constraint data for target constraint */
343  SCIP_CALL( consdataCreate(scip, &targetdata,
344  sourcedata->itemid1, sourcedata->itemid2, sourcedata->type, sourcedata->node) );
345 
346  /* create target constraint */
347  SCIP_CALL( SCIPcreateCons(scip, targetcons, SCIPconsGetName(sourcecons), conshdlr, targetdata,
348  SCIPconsIsInitial(sourcecons), SCIPconsIsSeparated(sourcecons), SCIPconsIsEnforced(sourcecons),
349  SCIPconsIsChecked(sourcecons), SCIPconsIsPropagated(sourcecons),
350  SCIPconsIsLocal(sourcecons), SCIPconsIsModifiable(sourcecons),
351  SCIPconsIsDynamic(sourcecons), SCIPconsIsRemovable(sourcecons), SCIPconsIsStickingAtNode(sourcecons)) );
352 
353  return SCIP_OKAY;
354 }
355 
356 /** constraint enforcing method of constraint handler for LP solutions */
357 #define consEnfolpSamediff NULL
359 /** constraint enforcing method of constraint handler for pseudo solutions */
360 #define consEnfopsSamediff NULL
362 /** feasibility check method of constraint handler for integral solutions */
363 #define consCheckSamediff NULL
365 /** domain propagation method of constraint handler */
366 static
367 SCIP_DECL_CONSPROP(consPropSamediff)
368 { /*lint --e{715}*/
369  SCIP_PROBDATA* probdata;
370  SCIP_CONSDATA* consdata;
371 
372  SCIP_VAR** vars;
373  int nvars;
374  int c;
375 
376  assert(scip != NULL);
377  assert(strcmp(SCIPconshdlrGetName(conshdlr), CONSHDLR_NAME) == 0);
378  assert(result != NULL);
379 
380  SCIPdebugMessage("propagation constraints of constraint handler <"CONSHDLR_NAME">\n");
381 
382  probdata = SCIPgetProbData(scip);
383  assert(probdata != NULL);
384 
385  vars = SCIPprobdataGetVars(probdata);
386  nvars = SCIPprobdataGetNVars(probdata);
387 
388  *result = SCIP_DIDNOTFIND;
389 
390  for( c = 0; c < nconss; ++c )
391  {
392  consdata = SCIPconsGetData(conss[c]);
393 
394 #ifndef NDEBUG
395  {
396  /* check if there are no equal consdatas */
397  SCIP_CONSDATA* consdata2;
398  int i;
399 
400  for( i = c+1; i < nconss; ++i )
401  {
402  consdata2 = SCIPconsGetData(conss[i]);
403  assert( !(consdata->itemid1 == consdata2->itemid1
404  && consdata->itemid2 == consdata2->itemid2
405  && consdata->type == consdata2->type) );
406  assert( !(consdata->itemid1 == consdata2->itemid2
407  && consdata->itemid2 == consdata2->itemid1
408  && consdata->type == consdata2->type) );
409  }
410  }
411 #endif
412 
413  if( !consdata->propagated )
414  {
415  SCIPdebugMessage("propagate constraint <%s> ", SCIPconsGetName(conss[c]));
416  SCIPdebug( consdataPrint(scip, consdata, NULL) );
417 
418  SCIP_CALL( consdataFixVariables(scip, consdata, vars, nvars, result) );
419  consdata->npropagations++;
420 
421  if( *result != SCIP_CUTOFF )
422  {
423  consdata->propagated = TRUE;
424  consdata->npropagatedvars = nvars;
425  }
426  else
427  break;
428  }
429 
430  /* check if constraint is completely propagated */
431  assert( consdataCheck(scip, probdata, consdata, FALSE) );
432  }
433 
434  return SCIP_OKAY;
435 }
436 
437 /** variable rounding lock method of constraint handler */
438 #define consLockSamediff NULL
440 /** constraint activation notification method of constraint handler */
441 static
442 SCIP_DECL_CONSACTIVE(consActiveSamediff)
443 { /*lint --e{715}*/
444  SCIP_CONSDATA* consdata;
445  SCIP_PROBDATA* probdata;
446 
447  assert(scip != NULL);
448  assert(strcmp(SCIPconshdlrGetName(conshdlr), CONSHDLR_NAME) == 0);
449  assert(cons != NULL);
450 
451  probdata = SCIPgetProbData(scip);
452  assert(probdata != NULL);
453 
454  consdata = SCIPconsGetData(cons);
455  assert(consdata != NULL);
456  assert(consdata->npropagatedvars <= SCIPprobdataGetNVars(probdata));
457 
458  SCIPdebugMessage("activate constraint <%s> at node <%"SCIP_LONGINT_FORMAT"> in depth <%d>: ",
459  SCIPconsGetName(cons), SCIPnodeGetNumber(consdata->node), SCIPnodeGetDepth(consdata->node));
460  SCIPdebug( consdataPrint(scip, consdata, NULL) );
461 
462  if( consdata->npropagatedvars != SCIPprobdataGetNVars(probdata) )
463  {
464  SCIPdebugMessage("-> mark constraint to be repropagated\n");
465  consdata->propagated = FALSE;
466  SCIP_CALL( SCIPrepropagateNode(scip, consdata->node) );
467  }
468 
469  /* check if all previously generated variables are valid for this constraint */
470  assert( consdataCheck(scip, probdata, consdata, TRUE) );
471 
472  return SCIP_OKAY;
473 }
474 
475 /** constraint deactivation notification method of constraint handler */
476 static
477 SCIP_DECL_CONSDEACTIVE(consDeactiveSamediff)
478 { /*lint --e{715}*/
479  SCIP_CONSDATA* consdata;
480  SCIP_PROBDATA* probdata;
481 
482  assert(scip != NULL);
483  assert(strcmp(SCIPconshdlrGetName(conshdlr), CONSHDLR_NAME) == 0);
484  assert(cons != NULL);
485 
486  consdata = SCIPconsGetData(cons);
487  assert(consdata != NULL);
488  assert(consdata->propagated || SCIPgetNChildren(scip) == 0);
489 
490  probdata = SCIPgetProbData(scip);
491  assert(probdata != NULL);
492 
493  SCIPdebugMessage("deactivate constraint <%s> at node <%"SCIP_LONGINT_FORMAT"> in depth <%d>: ",
494  SCIPconsGetName(cons), SCIPnodeGetNumber(consdata->node), SCIPnodeGetDepth(consdata->node));
495  SCIPdebug( consdataPrint(scip, consdata, NULL) );
496 
497  /* set the number of propagated variables to current number of variables is SCIP */
498  consdata->npropagatedvars = SCIPprobdataGetNVars(probdata);
499 
500  return SCIP_OKAY;
501 }
502 
503 /** constraint display method of constraint handler */
504 static
505 SCIP_DECL_CONSPRINT(consPrintSamediff)
506 { /*lint --e{715}*/
507  SCIP_CONSDATA* consdata;
508 
509  consdata = SCIPconsGetData(cons);
510  assert(consdata != NULL);
511 
512  consdataPrint(scip, consdata, file);
513 
514  return SCIP_OKAY;
515 }
516 
517 /**@} */
518 
519 /**@name Interface methods
520  *
521  * @{
522  */
523 
524 /** creates the handler for samediff constraints and includes it in SCIP */
525 SCIP_RETCODE SCIPincludeConshdlrSamediff(
526  SCIP* scip /**< SCIP data structure */
527  )
528 {
529  SCIP_CONSHDLRDATA* conshdlrdata = NULL;
530  SCIP_CONSHDLR* conshdlr = NULL;
531 
532  /* include constraint handler */
533  SCIP_CALL( SCIPincludeConshdlrBasic(scip, &conshdlr, CONSHDLR_NAME, CONSHDLR_DESC,
536  conshdlrdata) );
537  assert(conshdlr != NULL);
538 
539  SCIP_CALL( SCIPsetConshdlrDelete(scip, conshdlr, consDeleteSamediff) );
540  SCIP_CALL( SCIPsetConshdlrTrans(scip, conshdlr, consTransSamediff) );
541  SCIP_CALL( SCIPsetConshdlrProp(scip, conshdlr, consPropSamediff, CONSHDLR_PROPFREQ, CONSHDLR_DELAYPROP,
543  SCIP_CALL( SCIPsetConshdlrActive(scip, conshdlr, consActiveSamediff) );
544  SCIP_CALL( SCIPsetConshdlrDeactive(scip, conshdlr, consDeactiveSamediff) );
545  SCIP_CALL( SCIPsetConshdlrPrint(scip, conshdlr, consPrintSamediff) );
546 
547  return SCIP_OKAY;
548 }
549 
550 /** creates and captures a samediff constraint */
551 SCIP_RETCODE SCIPcreateConsSamediff(
552  SCIP* scip, /**< SCIP data structure */
553  SCIP_CONS** cons, /**< pointer to hold the created constraint */
554  const char* name, /**< name of constraint */
555  int itemid1, /**< item id one */
556  int itemid2, /**< item id two */
557  CONSTYPE type, /**< stores whether the items have to be in the SAME or DIFFER packing */
558  SCIP_NODE* node, /**< the node in the B&B-tree at which the cons is sticking */
559  SCIP_Bool local /**< is constraint only valid locally? */
560  )
561 {
562  SCIP_CONSHDLR* conshdlr;
563  SCIP_CONSDATA* consdata;
564 
565  /* find the samediff constraint handler */
566  conshdlr = SCIPfindConshdlr(scip, CONSHDLR_NAME);
567  if( conshdlr == NULL )
568  {
569  SCIPerrorMessage("samediff constraint handler not found\n");
570  return SCIP_PLUGINNOTFOUND;
571  }
572 
573  /* create the constraint specific data */
574  SCIP_CALL( consdataCreate(scip, &consdata, itemid1, itemid2, type, node) );
575 
576  /* create constraint */
577  SCIP_CALL( SCIPcreateCons(scip, cons, name, conshdlr, consdata, FALSE, FALSE, FALSE, FALSE, TRUE,
578  local, FALSE, FALSE, FALSE, TRUE) );
579 
580  SCIPdebugMessage("created constraint: ");
581  SCIPdebug( consdataPrint(scip, consdata, NULL) );
582 
583  return SCIP_OKAY;
584 }
585 
586 /** returns item id one */
588  SCIP* scip, /**< SCIP data structure */
589  SCIP_CONS* cons /**< samediff constraint */
590  )
591 {
592  SCIP_CONSDATA* consdata;
593 
594  assert(cons != NULL);
595 
596  consdata = SCIPconsGetData(cons);
597  assert(consdata != NULL);
598 
599  return consdata->itemid1;
600 }
601 
602 /** returns item id two */
604  SCIP* scip, /**< SCIP data structure */
605  SCIP_CONS* cons /**< samediff constraint */
606  )
607 {
608  SCIP_CONSDATA* consdata;
609 
610  assert(cons != NULL);
611 
612  consdata = SCIPconsGetData(cons);
613  assert(consdata != NULL);
614 
615  return consdata->itemid2;
616 }
617 
618 /** return constraint type SAME or DIFFER */
620  SCIP* scip, /**< SCIP data structure */
621  SCIP_CONS* cons /**< samediff constraint */
622  )
623 {
624  SCIP_CONSDATA* consdata;
625 
626  assert(cons != NULL);
627 
628  consdata = SCIPconsGetData(cons);
629  assert(consdata != NULL);
630 
631  return consdata->type;
632 }
633 
634 /**@} */
static SCIP_DECL_CONSDELETE(consDeleteSamediff)
void SCIPvardataPrint(SCIP *scip, SCIP_VARDATA *vardata, FILE *file)
static SCIP_DECL_CONSDEACTIVE(consDeactiveSamediff)
static SCIP_RETCODE checkVariable(SCIP *scip, SCIP_CONSDATA *consdata, SCIP_VAR *var, int *nfixedvars, SCIP_Bool *cutoff)
Constraint handler stores the local branching decision data.
SCIP_RETCODE SCIPcreateConsSamediff(SCIP *scip, SCIP_CONS **cons, const char *name, int itemid1, int itemid2, CONSTYPE type, SCIP_NODE *node, SCIP_Bool local)
#define consEnfolpSamediff
static void consdataPrint(SCIP *scip, SCIP_CONSDATA *consdata, FILE *file)
#define CONSHDLR_NAME
Definition: cons_samediff.c:40
Variable data containing the ids of constraints in which the variable appears.
int * SCIPvardataGetConsids(SCIP_VARDATA *vardata)
SCIP_VAR ** SCIPprobdataGetVars(SCIP_PROBDATA *probdata)
unsigned int propagated
Definition: cons_samediff.c:69
#define CONSHDLR_DELAYPROP
Definition: cons_samediff.c:48
#define CONSHDLR_PROP_TIMING
Definition: cons_samediff.c:51
#define CONSHDLR_ENFOPRIORITY
Definition: cons_samediff.c:42
#define CONSHDLR_NEEDSCONS
Definition: cons_samediff.c:49
int SCIPgetItemid2Samediff(SCIP *scip, SCIP_CONS *cons)
SCIP_NODE * node
Definition: cons_samediff.c:70
#define consEnfopsSamediff
int * SCIPprobdataGetIds(SCIP_PROBDATA *probdata)
#define CONSHDLR_EAGERFREQ
Definition: cons_samediff.c:45
static SCIP_RETCODE consdataCreate(SCIP *scip, SCIP_CONSDATA **consdata, int itemid1, int itemid2, CONSTYPE type, SCIP_NODE *node)
Definition: cons_samediff.c:80
SCIP_RETCODE SCIPincludeConshdlrSamediff(SCIP *scip)
Problem data for binpacking problem.
CONSTYPE type
Definition: cons_samediff.c:64
CONSTYPE SCIPgetTypeSamediff(SCIP *scip, SCIP_CONS *cons)
static SCIP_Bool consdataCheck(SCIP *scip, SCIP_PROBDATA *probdata, SCIP_CONSDATA *consdata, SCIP_Bool beforeprop)
int SCIPprobdataGetNVars(SCIP_PROBDATA *probdata)
#define CONSHDLR_DESC
Definition: cons_samediff.c:41
static SCIP_RETCODE consdataFixVariables(SCIP *scip, SCIP_CONSDATA *consdata, SCIP_VAR **vars, int nvars, SCIP_RESULT *result)
int SCIPgetItemid1Samediff(SCIP *scip, SCIP_CONS *cons)
static SCIP_DECL_CONSPRINT(consPrintSamediff)
#define consCheckSamediff
#define CONSHDLR_PROPFREQ
Definition: cons_samediff.c:44
static SCIP_DECL_CONSTRANS(consTransSamediff)
static SCIP_RETCODE consdataFree(SCIP *scip, SCIP_CONSDATA **consdata)
int SCIPvardataGetNConsids(SCIP_VARDATA *vardata)
#define consLockSamediff
#define CONSHDLR_CHECKPRIORITY
Definition: cons_samediff.c:43
static SCIP_DECL_CONSPROP(consPropSamediff)
enum ConsType CONSTYPE
Definition: cons_samediff.h:40
static SCIP_DECL_CONSACTIVE(consActiveSamediff)