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