Scippy

SCIP

Solving Constraint Integer Programs

heur_indicator.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 heur_indicator.c
17  * @brief handle partial solutions for linear problems with indicators and otherwise continuous variables
18  * @author Marc Pfetsch
19  *
20  * For linear problems with indicators and otherwise continuous variables, the indicator constraint handler can produce
21  * partial solutions, i.e., values for the indicator variables. This partial solution can be passed to this heuristic,
22  * which then fixes these values and solves an LP. Additionally a local search for a better solution is added.
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 #include "scip/scip.h"
30 #include "scip/heur_indicator.h"
31 #include "scip/cons_indicator.h"
32 
33 #define HEUR_NAME "indicator"
34 #define HEUR_DESC "indicator heuristic to create feasible solutions from values for indicator variables"
35 #define HEUR_DISPCHAR 'A'
36 #define HEUR_PRIORITY -20200
37 #define HEUR_FREQ 1
38 #define HEUR_FREQOFS 0
39 #define HEUR_MAXDEPTH -1
40 #define HEUR_TIMING SCIP_HEURTIMING_DURINGLPLOOP
41 #define HEUR_USESSUBSCIP FALSE /**< does the heuristic use a secondary SCIP instance? */
42 
43 #define DEFAULT_ONEOPT TRUE /**< whether the one-opt heuristic should be started */
44 #define DEFAULT_IMPROVESOLS FALSE /**< Try to improve other solutions by one-opt? */
45 
46 
47 /** primal heuristic data */
48 struct SCIP_HeurData
49 {
50  int nindconss; /**< number of indicator constraints */
51  SCIP_CONS** indconss; /**< indicator constraints */
52  SCIP_Bool* solcand; /**< bitset of indicator variables ind solution candidate */
53  SCIP_Bool oneopt; /**< whether the one-opt heuristic should be started */
54  SCIP_CONSHDLR* indicatorconshdlr; /**< indicator constraint handler */
55  SCIP_SOL* lastsol; /**< last solution considered for improvement */
56  SCIP_Bool improvesols; /**< Try to improve other solutions by one-opt? */
57 };
58 
59 /*
60  * Local methods
61  */
62 
63 /** try one-opt on given solution */
64 static
66  SCIP* scip, /**< SCIP data structure */
67  SCIP_HEUR* heur, /**< indicator heuristic */
68  SCIP_HEURDATA* heurdata, /**< heuristic data */
69  int nindconss, /**< number of indicator constraints */
70  SCIP_CONS** indconss, /**< indicator constraints */
71  SCIP_Bool* solcand, /**< values for indicator variables in partial solution */
72  int* nfoundsols /**< number of solutions found */
73  )
74 {
75  SCIP_Bool cutoff;
76  SCIP_Bool lperror;
77  SCIP_Bool stored;
78  SCIP_SOL* sol;
79  int cnt = 0;
80  int i;
81  int c;
82 
83  assert( scip != NULL );
84  assert( heur != NULL );
85  assert( heurdata != NULL );
86  assert( nindconss == 0 || indconss != NULL );
87  assert( solcand != NULL );
88  assert( nfoundsols != NULL );
89 
90  SCIPdebugMessage("Performing one-opt ...\n");
91  *nfoundsols = 0;
92 
93  SCIP_CALL( SCIPstartProbing(scip) );
94 
95  for (i = 0; i < nindconss; ++i)
96  {
97  SCIP_VAR* binvar;
98 
99  /* skip nonactive constraints */
100  if ( ! SCIPconsIsActive(indconss[i]) )
101  continue;
102 
103  binvar = SCIPgetBinaryVarIndicator(indconss[i]);
104  assert( binvar != NULL );
105 
106  /* skip constraints with fixed variables */
107  if ( SCIPvarGetUbLocal(binvar) < 0.5 || SCIPvarGetLbLocal(binvar) > 0.5 )
108  continue;
109 
110  /* return if the we would exceed the depth limit of the tree */
111  if( SCIPgetDepthLimit(scip) <= SCIPgetDepth(scip) )
112  break;
113 
114  /* get rid of all bound changes */
115  SCIP_CALL( SCIPnewProbingNode(scip) );
116  ++cnt;
117 
118  /* fix variables */
119  for (c = 0; c < nindconss; ++c)
120  {
121  SCIP_Bool s;
122 
123  /* skip nonactive constraints */
124  if ( ! SCIPconsIsActive(indconss[c]) )
125  continue;
126 
127  binvar = SCIPgetBinaryVarIndicator(indconss[c]);
128  assert( binvar != NULL );
129 
130  /* fix variables according to solution candidate, except constraint i */
131  if ( c == i )
132  s = ! solcand[c];
133  else
134  s = solcand[c];
135 
136  if ( ! s )
137  {
138  if ( SCIPvarGetLbLocal(binvar) < 0.5 && SCIPvarGetUbLocal(binvar) > 0.5 )
139  {
140  SCIP_CALL( SCIPchgVarLbProbing(scip, binvar, 1.0) );
141  }
142  }
143  else
144  {
145  if ( SCIPvarGetUbLocal(binvar) > 0.5 && SCIPvarGetLbLocal(binvar) < 0.5 )
146  {
147  SCIP_CALL( SCIPchgVarUbProbing(scip, binvar, 0.0) );
148  }
149  }
150  }
151 
152  /* propagate variables */
153  SCIP_CALL( SCIPpropagateProbing(scip, -1, &cutoff, NULL) );
154  if ( cutoff )
155  {
156  SCIP_CALL( SCIPbacktrackProbing(scip, 0) );
157  continue;
158  }
159 
160  /* solve LP to move continuous variables */
161  SCIP_CALL( SCIPsolveProbingLP(scip, -1, &lperror, &cutoff) );
162 
163  /* the LP often reaches the objective limit - we currently do not use such solutions */
164  if ( lperror || cutoff || SCIPgetLPSolstat(scip) != SCIP_LPSOLSTAT_OPTIMAL )
165  {
166 #ifdef SCIP_DEBUG
167  if ( lperror )
168  SCIPdebugMessage("An LP error occured.\n");
169 #endif
170  SCIP_CALL( SCIPbacktrackProbing(scip, 0) );
171  continue;
172  }
173 
174  /* create solution */
175  SCIP_CALL( SCIPcreateSol(scip, &sol, heur) );
176 
177  /* copy the current LP solution to the working solution */
178  SCIP_CALL( SCIPlinkLPSol(scip, sol) );
179 
180  /* check solution for feasibility */
181  SCIPdebugMessage("One-opt found solution candidate with value %g.\n", SCIPgetSolTransObj(scip, sol));
182 
183  /* only check integrality, because we solved an LP */
184  SCIP_CALL( SCIPtrySolFree(scip, &sol, FALSE, FALSE, TRUE, FALSE, &stored) );
185  if ( stored )
186  ++(*nfoundsols);
187  SCIP_CALL( SCIPbacktrackProbing(scip, 0) );
188  }
189  SCIP_CALL( SCIPendProbing(scip) );
190 
191  SCIPdebugMessage("Finished one-opt (tried variables: %d, found sols: %d).\n", cnt, *nfoundsols);
192 
193  return SCIP_OKAY;
194 }
195 
196 
197 /** try given solution */
198 static
200  SCIP* scip, /**< SCIP data structure */
201  SCIP_HEUR* heur, /**< indicator heuristic */
202  SCIP_HEURDATA* heurdata, /**< heuristic data */
203  int nindconss, /**< number of indicator constraints */
204  SCIP_CONS** indconss, /**< indicator constraints */
205  SCIP_Bool* solcand, /**< values for indicator variables in partial solution */
206  int* nfoundsols /**< number of solutions found */
207  )
208 {
209  SCIP_Bool cutoff;
210  SCIP_Bool lperror;
211  SCIP_Bool stored;
212  SCIP_SOL* sol;
213  int c;
214 
215  assert( scip != NULL );
216  assert( heur != NULL );
217  assert( heurdata != NULL );
218  assert( nindconss == 0 || indconss != NULL );
219  assert( solcand != NULL );
220  assert( nfoundsols != NULL );
221 
222  SCIPdebugMessage("Trying to generate feasible solution with indicators from solution candidate ...\n");
223  *nfoundsols = 0;
224 
225  SCIP_CALL( SCIPstartProbing(scip) );
226 
227  /* we can stop here if we have already reached the maximal depth */
228  if( SCIPgetDepthLimit(scip) <= SCIPgetDepth(scip) )
229  {
230  SCIP_CALL( SCIPendProbing(scip) );
231  return SCIP_OKAY;
232  }
233 
234  SCIP_CALL( SCIPnewProbingNode(scip) );
235 
236  /* fix variables */
237  for (c = 0; c < nindconss; ++c)
238  {
239  SCIP_VAR* binvar;
240 
241  /* skip nonactive constraints */
242  if ( ! SCIPconsIsActive(indconss[c]) )
243  continue;
244 
245  binvar = SCIPgetBinaryVarIndicator(indconss[c]);
246  assert( binvar != NULL );
247 
248  /* Fix binary variables not in cover to 1 and corresponding slack variables to 0. The other binary variables are fixed to 0. */
249  if ( ! solcand[c] )
250  {
251  /* to be sure, check for non-fixed variables */
252  if ( SCIPvarGetLbLocal(binvar) < 0.5 && SCIPvarGetUbLocal(binvar) > 0.5 )
253  {
254  SCIP_CALL( SCIPchgVarLbProbing(scip, binvar, 1.0) );
255  }
256  }
257  else
258  {
259  if ( SCIPvarGetUbLocal(binvar) > 0.5 && SCIPvarGetLbLocal(binvar) < 0.5 )
260  {
261  SCIP_CALL( SCIPchgVarUbProbing(scip, binvar, 0.0) );
262  }
263  }
264  }
265 
266  /* propagate variables */
267  SCIP_CALL( SCIPpropagateProbing(scip, -1, &cutoff, NULL) );
268  if ( cutoff )
269  {
270  SCIPdebugMessage("Solution candidate reaches cutoff (in propagation).\n");
271  SCIP_CALL( SCIPendProbing(scip) );
272  return SCIP_OKAY;
273  }
274 
275  /* solve LP to move continuous variables */
276  SCIP_CALL( SCIPsolveProbingLP(scip, -1, &lperror, &cutoff) );
277 
278  /* the LP often reaches the objective limit - we currently do not use such solutions */
279  if ( lperror || cutoff || SCIPgetLPSolstat(scip) != SCIP_LPSOLSTAT_OPTIMAL )
280  {
281 #ifdef SCIP_DEBUG
282  if ( lperror )
283  SCIPdebugMessage("An LP error occured.\n");
284  else
285  SCIPdebugMessage("Solution candidate reaches cutoff (in LP solving).\n");
286 #endif
287  SCIP_CALL( SCIPendProbing(scip) );
288  return SCIP_OKAY;
289  }
290 
291  /* create solution */
292  SCIP_CALL( SCIPcreateSol(scip, &sol, heur) );
293 
294  /* copy the current LP solution to the working solution */
295  SCIP_CALL( SCIPlinkLPSol(scip, sol) );
296 
297  /* check solution for feasibility */
298 #ifdef SCIP_DEBUG
299  SCIPdebugMessage("Found solution candidate with value %g.\n", SCIPgetSolTransObj(scip, sol));
300 #ifdef SCIP_MORE_DEBUG
301  SCIP_CALL( SCIPprintSol(scip, sol, NULL, FALSE) );
302 #endif
303  SCIP_CALL( SCIPtrySolFree(scip, &sol, TRUE, TRUE, TRUE, TRUE, &stored) );
304  if ( stored )
305  {
306  ++(*nfoundsols);
307  SCIPdebugMessage("Solution is feasible and stored.\n");
308  }
309  else
310  SCIPdebugMessage("Solution was not stored.\n");
311 #else
312  /* only check integrality, because we solved an LP */
313  SCIP_CALL( SCIPtrySolFree(scip, &sol, FALSE, FALSE, TRUE, FALSE, &stored) );
314  if ( stored )
315  ++(*nfoundsols);
316 #endif
317  SCIP_CALL( SCIPendProbing(scip) );
318 
319  /* possibly perform one-opt */
320  if ( stored && heurdata->oneopt )
321  {
322  int nfound = 0;
323  assert( *nfoundsols > 0 );
324  SCIP_CALL( tryOneOpt(scip, heur, heurdata, nindconss, indconss, solcand, &nfound) );
325  }
326 
327  return SCIP_OKAY;
328 }
329 
330 
331 /*
332  * Callback methods of primal heuristic
333  */
334 
335 /** copy method for primal heuristic plugins (called when SCIP copies plugins) */
336 static
337 SCIP_DECL_HEURCOPY(heurCopyIndicator)
338 { /*lint --e{715}*/
339  assert( scip != NULL );
340  assert( heur != NULL );
341  assert( strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0 );
342 
343  /* call inclusion method of primal heuristic */
345 
346  return SCIP_OKAY;
347 }
348 
349 /** initialization method of primal heuristic (called after problem was transformed) */
350 static
351 SCIP_DECL_HEURINIT(heurInitIndicator)
352 { /*lint --e{715}*/
353  SCIP_HEURDATA* heurdata;
354 
355  assert( heur != NULL );
356  assert( scip != NULL );
357 
358  /* get heuristic data */
359  heurdata = SCIPheurGetData(heur);
360  assert( heurdata != NULL );
361 
362  if ( heurdata->indicatorconshdlr != NULL )
363  {
364  heurdata->indicatorconshdlr = SCIPfindConshdlr(scip, "indicator");
365  if ( heurdata->indicatorconshdlr == NULL )
366  {
367  SCIPwarningMessage(scip, "Could not find indicator constraint handler.\n");
368  }
369  }
370 
371  return SCIP_OKAY;
372 }
373 
374 /** destructor of primal heuristic to free user data (called when SCIP is exiting) */
375 static
376 SCIP_DECL_HEURFREE(heurFreeIndicator)
377 { /*lint --e{715}*/
378  SCIP_HEURDATA* heurdata;
379 
380  assert( heur != NULL );
381  assert( scip != NULL );
382 
383  /* get heuristic data */
384  heurdata = SCIPheurGetData(heur);
385  assert( heurdata != NULL );
386 
387  SCIPfreeBlockMemoryArrayNull(scip, &(heurdata->indconss), heurdata->nindconss);
388  SCIPfreeBlockMemoryArrayNull(scip, &(heurdata->solcand), heurdata->nindconss);
389 
390  /* free heuristic data */
391  SCIPfreeMemory(scip, &heurdata);
392  SCIPheurSetData(heur, NULL);
393 
394  return SCIP_OKAY;
395 }
396 
397 
398 /** execution method of primal heuristic */
399 static
400 SCIP_DECL_HEUREXEC(heurExecIndicator)
401 { /*lint --e{715}*/
402  SCIP_HEURDATA* heurdata;
403  int nfoundsols = 0;
404 
405  assert( heur != NULL );
406  assert( scip != NULL );
407  assert( result != NULL );
408 
409  *result = SCIP_DIDNOTRUN;
410 
411  if ( SCIPgetSubscipDepth(scip) > 0 )
412  return SCIP_OKAY;
413 
414  /* get heuristic's data */
415  heurdata = SCIPheurGetData(heur);
416  assert( heurdata != NULL );
417 
418  /* call heuristic, if solution candidate is available */
419  if ( heurdata->solcand != NULL )
420  {
421  assert( heurdata->nindconss > 0 );
422  assert( heurdata->indconss != NULL );
423 
424  /* The heuristic will only be successful if there are no integral variables and no binary variables except the
425  * indicator variables. */
426  if ( SCIPgetNIntVars(scip) > 0 || heurdata->nindconss < SCIPgetNBinVars(scip) )
427  return SCIP_OKAY;
428 
429  SCIP_CALL( trySolCandidate(scip, heur, heurdata, heurdata->nindconss, heurdata->indconss, heurdata->solcand, &nfoundsols) );
430 
431  if ( nfoundsols > 0 )
432  *result = SCIP_FOUNDSOL;
433  else
434  *result = SCIP_DIDNOTFIND;
435 
436  /* free memory */
437  SCIPfreeBlockMemoryArray(scip, &(heurdata->solcand), heurdata->nindconss);
438  SCIPfreeBlockMemoryArray(scip, &(heurdata->indconss), heurdata->nindconss);
439  }
440  else
441  {
442  SCIP_CONS** indconss;
443  SCIP_Bool* solcand;
444  SCIP_SOL* bestsol;
445  int nindconss;
446  int i;
447 
448  if ( heurdata->indicatorconshdlr == NULL )
449  return SCIP_OKAY;
450 
451  /* check whether a new best solution has been found */
452  bestsol = SCIPgetBestSol(scip);
453  if ( bestsol == heurdata->lastsol )
454  return SCIP_OKAY;
455  heurdata->lastsol = bestsol;
456 
457  /* avoid solutions produced by this heuristic */
458  if ( SCIPsolGetHeur(bestsol) == heur )
459  return SCIP_OKAY;
460 
461  /* The heuristic will only be successful if there are no integral variables and no binary variables except the
462  * indicator variables. */
463  if ( SCIPgetNIntVars(scip) > 0 || SCIPconshdlrGetNConss(heurdata->indicatorconshdlr) < SCIPgetNBinVars(scip) )
464  return SCIP_OKAY;
465 
466  nindconss = SCIPconshdlrGetNConss(heurdata->indicatorconshdlr);
467  if ( nindconss == 0 )
468  return SCIP_OKAY;
469 
470  indconss = SCIPconshdlrGetConss(heurdata->indicatorconshdlr);
471  assert( indconss != NULL );
472 
473  /* fill solutin candidate */
474  SCIP_CALL( SCIPallocBufferArray(scip, &solcand, nindconss) );
475  for (i = 0; i < nindconss; ++i)
476  {
477  SCIP_VAR* binvar;
478  SCIP_Real val;
479 
480  solcand[i] = FALSE;
481  if ( SCIPconsIsActive(indconss[i]) )
482  {
483  binvar = SCIPgetBinaryVarIndicator(indconss[i]);
484  assert( binvar != NULL );
485 
486  val = SCIPgetSolVal(scip, bestsol, binvar);
487  assert( SCIPisFeasIntegral(scip, val) );
488  if ( val > 0.5 )
489  solcand[i] = TRUE;
490  }
491  }
492 
493  SCIPdebugMessage("Trying to improve best solution of value %f.\n", SCIPgetSolOrigObj(scip, bestsol) );
494 
495  /* try one-opt heuristic */
496  SCIP_CALL( tryOneOpt(scip, heur, heurdata, nindconss, indconss, solcand, &nfoundsols) );
497 
498  if ( nfoundsols > 0 )
499  *result = SCIP_FOUNDSOL;
500  else
501  *result = SCIP_DIDNOTFIND;
502 
503  SCIPfreeBufferArray(scip, &solcand);
504  }
505 
506  return SCIP_OKAY;
507 }
508 
509 
510 /*
511  * primal heuristic specific interface methods
512  */
513 
514 /** creates the indicator primal heuristic and includes it in SCIP */
516  SCIP* scip /**< SCIP data structure */
517  )
518 {
519  SCIP_HEURDATA* heurdata;
520  SCIP_HEUR* heur;
521 
522  /* create Indicator primal heuristic data */
523  SCIP_CALL( SCIPallocMemory(scip, &heurdata) );
524  heurdata->nindconss = 0;
525  heurdata->indconss = NULL;
526  heurdata->solcand = NULL;
527  heurdata->lastsol = NULL;
528  heurdata->indicatorconshdlr = NULL;
529 
530  /* include primal heuristic */
531  SCIP_CALL( SCIPincludeHeurBasic(scip, &heur,
533  HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecIndicator, heurdata) );
534 
535  assert( heur != NULL );
536 
537  /* set non-NULL pointers to callback methods */
538  SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyIndicator) );
539  SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitIndicator) );
540  SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeIndicator) );
541 
542  /* add parameters */
544  "heuristics/" HEUR_NAME "/oneopt",
545  "whether the one-opt heuristic should be started",
546  &heurdata->oneopt, TRUE, DEFAULT_ONEOPT, NULL, NULL) );
547 
549  "heuristics/" HEUR_NAME "/improvesols",
550  "Try to improve other solutions by one-opt?",
551  &heurdata->improvesols, TRUE, DEFAULT_IMPROVESOLS, NULL, NULL) );
552 
553  return SCIP_OKAY;
554 }
555 
556 
557 /** pass partial solution for indicator variables to heuristic */
559  SCIP* scip, /**< SCIP data structure */
560  SCIP_HEUR* heur, /**< indicator heuristic */
561  int nindconss, /**< number of indicator constraints */
562  SCIP_CONS** indconss, /**< indicator constraints */
563  SCIP_Bool* solcand /**< values for indicator variables in partial solution */
564  )
565 {
566  SCIP_HEURDATA* heurdata;
567 
568  assert( scip != NULL );
569  assert( heur != NULL );
570  assert( strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0 );
571  assert( nindconss > 0 );
572  assert( indconss != NULL );
573  assert( solcand != NULL );
574 
575  /* get heuristic's data */
576  heurdata = SCIPheurGetData(heur);
577  assert( heurdata != NULL );
578 
579  /* copy indicator information */
580  if ( heurdata->indconss != NULL )
581  SCIPfreeBlockMemoryArray(scip, &(heurdata->indconss), heurdata->nindconss);
582 
583  SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &(heurdata->indconss), indconss, nindconss) );
584  heurdata->nindconss = nindconss;
585 
586  /* copy partial solution */
587  if ( heurdata->solcand != NULL )
588  BMScopyMemoryArray(heurdata->solcand, solcand, nindconss);
589  else
590  SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &(heurdata->solcand), solcand, nindconss) );
591 
592  return SCIP_OKAY;
593 }
SCIP_RETCODE SCIPsolveProbingLP(SCIP *scip, int itlim, SCIP_Bool *lperror, SCIP_Bool *cutoff)
Definition: scip.c:32788
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition: scip.c:5878
#define SCIPallocMemory(scip, ptr)
Definition: scip.h:20526
SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
Definition: sol.c:2252
static SCIP_DECL_HEURCOPY(heurCopyIndicator)
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition: heur.c:1147
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition: scip.h:20573
SCIP_RETCODE SCIPsetHeurCopy(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURCOPY((*heurcopy)))
Definition: scip.c:7297
SCIP_RETCODE SCIPbacktrackProbing(SCIP *scip, int probingdepth)
Definition: scip.c:32250
#define HEUR_DESC
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip.c:1248
int SCIPgetSubscipDepth(SCIP *scip)
Definition: scip.c:3205
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4288
#define NULL
Definition: lpi_spx.cpp:130
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
Definition: var.c:17113
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4258
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
Definition: cons.c:7681
constraint handler for indicator constraints
SCIP_RETCODE SCIPincludeHeurBasic(SCIP *scip, SCIP_HEUR **heur, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, unsigned int timingmask, SCIP_Bool usessubscip, SCIP_DECL_HEUREXEC((*heurexec)), SCIP_HEURDATA *heurdata)
Definition: scip.c:7252
static SCIP_DECL_HEURINIT(heurInitIndicator)
SCIP_VAR * SCIPgetBinaryVarIndicator(SCIP_CONS *cons)
SCIP_RETCODE SCIPpropagateProbing(SCIP *scip, int maxproprounds, SCIP_Bool *cutoff, SCIP_Longint *ndomredsfound)
Definition: scip.c:32552
#define FALSE
Definition: def.h:56
SCIP_Real SCIPgetSolTransObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip.c:35113
int SCIPgetNBinVars(SCIP *scip)
Definition: scip.c:10743
#define TRUE
Definition: def.h:55
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
#define SCIP_CALL(x)
Definition: def.h:266
SCIP_RETCODE SCIPtrySolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool printreason, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
Definition: scip.c:36299
SCIP_RETCODE SCIPheurPassIndicator(SCIP *scip, SCIP_HEUR *heur, int nindconss, SCIP_CONS **indconss, SCIP_Bool *solcand)
struct SCIP_HeurData SCIP_HEURDATA
Definition: type_heur.h:51
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
Definition: scip.c:42008
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
Definition: scip.c:26439
#define SCIPdebugMessage
Definition: pub_message.h:77
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
Definition: scip.c:34983
#define HEUR_MAXDEPTH
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip.c:35066
static SCIP_DECL_HEURFREE(heurFreeIndicator)
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.c:3547
#define HEUR_DISPCHAR
#define SCIPfreeMemory(scip, ptr)
Definition: scip.h:20542
#define HEUR_TIMING
#define DEFAULT_ONEOPT
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
Definition: scip.h:20574
#define HEUR_PRIORITY
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip.c:34002
#define DEFAULT_IMPROVESOLS
#define HEUR_NAME
handle partial solutions for linear problems with indicators and otherwise continuous variables ...
int SCIPgetDepthLimit(SCIP *scip)
Definition: scip.c:38190
void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
Definition: heur.c:1068
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
Definition: var.c:17123
#define SCIP_Bool
Definition: def.h:53
SCIP_RETCODE SCIPstartProbing(SCIP *scip)
Definition: scip.c:32153
#define BMScopyMemoryArray(ptr, source, num)
Definition: memory.h:89
SCIP_RETCODE SCIPincludeHeurIndicator(SCIP *scip)
SCIP_RETCODE SCIPendProbing(SCIP *scip)
Definition: scip.c:32285
int SCIPgetDepth(SCIP *scip)
Definition: scip.c:38140
SCIP_RETCODE SCIPlinkLPSol(SCIP *scip, SCIP_SOL *sol)
Definition: scip.c:34648
SCIP_RETCODE SCIPsetHeurInit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINIT((*heurinit)))
Definition: scip.c:7329
static SCIP_RETCODE tryOneOpt(SCIP *scip, SCIP_HEUR *heur, SCIP_HEURDATA *heurdata, int nindconss, SCIP_CONS **indconss, SCIP_Bool *solcand, int *nfoundsols)
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip.h:20585
int SCIPgetNIntVars(SCIP *scip)
Definition: scip.c:10788
SCIP_RETCODE SCIPchgVarUbProbing(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip.c:32352
SCIP_RETCODE SCIPsetHeurFree(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree)))
Definition: scip.c:7313
#define SCIP_Real
Definition: def.h:127
SCIP_RETCODE SCIPnewProbingNode(SCIP *scip)
Definition: scip.c:32190
SCIP_RETCODE SCIPchgVarLbProbing(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip.c:32318
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
Definition: scip.h:20568
static SCIP_RETCODE trySolCandidate(SCIP *scip, SCIP_HEUR *heur, SCIP_HEURDATA *heurdata, int nindconss, SCIP_CONS **indconss, SCIP_Bool *solcand, int *nfoundsols)
#define HEUR_FREQ
SCIP_HEURDATA * SCIPheurGetData(SCIP_HEUR *heur)
Definition: heur.c:1058
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip.h:20597
#define HEUR_USESSUBSCIP
static SCIP_DECL_HEUREXEC(heurExecIndicator)
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
Definition: scip.c:35767
#define HEUR_FREQOFS
SCIP callable library.
SCIP_RETCODE SCIPprintSol(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)
Definition: scip.c:35397