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-2015 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  /* get rid of all bound changes */
111  SCIP_CALL( SCIPnewProbingNode(scip) );
112  ++cnt;
113 
114  /* fix variables */
115  for (c = 0; c < nindconss; ++c)
116  {
117  SCIP_Bool s;
118 
119  /* skip nonactive constraints */
120  if ( ! SCIPconsIsActive(indconss[c]) )
121  continue;
122 
123  binvar = SCIPgetBinaryVarIndicator(indconss[c]);
124  assert( binvar != NULL );
125 
126  /* fix variables according to solution candidate, except constraint i */
127  if ( c == i )
128  s = ! solcand[c];
129  else
130  s = solcand[c];
131 
132  if ( ! s )
133  {
134  if ( SCIPvarGetLbLocal(binvar) < 0.5 && SCIPvarGetUbLocal(binvar) > 0.5 )
135  {
136  SCIP_CALL( SCIPchgVarLbProbing(scip, binvar, 1.0) );
137  }
138  }
139  else
140  {
141  if ( SCIPvarGetUbLocal(binvar) > 0.5 && SCIPvarGetLbLocal(binvar) < 0.5 )
142  {
143  SCIP_CALL( SCIPchgVarUbProbing(scip, binvar, 0.0) );
144  }
145  }
146  }
147 
148  /* propagate variables */
149  SCIP_CALL( SCIPpropagateProbing(scip, -1, &cutoff, NULL) );
150  if ( cutoff )
151  {
152  SCIP_CALL( SCIPbacktrackProbing(scip, 0) );
153  continue;
154  }
155 
156  /* solve LP to move continuous variables */
157  SCIP_CALL( SCIPsolveProbingLP(scip, -1, &lperror, &cutoff) );
158 
159  /* the LP often reaches the objective limit - we currently do not use such solutions */
160  if ( lperror || cutoff || SCIPgetLPSolstat(scip) != SCIP_LPSOLSTAT_OPTIMAL )
161  {
162 #ifdef SCIP_DEBUG
163  if ( lperror )
164  SCIPdebugMessage("An LP error occured.\n");
165 #endif
166  SCIP_CALL( SCIPbacktrackProbing(scip, 0) );
167  continue;
168  }
169 
170  /* create solution */
171  SCIP_CALL( SCIPcreateSol(scip, &sol, heur) );
172 
173  /* copy the current LP solution to the working solution */
174  SCIP_CALL( SCIPlinkLPSol(scip, sol) );
175 
176  /* check solution for feasibility */
177  SCIPdebugMessage("One-opt found solution candidate with value %g.\n", SCIPgetSolTransObj(scip, sol));
178 
179  /* only check integrality, because we solved an LP */
180  SCIP_CALL( SCIPtrySolFree(scip, &sol, FALSE, FALSE, TRUE, FALSE, &stored) );
181  if ( stored )
182  ++(*nfoundsols);
183  SCIP_CALL( SCIPbacktrackProbing(scip, 0) );
184  }
185  SCIP_CALL( SCIPendProbing(scip) );
186 
187  SCIPdebugMessage("Finished one-opt (tried variables: %d, found sols: %d).\n", cnt, *nfoundsols);
188 
189  return SCIP_OKAY;
190 }
191 
192 
193 /** try given solution */
194 static
196  SCIP* scip, /**< SCIP data structure */
197  SCIP_HEUR* heur, /**< indicator heuristic */
198  SCIP_HEURDATA* heurdata, /**< heuristic data */
199  int nindconss, /**< number of indicator constraints */
200  SCIP_CONS** indconss, /**< indicator constraints */
201  SCIP_Bool* solcand, /**< values for indicator variables in partial solution */
202  int* nfoundsols /**< number of solutions found */
203  )
204 {
205  SCIP_Bool cutoff;
206  SCIP_Bool lperror;
207  SCIP_Bool stored;
208  SCIP_SOL* sol;
209  int c;
210 
211  assert( scip != NULL );
212  assert( heur != NULL );
213  assert( heurdata != NULL );
214  assert( nindconss == 0 || indconss != NULL );
215  assert( solcand != NULL );
216  assert( nfoundsols != NULL );
217 
218  SCIPdebugMessage("Trying to generate feasible solution with indicators from solution candidate ...\n");
219  *nfoundsols = 0;
220 
221  SCIP_CALL( SCIPstartProbing(scip) );
222  SCIP_CALL( SCIPnewProbingNode(scip) );
223 
224  /* fix variables */
225  for (c = 0; c < nindconss; ++c)
226  {
227  SCIP_VAR* binvar;
228 
229  /* skip nonactive constraints */
230  if ( ! SCIPconsIsActive(indconss[c]) )
231  continue;
232 
233  binvar = SCIPgetBinaryVarIndicator(indconss[c]);
234  assert( binvar != NULL );
235 
236  /* Fix binary variables not in cover to 1 and corresponding slack variables to 0. The other binary variables are fixed to 0. */
237  if ( ! solcand[c] )
238  {
239  /* to be sure, check for non-fixed variables */
240  if ( SCIPvarGetLbLocal(binvar) < 0.5 && SCIPvarGetUbLocal(binvar) > 0.5 )
241  {
242  SCIP_CALL( SCIPchgVarLbProbing(scip, binvar, 1.0) );
243  }
244  }
245  else
246  {
247  if ( SCIPvarGetUbLocal(binvar) > 0.5 && SCIPvarGetLbLocal(binvar) < 0.5 )
248  {
249  SCIP_CALL( SCIPchgVarUbProbing(scip, binvar, 0.0) );
250  }
251  }
252  }
253 
254  /* propagate variables */
255  SCIP_CALL( SCIPpropagateProbing(scip, -1, &cutoff, NULL) );
256  if ( cutoff )
257  {
258  SCIPdebugMessage("Solution candidate reaches cutoff (in propagation).\n");
259  SCIP_CALL( SCIPendProbing(scip) );
260  return SCIP_OKAY;
261  }
262 
263  /* solve LP to move continuous variables */
264  SCIP_CALL( SCIPsolveProbingLP(scip, -1, &lperror, &cutoff) );
265 
266  /* the LP often reaches the objective limit - we currently do not use such solutions */
267  if ( lperror || cutoff || SCIPgetLPSolstat(scip) != SCIP_LPSOLSTAT_OPTIMAL )
268  {
269 #ifdef SCIP_DEBUG
270  if ( lperror )
271  SCIPdebugMessage("An LP error occured.\n");
272  else
273  SCIPdebugMessage("Solution candidate reaches cutoff (in LP solving).\n");
274 #endif
275  SCIP_CALL( SCIPendProbing(scip) );
276  return SCIP_OKAY;
277  }
278 
279  /* create solution */
280  SCIP_CALL( SCIPcreateSol(scip, &sol, heur) );
281 
282  /* copy the current LP solution to the working solution */
283  SCIP_CALL( SCIPlinkLPSol(scip, sol) );
284 
285  /* check solution for feasibility */
286 #ifdef SCIP_DEBUG
287  SCIPdebugMessage("Found solution candidate with value %g.\n", SCIPgetSolTransObj(scip, sol));
288 #ifdef SCIP_MORE_DEBUG
289  SCIP_CALL( SCIPprintSol(scip, sol, NULL, FALSE) );
290 #endif
291  SCIP_CALL( SCIPtrySolFree(scip, &sol, TRUE, TRUE, TRUE, TRUE, &stored) );
292  if ( stored )
293  {
294  ++(*nfoundsols);
295  SCIPdebugMessage("Solution is feasible and stored.\n");
296  }
297  else
298  SCIPdebugMessage("Solution was not stored.\n");
299 #else
300  /* only check integrality, because we solved an LP */
301  SCIP_CALL( SCIPtrySolFree(scip, &sol, FALSE, FALSE, TRUE, FALSE, &stored) );
302  if ( stored )
303  ++(*nfoundsols);
304 #endif
305  SCIP_CALL( SCIPendProbing(scip) );
306 
307  /* possibly perform one-opt */
308  if ( stored && heurdata->oneopt )
309  {
310  int nfound = 0;
311  assert( *nfoundsols > 0 );
312  SCIP_CALL( tryOneOpt(scip, heur, heurdata, nindconss, indconss, solcand, &nfound) );
313  }
314 
315  return SCIP_OKAY;
316 }
317 
318 
319 /*
320  * Callback methods of primal heuristic
321  */
322 
323 /** copy method for primal heuristic plugins (called when SCIP copies plugins) */
324 static
325 SCIP_DECL_HEURCOPY(heurCopyIndicator)
326 { /*lint --e{715}*/
327  assert( scip != NULL );
328  assert( heur != NULL );
329  assert( strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0 );
330 
331  /* call inclusion method of primal heuristic */
333 
334  return SCIP_OKAY;
335 }
336 
337 /** initialization method of primal heuristic (called after problem was transformed) */
338 static
339 SCIP_DECL_HEURINIT(heurInitIndicator)
340 { /*lint --e{715}*/
341  SCIP_HEURDATA* heurdata;
342 
343  assert( heur != NULL );
344  assert( scip != NULL );
345 
346  /* get heuristic data */
347  heurdata = SCIPheurGetData(heur);
348  assert( heurdata != NULL );
349 
350  if ( heurdata->indicatorconshdlr != NULL )
351  {
352  heurdata->indicatorconshdlr = SCIPfindConshdlr(scip, "indicator");
353  if ( heurdata->indicatorconshdlr == NULL )
354  {
355  SCIPwarningMessage(scip, "Could not find indicator constraint handler.\n");
356  }
357  }
358 
359  return SCIP_OKAY;
360 }
361 
362 /** destructor of primal heuristic to free user data (called when SCIP is exiting) */
363 static
364 SCIP_DECL_HEURFREE(heurFreeIndicator)
365 { /*lint --e{715}*/
366  SCIP_HEURDATA* heurdata;
367 
368  assert( heur != NULL );
369  assert( scip != NULL );
370 
371  /* get heuristic data */
372  heurdata = SCIPheurGetData(heur);
373  assert( heurdata != NULL );
374 
375  SCIPfreeBlockMemoryArrayNull(scip, &(heurdata->indconss), heurdata->nindconss);
376  SCIPfreeBlockMemoryArrayNull(scip, &(heurdata->solcand), heurdata->nindconss);
377 
378  /* free heuristic data */
379  SCIPfreeMemory(scip, &heurdata);
380  SCIPheurSetData(heur, NULL);
381 
382  return SCIP_OKAY;
383 }
384 
385 
386 /** execution method of primal heuristic */
387 static
388 SCIP_DECL_HEUREXEC(heurExecIndicator)
389 { /*lint --e{715}*/
390  SCIP_HEURDATA* heurdata;
391  int nfoundsols = 0;
392 
393  assert( heur != NULL );
394  assert( scip != NULL );
395  assert( result != NULL );
396 
397  *result = SCIP_DIDNOTRUN;
398 
399  if ( SCIPgetSubscipDepth(scip) > 0 )
400  return SCIP_OKAY;
401 
402  /* get heuristic's data */
403  heurdata = SCIPheurGetData(heur);
404  assert( heurdata != NULL );
405 
406  /* call heuristic, if solution candidate is available */
407  if ( heurdata->solcand != NULL )
408  {
409  assert( heurdata->nindconss > 0 );
410  assert( heurdata->indconss != NULL );
411 
412  /* The heuristic will only be successful if there are no integral variables and no binary variables except the
413  * indicator variables. */
414  if ( SCIPgetNIntVars(scip) > 0 || heurdata->nindconss < SCIPgetNBinVars(scip) )
415  return SCIP_OKAY;
416 
417  SCIP_CALL( trySolCandidate(scip, heur, heurdata, heurdata->nindconss, heurdata->indconss, heurdata->solcand, &nfoundsols) );
418 
419  if ( nfoundsols > 0 )
420  *result = SCIP_FOUNDSOL;
421  else
422  *result = SCIP_DIDNOTFIND;
423 
424  /* free memory */
425  SCIPfreeBlockMemoryArray(scip, &(heurdata->solcand), heurdata->nindconss);
426  SCIPfreeBlockMemoryArray(scip, &(heurdata->indconss), heurdata->nindconss);
427  }
428  else
429  {
430  SCIP_CONS** indconss;
431  SCIP_Bool* solcand;
432  SCIP_SOL* bestsol;
433  int nindconss;
434  int i;
435 
436  if ( heurdata->indicatorconshdlr == NULL )
437  return SCIP_OKAY;
438 
439  /* check whether a new best solution has been found */
440  bestsol = SCIPgetBestSol(scip);
441  if ( bestsol == heurdata->lastsol )
442  return SCIP_OKAY;
443  heurdata->lastsol = bestsol;
444 
445  /* avoid solutions produced by this heuristic */
446  if ( SCIPsolGetHeur(bestsol) == heur )
447  return SCIP_OKAY;
448 
449  /* The heuristic will only be successful if there are no integral variables and no binary variables except the
450  * indicator variables. */
451  if ( SCIPgetNIntVars(scip) > 0 || SCIPconshdlrGetNConss(heurdata->indicatorconshdlr) < SCIPgetNBinVars(scip) )
452  return SCIP_OKAY;
453 
454  nindconss = SCIPconshdlrGetNConss(heurdata->indicatorconshdlr);
455  if ( nindconss == 0 )
456  return SCIP_OKAY;
457 
458  indconss = SCIPconshdlrGetConss(heurdata->indicatorconshdlr);
459  assert( indconss != NULL );
460 
461  /* fill solutin candidate */
462  SCIP_CALL( SCIPallocBufferArray(scip, &solcand, nindconss) );
463  for (i = 0; i < nindconss; ++i)
464  {
465  SCIP_VAR* binvar;
466  SCIP_Real val;
467 
468  solcand[i] = FALSE;
469  if ( SCIPconsIsActive(indconss[i]) )
470  {
471  binvar = SCIPgetBinaryVarIndicator(indconss[i]);
472  assert( binvar != NULL );
473 
474  val = SCIPgetSolVal(scip, bestsol, binvar);
475  assert( SCIPisFeasIntegral(scip, val) );
476  if ( val > 0.5 )
477  solcand[i] = TRUE;
478  }
479  }
480 
481  SCIPdebugMessage("Trying to improve best solution of value %f.\n", SCIPgetSolOrigObj(scip, bestsol) );
482 
483  /* try one-opt heuristic */
484  SCIP_CALL( tryOneOpt(scip, heur, heurdata, nindconss, indconss, solcand, &nfoundsols) );
485 
486  if ( nfoundsols > 0 )
487  *result = SCIP_FOUNDSOL;
488  else
489  *result = SCIP_DIDNOTFIND;
490 
491  SCIPfreeBufferArray(scip, &solcand);
492  }
493 
494  return SCIP_OKAY;
495 }
496 
497 
498 /*
499  * primal heuristic specific interface methods
500  */
501 
502 /** creates the indicator primal heuristic and includes it in SCIP */
504  SCIP* scip /**< SCIP data structure */
505  )
506 {
507  SCIP_HEURDATA* heurdata;
508  SCIP_HEUR* heur;
509 
510  /* create Indicator primal heuristic data */
511  SCIP_CALL( SCIPallocMemory(scip, &heurdata) );
512  heurdata->nindconss = 0;
513  heurdata->indconss = NULL;
514  heurdata->solcand = NULL;
515  heurdata->lastsol = NULL;
516  heurdata->indicatorconshdlr = NULL;
517 
518  /* include primal heuristic */
519  SCIP_CALL( SCIPincludeHeurBasic(scip, &heur,
521  HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecIndicator, heurdata) );
522 
523  assert( heur != NULL );
524 
525  /* set non-NULL pointers to callback methods */
526  SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyIndicator) );
527  SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitIndicator) );
528  SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeIndicator) );
529 
530  /* add parameters */
532  "heuristics/" HEUR_NAME "/oneopt",
533  "whether the one-opt heuristic should be started",
534  &heurdata->oneopt, TRUE, DEFAULT_ONEOPT, NULL, NULL) );
535 
537  "heuristics/" HEUR_NAME "/improvesols",
538  "Try to improve other solutions by one-opt?",
539  &heurdata->improvesols, TRUE, DEFAULT_IMPROVESOLS, NULL, NULL) );
540 
541  return SCIP_OKAY;
542 }
543 
544 
545 /** pass partial solution for indicator variables to heuristic */
547  SCIP* scip, /**< SCIP data structure */
548  SCIP_HEUR* heur, /**< indicator heuristic */
549  int nindconss, /**< number of indicator constraints */
550  SCIP_CONS** indconss, /**< indicator constraints */
551  SCIP_Bool* solcand /**< values for indicator variables in partial solution */
552  )
553 {
554  SCIP_HEURDATA* heurdata;
555 
556  assert( scip != NULL );
557  assert( heur != NULL );
558  assert( strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0 );
559  assert( nindconss > 0 );
560  assert( indconss != NULL );
561  assert( solcand != NULL );
562 
563  /* get heuristic's data */
564  heurdata = SCIPheurGetData(heur);
565  assert( heurdata != NULL );
566 
567  /* copy indicator information */
568  if ( heurdata->indconss != NULL )
569  SCIPfreeBlockMemoryArray(scip, &(heurdata->indconss), heurdata->nindconss);
570 
571  SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &(heurdata->indconss), indconss, nindconss) );
572  heurdata->nindconss = nindconss;
573 
574  /* copy partial solution */
575  if ( heurdata->solcand != NULL )
576  BMScopyMemoryArray(heurdata->solcand, solcand, nindconss);
577  else
578  SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &(heurdata->solcand), solcand, nindconss) );
579 
580  return SCIP_OKAY;
581 }
SCIP_RETCODE SCIPsolveProbingLP(SCIP *scip, int itlim, SCIP_Bool *lperror, SCIP_Bool *cutoff)
Definition: scip.c:32398
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition: scip.c:5847
SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
Definition: sol.c:2193
static SCIP_DECL_HEURCOPY(heurCopyIndicator)
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition: heur.c:1147
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition: scip.h:20402
SCIP_RETCODE SCIPsetHeurCopy(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURCOPY((*heurcopy)))
Definition: scip.c:7266
SCIP_RETCODE SCIPbacktrackProbing(SCIP *scip, int probingdepth)
Definition: scip.c:31860
#define HEUR_DESC
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip.c:1220
int SCIPgetSubscipDepth(SCIP *scip)
Definition: scip.c:3174
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4292
#define NULL
Definition: lpi_spx.cpp:130
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
Definition: var.c:17011
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4262
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
Definition: cons.c:7685
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:7221
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:32162
#define FALSE
Definition: def.h:53
SCIP_Real SCIPgetSolTransObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip.c:34723
int SCIPgetNBinVars(SCIP *scip)
Definition: scip.c:10780
#define TRUE
Definition: def.h:52
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
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:35909
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:41616
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
Definition: scip.c:26426
#define SCIPdebugMessage
Definition: pub_message.h:77
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
Definition: scip.c:34593
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip.h:20414
#define HEUR_MAXDEPTH
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip.c:34676
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:3516
#define HEUR_DISPCHAR
#define SCIPallocMemory(scip, ptr)
Definition: scip.h:20355
#define HEUR_TIMING
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip.h:20426
#define DEFAULT_ONEOPT
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
Definition: scip.h:20403
#define HEUR_PRIORITY
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip.c:33612
#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:263
void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
Definition: heur.c:1068
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
Definition: var.c:17021
#define SCIP_Bool
Definition: def.h:50
SCIP_RETCODE SCIPstartProbing(SCIP *scip)
Definition: scip.c:31763
#define BMScopyMemoryArray(ptr, source, num)
Definition: memory.h:89
SCIP_RETCODE SCIPincludeHeurIndicator(SCIP *scip)
SCIP_RETCODE SCIPendProbing(SCIP *scip)
Definition: scip.c:31895
SCIP_RETCODE SCIPlinkLPSol(SCIP *scip, SCIP_SOL *sol)
Definition: scip.c:34258
SCIP_RETCODE SCIPsetHeurInit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINIT((*heurinit)))
Definition: scip.c:7298
static SCIP_RETCODE tryOneOpt(SCIP *scip, SCIP_HEUR *heur, SCIP_HEURDATA *heurdata, int nindconss, SCIP_CONS **indconss, SCIP_Bool *solcand, int *nfoundsols)
#define SCIPfreeMemory(scip, ptr)
Definition: scip.h:20371
int SCIPgetNIntVars(SCIP *scip)
Definition: scip.c:10825
SCIP_RETCODE SCIPchgVarUbProbing(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip.c:31962
SCIP_RETCODE SCIPsetHeurFree(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree)))
Definition: scip.c:7282
#define SCIP_Real
Definition: def.h:124
SCIP_RETCODE SCIPnewProbingNode(SCIP *scip)
Definition: scip.c:31800
SCIP_RETCODE SCIPchgVarLbProbing(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip.c:31928
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
Definition: scip.h:20397
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 HEUR_USESSUBSCIP
static SCIP_DECL_HEUREXEC(heurExecIndicator)
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
Definition: scip.c:35377
#define HEUR_FREQOFS
SCIP callable library.
SCIP_RETCODE SCIPprintSol(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)
Definition: scip.c:35007