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