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-2019 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 visit 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 "blockmemshell/memory.h"
28 #include "scip/cons_indicator.h"
29 #include "scip/heur_indicator.h"
30 #include "scip/pub_cons.h"
31 #include "scip/pub_heur.h"
32 #include "scip/pub_message.h"
33 #include "scip/pub_sol.h"
34 #include "scip/pub_var.h"
35 #include "scip/scip_cons.h"
36 #include "scip/scip_copy.h"
37 #include "scip/scip_general.h"
38 #include "scip/scip_heur.h"
39 #include "scip/scip_lp.h"
40 #include "scip/scip_mem.h"
41 #include "scip/scip_message.h"
42 #include "scip/scip_numerics.h"
43 #include "scip/scip_param.h"
44 #include "scip/scip_prob.h"
45 #include "scip/scip_probing.h"
46 #include "scip/scip_sol.h"
47 #include "scip/scip_tree.h"
48 #include <string.h>
49 
50 #define HEUR_NAME "indicator"
51 #define HEUR_DESC "indicator heuristic to create feasible solutions from values for indicator variables"
52 #define HEUR_DISPCHAR 'A'
53 #define HEUR_PRIORITY -20200
54 #define HEUR_FREQ 1
55 #define HEUR_FREQOFS 0
56 #define HEUR_MAXDEPTH -1
57 #define HEUR_TIMING SCIP_HEURTIMING_DURINGLPLOOP
58 #define HEUR_USESSUBSCIP FALSE /**< does the heuristic use a secondary SCIP instance? */
59 
60 #define DEFAULT_ONEOPT FALSE /**< whether the one-opt heuristic should be started */
61 #define DEFAULT_IMPROVESOLS FALSE /**< Try to improve other solutions by one-opt? */
62 
63 
64 /** primal heuristic data */
65 struct SCIP_HeurData
66 {
67  int nindconss; /**< number of indicator constraints */
68  SCIP_CONS** indconss; /**< indicator constraints */
69  SCIP_Bool* solcand; /**< bitset of indicator variables in solution candidate */
70  SCIP_Real obj; /**< objective of previously stored solution */
71  SCIP_Bool oneopt; /**< whether the one-opt heuristic should be started */
72  SCIP_CONSHDLR* indicatorconshdlr; /**< indicator constraint handler */
73  SCIP_SOL* lastsol; /**< last solution considered for improvement */
74  SCIP_Bool improvesols; /**< Try to improve other solutions by one-opt? */
75 };
76 
77 /*
78  * Local methods
79  */
80 
81 /** try one-opt on given solution */
82 static
84  SCIP* scip, /**< SCIP data structure */
85  SCIP_HEUR* heur, /**< indicator heuristic */
86  SCIP_HEURDATA* heurdata, /**< heuristic data */
87  int nindconss, /**< number of indicator constraints */
88  SCIP_CONS** indconss, /**< indicator constraints */
89  SCIP_Bool* solcand, /**< values for indicator variables in partial solution */
90  int* nfoundsols /**< number of solutions found */
91  )
92 {
93  SCIP_Bool cutoff;
94  SCIP_Bool lperror;
95  SCIP_Bool stored;
96  SCIP_SOL* sol;
97  int cnt = 0;
98  int i;
99  int c;
100 
101  assert( scip != NULL );
102  assert( heur != NULL );
103  assert( heurdata != NULL );
104  assert( nindconss == 0 || indconss != NULL );
105  assert( solcand != NULL );
106  assert( nfoundsols != NULL );
107 
108  SCIPdebugMsg(scip, "Performing one-opt ...\n");
109  *nfoundsols = 0;
110 
111  SCIP_CALL( SCIPstartProbing(scip) );
112 
113  for (i = 0; i < nindconss && ! SCIPisStopped(scip); ++i)
114  {
115  SCIP_VAR* binvar;
116 
117  /* skip nonactive constraints */
118  if ( ! SCIPconsIsActive(indconss[i]) )
119  continue;
120 
121  binvar = SCIPgetBinaryVarIndicator(indconss[i]);
122  assert( binvar != NULL );
123 
124  /* skip constraints with fixed variables */
125  if ( SCIPvarGetUbLocal(binvar) < 0.5 || SCIPvarGetLbLocal(binvar) > 0.5 )
126  continue;
127 
128  /* return if the we would exceed the depth limit of the tree */
129  if( SCIP_MAXTREEDEPTH <= SCIPgetDepth(scip) )
130  break;
131 
132  if ( solcand[i] )
133  continue;
134 
135  /* get rid of all bound changes */
136  SCIP_CALL( SCIPnewProbingNode(scip) );
137  ++cnt;
138 
139  /* fix variables */
140  for (c = 0; c < nindconss; ++c)
141  {
142  SCIP_Bool s;
143 
144  /* skip nonactive constraints */
145  if ( ! SCIPconsIsActive(indconss[c]) )
146  continue;
147 
148  binvar = SCIPgetBinaryVarIndicator(indconss[c]);
149  assert( binvar != NULL );
150 
151  /* fix variables according to solution candidate, except constraint i */
152  if ( c == i )
153  s = ! solcand[c];
154  else
155  s = solcand[c];
156 
157  if ( ! s )
158  {
159  if ( SCIPvarGetLbLocal(binvar) < 0.5 && SCIPvarGetUbLocal(binvar) > 0.5 )
160  {
161  SCIP_CALL( SCIPchgVarLbProbing(scip, binvar, 1.0) );
162  }
163  }
164  else
165  {
166  if ( SCIPvarGetUbLocal(binvar) > 0.5 && SCIPvarGetLbLocal(binvar) < 0.5 )
167  {
168  SCIP_CALL( SCIPchgVarUbProbing(scip, binvar, 0.0) );
169  }
170  }
171  }
172 
173  /* propagate variables */
174  SCIP_CALL( SCIPpropagateProbing(scip, -1, &cutoff, NULL) );
175  if ( cutoff )
176  {
177  SCIP_CALL( SCIPbacktrackProbing(scip, 0) );
178  continue;
179  }
180 
181  /* solve LP to move continuous variables */
182  SCIP_CALL( SCIPsolveProbingLP(scip, -1, &lperror, &cutoff) );
183 
184  /* the LP often reaches the objective limit - we currently do not use such solutions */
185  if ( lperror || cutoff || SCIPgetLPSolstat(scip) != SCIP_LPSOLSTAT_OPTIMAL )
186  {
187 #ifdef SCIP_DEBUG
188  if ( lperror )
189  SCIPdebugMsg(scip, "An LP error occurred.\n");
190 #endif
191  SCIP_CALL( SCIPbacktrackProbing(scip, 0) );
192  continue;
193  }
194 
195  /* create solution */
196  SCIP_CALL( SCIPcreateSol(scip, &sol, heur) );
197 
198  /* copy the current LP solution to the working solution */
199  SCIP_CALL( SCIPlinkLPSol(scip, sol) );
200 
201  /* check solution for feasibility */
202  SCIPdebugMsg(scip, "One-opt found solution candidate with value %g.\n", SCIPgetSolTransObj(scip, sol));
203 
204  /* only check integrality, because we solved an LP */
205  SCIP_CALL( SCIPtrySolFree(scip, &sol, FALSE, FALSE, FALSE, TRUE, FALSE, &stored) );
206  if ( stored )
207  ++(*nfoundsols);
208  SCIP_CALL( SCIPbacktrackProbing(scip, 0) );
209  }
210  SCIP_CALL( SCIPendProbing(scip) );
211 
212  SCIPdebugMsg(scip, "Finished one-opt (tried variables: %d, found sols: %d).\n", cnt, *nfoundsols);
213 
214  return SCIP_OKAY;
215 }
216 
217 
218 /** try given solution */
219 static
221  SCIP* scip, /**< SCIP data structure */
222  SCIP_HEUR* heur, /**< indicator heuristic */
223  SCIP_HEURDATA* heurdata, /**< heuristic data */
224  int nindconss, /**< number of indicator constraints */
225  SCIP_CONS** indconss, /**< indicator constraints */
226  SCIP_Bool* solcand, /**< values for indicator variables in partial solution */
227  int* nfoundsols /**< number of solutions found */
228  )
229 {
230  SCIP_Bool cutoff;
231  SCIP_Bool lperror;
232  SCIP_Bool stored;
233  SCIP_SOL* sol;
234  int c;
235 
236  assert( scip != NULL );
237  assert( heur != NULL );
238  assert( heurdata != NULL );
239  assert( nindconss == 0 || indconss != NULL );
240  assert( solcand != NULL );
241  assert( nfoundsols != NULL );
242 
243  SCIPdebugMsg(scip, "Trying to generate feasible solution with indicators from solution candidate (obj: %f) ...\n", heurdata->obj);
244  *nfoundsols = 0;
245 
246  SCIP_CALL( SCIPstartProbing(scip) );
247 
248  /* we can stop here if we have already reached the maximal depth */
249  if( SCIP_MAXTREEDEPTH <= SCIPgetDepth(scip) )
250  {
251  SCIP_CALL( SCIPendProbing(scip) );
252  return SCIP_OKAY;
253  }
254 
255  SCIP_CALL( SCIPnewProbingNode(scip) );
256 
257  /* fix variables */
258  for (c = 0; c < nindconss; ++c)
259  {
260  SCIP_VAR* binvar;
261 
262  /* skip nonactive constraints */
263  if ( ! SCIPconsIsActive(indconss[c]) )
264  continue;
265 
266  binvar = SCIPgetBinaryVarIndicator(indconss[c]);
267  assert( binvar != NULL );
268 
269  /* Fix binary variables not in cover to 1 and corresponding slack variables to 0. The other binary variables are fixed to 0. */
270  if ( ! solcand[c] )
271  {
272  /* to be sure, check for non-fixed variables */
273  if ( SCIPvarGetLbLocal(binvar) < 0.5 && SCIPvarGetUbLocal(binvar) > 0.5 )
274  {
275  SCIP_CALL( SCIPchgVarLbProbing(scip, binvar, 1.0) );
276  }
277  }
278  else
279  {
280  if ( SCIPvarGetUbLocal(binvar) > 0.5 && SCIPvarGetLbLocal(binvar) < 0.5 )
281  {
282  SCIP_CALL( SCIPchgVarUbProbing(scip, binvar, 0.0) );
283  }
284  }
285  }
286 
287  /* propagate variables */
288  SCIP_CALL( SCIPpropagateProbing(scip, -1, &cutoff, NULL) );
289  if ( cutoff )
290  {
291  SCIPdebugMsg(scip, "Solution candidate reaches cutoff (in propagation).\n");
292  SCIP_CALL( SCIPendProbing(scip) );
293  return SCIP_OKAY;
294  }
295 
296  /* solve LP to move continuous variables */
297  SCIP_CALL( SCIPsolveProbingLP(scip, -1, &lperror, &cutoff) );
298 
299  /* the LP often reaches the objective limit - we currently do not use such solutions */
300  if ( lperror || cutoff || SCIPgetLPSolstat(scip) != SCIP_LPSOLSTAT_OPTIMAL )
301  {
302 #ifdef SCIP_DEBUG
303  if ( lperror )
304  {
305  SCIPdebugMsg(scip, "An LP error occurred.\n");
306  }
307  else
308  {
309  SCIPdebugMsg(scip, "Solution candidate reaches cutoff (in LP solving).\n");
310  }
311 #endif
312  SCIP_CALL( SCIPendProbing(scip) );
313  return SCIP_OKAY;
314  }
315 
316  /* create solution */
317  SCIP_CALL( SCIPcreateSol(scip, &sol, heur) );
318 
319  /* copy the current LP solution to the working solution */
320  SCIP_CALL( SCIPlinkLPSol(scip, sol) );
321 
322  /* check solution for feasibility */
323 #ifdef SCIP_DEBUG
324  SCIPdebugMsg(scip, "Found solution candidate with value %g.\n", SCIPgetSolTransObj(scip, sol));
325 #ifdef SCIP_MORE_DEBUG
326  SCIP_CALL( SCIPprintSol(scip, sol, NULL, FALSE) );
327 #endif
328  SCIP_CALL( SCIPtrySolFree(scip, &sol, TRUE, TRUE, TRUE, TRUE, TRUE, &stored) );
329  if ( stored )
330  {
331  ++(*nfoundsols);
332  SCIPdebugMsg(scip, "Solution is feasible and stored.\n");
333  }
334  else
335  SCIPdebugMsg(scip, "Solution was not stored.\n");
336 #else
337  /* only check integrality, because we solved an LP */
338  SCIP_CALL( SCIPtrySolFree(scip, &sol, FALSE, FALSE, FALSE, TRUE, FALSE, &stored) );
339  if ( stored )
340  ++(*nfoundsols);
341 #endif
342  SCIP_CALL( SCIPendProbing(scip) );
343 
344  /* possibly perform one-opt */
345  if ( stored && heurdata->oneopt )
346  {
347  int nfound = 0;
348  assert( *nfoundsols > 0 );
349  SCIP_CALL( tryOneOpt(scip, heur, heurdata, nindconss, indconss, solcand, &nfound) );
350  }
351 
352  return SCIP_OKAY;
353 }
354 
355 
356 /*
357  * Callback methods of primal heuristic
358  */
359 
360 /** copy method for primal heuristic plugins (called when SCIP copies plugins) */
361 static
362 SCIP_DECL_HEURCOPY(heurCopyIndicator)
363 { /*lint --e{715}*/
364  assert( scip != NULL );
365  assert( heur != NULL );
366  assert( strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0 );
367 
368  /* call inclusion method of primal heuristic */
370 
371  return SCIP_OKAY;
372 }
373 
374 /** initialization method of primal heuristic (called after problem was transformed) */
375 static
376 SCIP_DECL_HEURINIT(heurInitIndicator)
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  if ( heurdata->indicatorconshdlr == NULL )
388  {
389  heurdata->indicatorconshdlr = SCIPfindConshdlr(scip, "indicator");
390  if ( heurdata->indicatorconshdlr == NULL )
391  {
392  SCIPwarningMessage(scip, "Could not find indicator constraint handler.\n");
393  }
394  }
395 
396  return SCIP_OKAY;
397 }
398 
399 /** destructor of primal heuristic to free user data (called when SCIP is exiting) */
400 static
401 SCIP_DECL_HEURFREE(heurFreeIndicator)
402 { /*lint --e{715}*/
403  SCIP_HEURDATA* heurdata;
404 
405  assert( heur != NULL );
406  assert( scip != NULL );
407 
408  /* get heuristic data */
409  heurdata = SCIPheurGetData(heur);
410  assert( heurdata != NULL );
411 
412  SCIPfreeBlockMemoryArrayNull(scip, &(heurdata->indconss), heurdata->nindconss);
413  SCIPfreeBlockMemoryArrayNull(scip, &(heurdata->solcand), heurdata->nindconss);
414 
415  /* free heuristic data */
416  SCIPfreeBlockMemory(scip, &heurdata);
417  SCIPheurSetData(heur, NULL);
418 
419  return SCIP_OKAY;
420 }
421 
422 
423 /** execution method of primal heuristic */
424 static
425 SCIP_DECL_HEUREXEC(heurExecIndicator)
426 { /*lint --e{715}*/
427  SCIP_HEURDATA* heurdata;
428  int nfoundsols = 0;
429 
430  assert( heur != NULL );
431  assert( scip != NULL );
432  assert( result != NULL );
433 
434  *result = SCIP_DIDNOTRUN;
435 
436  if ( SCIPgetSubscipDepth(scip) > 0 )
437  return SCIP_OKAY;
438 
439  /* get heuristic's data */
440  heurdata = SCIPheurGetData(heur);
441  assert( heurdata != NULL );
442 
443  /* call heuristic, if solution candidate is available */
444  if ( heurdata->solcand != NULL )
445  {
446  assert( heurdata->nindconss > 0 );
447  assert( heurdata->indconss != NULL );
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 || heurdata->nindconss < SCIPgetNBinVars(scip) )
452  return SCIP_OKAY;
453 
454  SCIP_CALL( trySolCandidate(scip, heur, heurdata, heurdata->nindconss, heurdata->indconss, heurdata->solcand, &nfoundsols) );
455 
456  if ( nfoundsols > 0 )
457  *result = SCIP_FOUNDSOL;
458  else
459  *result = SCIP_DIDNOTFIND;
460 
461  /* free memory */
462  SCIPfreeBlockMemoryArray(scip, &(heurdata->solcand), heurdata->nindconss);
463  SCIPfreeBlockMemoryArray(scip, &(heurdata->indconss), heurdata->nindconss);
464  }
465 
466  /* try to improve solutions generated by other heuristics */
467  if ( heurdata->improvesols )
468  {
469  SCIP_CONS** indconss;
470  SCIP_Bool* solcand;
471  SCIP_SOL* bestsol;
472  int nindconss;
473  int i;
474 
475  if ( heurdata->indicatorconshdlr == NULL )
476  return SCIP_OKAY;
477 
478  /* check whether a new best solution has been found */
479  bestsol = SCIPgetBestSol(scip);
480  if ( bestsol == heurdata->lastsol )
481  return SCIP_OKAY;
482  heurdata->lastsol = bestsol;
483 
484  /* avoid solutions produced by this heuristic */
485  if ( SCIPsolGetHeur(bestsol) == heur )
486  return SCIP_OKAY;
487 
488  /* The heuristic will only be successful if there are no integral variables and no binary variables except the
489  * indicator variables. */
490  nindconss = SCIPconshdlrGetNConss(heurdata->indicatorconshdlr);
491  if ( SCIPgetNIntVars(scip) > 0 || nindconss < SCIPgetNBinVars(scip) )
492  return SCIP_OKAY;
493 
494  if ( nindconss == 0 )
495  return SCIP_OKAY;
496 
497  indconss = SCIPconshdlrGetConss(heurdata->indicatorconshdlr);
498  assert( indconss != NULL );
499 
500  /* fill solution candidate */
501  SCIP_CALL( SCIPallocBufferArray(scip, &solcand, nindconss) );
502  for (i = 0; i < nindconss; ++i)
503  {
504  SCIP_VAR* binvar;
505  SCIP_Real val;
506 
507  solcand[i] = FALSE;
508  if ( SCIPconsIsActive(indconss[i]) )
509  {
510  binvar = SCIPgetBinaryVarIndicator(indconss[i]);
511  assert( binvar != NULL );
512 
513  val = SCIPgetSolVal(scip, bestsol, binvar);
514  assert( SCIPisFeasIntegral(scip, val) );
515  if ( val > 0.5 )
516  solcand[i] = TRUE;
517  }
518  }
519 
520  SCIPdebugMsg(scip, "Trying to improve best solution of value %f.\n", SCIPgetSolOrigObj(scip, bestsol) );
521 
522  /* try one-opt heuristic */
523  SCIP_CALL( tryOneOpt(scip, heur, heurdata, nindconss, indconss, solcand, &nfoundsols) );
524 
525  if ( nfoundsols > 0 )
526  *result = SCIP_FOUNDSOL;
527  else
528  *result = SCIP_DIDNOTFIND;
529 
530  SCIPfreeBufferArray(scip, &solcand);
531  }
532 
533  return SCIP_OKAY;
534 }
535 
536 
537 /*
538  * primal heuristic specific interface methods
539  */
540 
541 /** creates the indicator primal heuristic and includes it in SCIP */
543  SCIP* scip /**< SCIP data structure */
544  )
545 {
546  SCIP_HEURDATA* heurdata;
547  SCIP_HEUR* heur;
548 
549  /* create Indicator primal heuristic data */
550  SCIP_CALL( SCIPallocBlockMemory(scip, &heurdata) );
551  heurdata->nindconss = 0;
552  heurdata->indconss = NULL;
553  heurdata->solcand = NULL;
554  heurdata->lastsol = NULL;
555  heurdata->indicatorconshdlr = NULL;
556  heurdata->obj = SCIPinfinity(scip);
557 
558  /* include primal heuristic */
559  SCIP_CALL( SCIPincludeHeurBasic(scip, &heur,
561  HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecIndicator, heurdata) );
562 
563  assert( heur != NULL );
564 
565  /* set non-NULL pointers to callback methods */
566  SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyIndicator) );
567  SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitIndicator) );
568  SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeIndicator) );
569 
570  /* add parameters */
572  "heuristics/" HEUR_NAME "/oneopt",
573  "whether the one-opt heuristic should be started",
574  &heurdata->oneopt, TRUE, DEFAULT_ONEOPT, NULL, NULL) );
575 
577  "heuristics/" HEUR_NAME "/improvesols",
578  "Try to improve other solutions by one-opt?",
579  &heurdata->improvesols, TRUE, DEFAULT_IMPROVESOLS, NULL, NULL) );
580 
581  return SCIP_OKAY;
582 }
583 
584 
585 /** pass partial solution for indicator variables to heuristic */
587  SCIP* scip, /**< SCIP data structure */
588  SCIP_HEUR* heur, /**< indicator heuristic */
589  int nindconss, /**< number of indicator constraints */
590  SCIP_CONS** indconss, /**< indicator constraints */
591  SCIP_Bool* solcand, /**< values for indicator variables in partial solution */
592  SCIP_Real obj /**< objective of solution */
593  )
594 {
595  SCIP_HEURDATA* heurdata;
596 
597  assert( scip != NULL );
598  assert( heur != NULL );
599  assert( strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0 );
600  assert( nindconss > 0 );
601  assert( indconss != NULL );
602  assert( solcand != NULL );
603 
604  /* get heuristic's data */
605  heurdata = SCIPheurGetData(heur);
606  assert( heurdata != NULL );
607 
608  if ( obj >= heurdata->obj )
609  return SCIP_OKAY;
610 
611  /* copy indicator information */
612  if ( heurdata->indconss != NULL )
613  SCIPfreeBlockMemoryArray(scip, &(heurdata->indconss), heurdata->nindconss);
614 
615  SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &(heurdata->indconss), indconss, nindconss) );
616  heurdata->nindconss = nindconss;
617 
618  /* copy partial solution */
619  if ( heurdata->solcand != NULL )
620  BMScopyMemoryArray(heurdata->solcand, solcand, nindconss);
621  else
622  SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &(heurdata->solcand), solcand, nindconss) );
623  heurdata->obj = obj;
624 
625  return SCIP_OKAY;
626 }
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition: scip_mem.h:97
#define NULL
Definition: def.h:253
SCIP_Bool SCIPisStopped(SCIP *scip)
Definition: scip_general.c:686
static SCIP_DECL_HEURCOPY(heurCopyIndicator)
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition: scip_cons.c:876
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition: heur.c:1254
public methods for SCIP parameter handling
SCIP_RETCODE SCIPnewProbingNode(SCIP *scip)
Definition: scip_probing.c:155
public methods for memory management
SCIP_HEURDATA * SCIPheurGetData(SCIP_HEUR *heur)
Definition: heur.c:1165
#define HEUR_DESC
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip_message.c:122
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
Definition: scip_sol.c:1352
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4593
constraint handler for indicator constraints
static SCIP_DECL_HEURINIT(heurInitIndicator)
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
Definition: cons.c:8137
#define FALSE
Definition: def.h:73
SCIP_EXPORT SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
Definition: sol.c:2553
#define TRUE
Definition: def.h:72
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_RETCODE SCIPlinkLPSol(SCIP *scip, SCIP_SOL *sol)
Definition: scip_sol.c:1017
struct SCIP_HeurData SCIP_HEURDATA
Definition: type_heur.h:51
public methods for problem variables
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip_param.c:47
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip_mem.h:95
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:123
#define HEUR_MAXDEPTH
#define SCIPallocBlockMemory(scip, ptr)
Definition: scip_mem.h:78
SCIP_RETCODE SCIPsetHeurInit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINIT((*heurinit)))
Definition: scip_heur.c:184
#define SCIPdebugMsg
Definition: scip_message.h:69
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
Definition: scip_lp.c:158
int SCIPgetNIntVars(SCIP *scip)
Definition: scip_prob.c:2077
public methods for numerical tolerances
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip_sol.c:319
static SCIP_DECL_HEURFREE(heurFreeIndicator)
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_heur.c:107
public methods for the branch-and-bound tree
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
Definition: scip_mem.h:92
#define HEUR_DISPCHAR
public methods for managing constraints
SCIP_RETCODE SCIPincludeHeurIndicator(SCIP *scip)
#define HEUR_TIMING
#define DEFAULT_ONEOPT
#define HEUR_PRIORITY
SCIP_VAR * SCIPgetBinaryVarIndicator(SCIP_CONS *cons)
void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
Definition: heur.c:1175
SCIP_RETCODE SCIPendProbing(SCIP *scip)
Definition: scip_probing.c:250
public methods for problem copies
public methods for primal CIP solutions
#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:365
SCIP_RETCODE SCIPbacktrackProbing(SCIP *scip, int probingdepth)
Definition: scip_probing.c:215
public methods for primal heuristic plugins and divesets
public methods for constraint handler plugins and constraints
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:111
SCIP_Real SCIPinfinity(SCIP *scip)
int SCIPgetDepth(SCIP *scip)
Definition: scip_tree.c:637
#define SCIP_Bool
Definition: def.h:70
SCIP_RETCODE SCIPpropagateProbing(SCIP *scip, int maxproprounds, SCIP_Bool *cutoff, SCIP_Longint *ndomredsfound)
Definition: scip_probing.c:565
#define BMScopyMemoryArray(ptr, source, num)
Definition: memory.h:124
SCIP_EXPORT SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
Definition: var.c:17408
#define SCIP_MAXTREEDEPTH
Definition: def.h:301
public methods for the LP relaxation, rows and columns
SCIP_EXPORT SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
Definition: var.c:17418
static SCIP_RETCODE tryOneOpt(SCIP *scip, SCIP_HEUR *heur, SCIP_HEURDATA *heurdata, int nindconss, SCIP_CONS **indconss, SCIP_Bool *solcand, int *nfoundsols)
general public methods
public methods for solutions
public methods for the probing mode
SCIP_RETCODE SCIPsetHeurCopy(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURCOPY((*heurcopy)))
Definition: scip_heur.c:152
SCIP_RETCODE SCIPstartProbing(SCIP *scip)
Definition: scip_probing.c:109
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4563
public methods for message output
SCIP_Real SCIPgetSolTransObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip_sol.c:1482
SCIP_RETCODE SCIPchgVarLbProbing(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip_probing.c:291
SCIP_RETCODE SCIPprintSol(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)
Definition: scip_sol.c:1766
#define SCIP_Real
Definition: def.h:164
SCIP_RETCODE SCIPheurPassIndicator(SCIP *scip, SCIP_HEUR *heur, int nindconss, SCIP_CONS **indconss, SCIP_Bool *solcand, SCIP_Real obj)
SCIP_RETCODE SCIPchgVarUbProbing(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip_probing.c:335
public methods for message handling
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
int SCIPgetNBinVars(SCIP *scip)
Definition: scip_prob.c:2032
SCIP_RETCODE SCIPsetHeurFree(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree)))
Definition: scip_heur.c:168
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
Definition: scip_mem.h:98
public methods for primal heuristics
#define HEUR_USESSUBSCIP
static SCIP_DECL_HEUREXEC(heurExecIndicator)
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_sol.c:3218
public methods for global and local (sub)problems
#define HEUR_FREQOFS
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
Definition: scip_sol.c:2304
int SCIPgetSubscipDepth(SCIP *scip)
Definition: scip_copy.c:2289
SCIP_RETCODE SCIPsolveProbingLP(SCIP *scip, int itlim, SCIP_Bool *lperror, SCIP_Bool *cutoff)
Definition: scip_probing.c:801
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip_sol.c:1435
memory allocation routines