SCIP Doxygen Documentation
Loading...
Searching...
No Matches
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-2026 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25/**@file heur_indicator.c
26 * @ingroup DEFPLUGINS_HEUR
27 * @brief handle partial solutions for linear problems with indicators and otherwise continuous variables
28 * @author Marc Pfetsch
29 *
30 * For linear problems with indicators and otherwise continuous variables, the indicator constraint handler can produce
31 * partial solutions, i.e., values for the indicator variables. This partial solution can be passed to this heuristic,
32 * which then fixes these values and solves an LP. Additionally a local search for a better solution is added.
33 */
34
35/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
36
38#include "scip/cons_indicator.h"
39#include "scip/heur_indicator.h"
40#include "scip/pub_cons.h"
41#include "scip/pub_heur.h"
42#include "scip/pub_message.h"
43#include "scip/pub_sol.h"
44#include "scip/pub_var.h"
45#include "scip/scip_cons.h"
46#include "scip/scip_copy.h"
47#include "scip/scip_general.h"
48#include "scip/scip_heur.h"
49#include "scip/scip_lp.h"
50#include "scip/scip_mem.h"
51#include "scip/scip_message.h"
52#include "scip/scip_numerics.h"
53#include "scip/scip_param.h"
54#include "scip/scip_prob.h"
55#include "scip/scip_probing.h"
56#include "scip/scip_sol.h"
57#include "scip/scip_tree.h"
58#include <string.h>
59
60#define HEUR_NAME "indicator"
61#define HEUR_DESC "indicator heuristic to create feasible solutions from values for indicator variables"
62#define HEUR_DISPCHAR SCIP_HEURDISPCHAR_LNS
63#define HEUR_PRIORITY -20200
64#define HEUR_FREQ 1
65#define HEUR_FREQOFS 0
66#define HEUR_MAXDEPTH -1
67#define HEUR_TIMING SCIP_HEURTIMING_DURINGLPLOOP
68#define HEUR_USESSUBSCIP FALSE /**< does the heuristic use a secondary SCIP instance? */
69
70#define DEFAULT_ONEOPT FALSE /**< whether the one-opt heuristic should be started */
71#define DEFAULT_IMPROVESOLS FALSE /**< Try to improve other solutions by one-opt? */
72
73
74/** primal heuristic data */
75struct SCIP_HeurData
76{
77 int nindconss; /**< number of indicator constraints */
78 SCIP_CONS** indconss; /**< indicator constraints */
79 SCIP_Bool* solcand; /**< bitset of indicator variables in solution candidate */
80 SCIP_Real obj; /**< objective of previously stored solution */
81 SCIP_Bool oneopt; /**< whether the one-opt heuristic should be started */
82 SCIP_CONSHDLR* indicatorconshdlr; /**< indicator constraint handler */
83 SCIP_SOL* lastsol; /**< last solution considered for improvement */
84 SCIP_Bool improvesols; /**< Try to improve other solutions by one-opt? */
85 SCIP_HEURTIMING inittiming; /**< initial heuristic timing */
86};
87
88/*
89 * Local methods
90 */
91
92/** try one-opt on given solution */
93static
95 SCIP* scip, /**< SCIP data structure */
96 SCIP_HEUR* heur, /**< indicator heuristic */
97 SCIP_HEURDATA* heurdata, /**< heuristic data */
98 int nindconss, /**< number of indicator constraints */
99 SCIP_CONS** indconss, /**< indicator constraints */
100 SCIP_Bool* solcand, /**< values for indicator variables in partial solution */
101 int* nfoundsols /**< number of solutions found */
102 )
103{
106 SCIP_Bool stored;
107 SCIP_SOL* sol;
108 int cnt = 0;
109 int i;
110 int c;
111
112 assert( scip != NULL );
113 assert( heur != NULL );
114 assert( heurdata != NULL );
115 assert( nindconss == 0 || indconss != NULL );
116 assert( solcand != NULL );
117 assert( nfoundsols != NULL );
118
119 SCIPdebugMsg(scip, "Performing one-opt ...\n");
120 *nfoundsols = 0;
121
123
124 for (i = 0; i < nindconss && ! SCIPisStopped(scip); ++i)
125 {
126 SCIP_VAR* binvar;
127
128 /* skip nonactive constraints */
129 if ( ! SCIPconsIsActive(indconss[i]) )
130 continue;
131
132 binvar = SCIPgetBinaryVarIndicator(indconss[i]);
133 assert( binvar != NULL );
134
135 /* skip constraints with fixed variables */
136 if ( SCIPvarGetUbLocal(binvar) < 0.5 || SCIPvarGetLbLocal(binvar) > 0.5 )
137 continue;
138
139 /* return if the we would exceed the depth limit of the tree */
141 break;
142
143 if ( solcand[i] )
144 continue;
145
146 /* get rid of all bound changes */
148 ++cnt;
149
150 /* fix variables */
151 for (c = 0; c < nindconss; ++c)
152 {
153 SCIP_Bool s;
154
155 /* skip nonactive constraints */
156 if ( ! SCIPconsIsActive(indconss[c]) )
157 continue;
158
159 binvar = SCIPgetBinaryVarIndicator(indconss[c]);
160 assert( binvar != NULL );
161
162 /* fix variables according to solution candidate, except constraint i */
163 if ( c == i )
164 s = ! solcand[c];
165 else
166 s = solcand[c];
167
168 if ( ! s )
169 {
170 if ( SCIPvarGetLbLocal(binvar) < 0.5 && SCIPvarGetUbLocal(binvar) > 0.5 )
171 {
172 SCIP_CALL( SCIPchgVarLbProbing(scip, binvar, 1.0) );
173 }
174 }
175 else
176 {
177 if ( SCIPvarGetUbLocal(binvar) > 0.5 && SCIPvarGetLbLocal(binvar) < 0.5 )
178 {
179 SCIP_CALL( SCIPchgVarUbProbing(scip, binvar, 0.0) );
180 }
181 }
182 }
183
184 /* propagate variables */
186 if ( cutoff )
187 {
189 continue;
190 }
191
192 /* solve LP to move continuous variables */
194
195 /* the LP often reaches the objective limit - we currently do not use such solutions */
197 {
198#ifdef SCIP_DEBUG
199 if ( lperror )
200 SCIPdebugMsg(scip, "An LP error occurred.\n");
201#endif
203 continue;
204 }
205
206 /* create solution */
207 SCIP_CALL( SCIPcreateSol(scip, &sol, heur) );
208
209 /* copy the current LP solution to the working solution */
211
212 /* check solution for feasibility */
213 SCIPdebugMsg(scip, "One-opt found solution candidate with value %g.\n", SCIPgetSolTransObj(scip, sol));
214
215 /* only check integrality, because we solved an LP */
217 if ( stored )
218 ++(*nfoundsols);
220 }
222
223 SCIPdebugMsg(scip, "Finished one-opt (tried variables: %d, found sols: %d).\n", cnt, *nfoundsols);
224
225 return SCIP_OKAY;
226}
227
228
229/** try given solution */
230static
232 SCIP* scip, /**< SCIP data structure */
233 SCIP_HEUR* heur, /**< indicator heuristic */
234 SCIP_HEURDATA* heurdata, /**< heuristic data */
235 int nindconss, /**< number of indicator constraints */
236 SCIP_CONS** indconss, /**< indicator constraints */
237 SCIP_Bool* solcand, /**< values for indicator variables in partial solution */
238 int* nfoundsols /**< number of solutions found */
239 )
240{
243 SCIP_Bool stored;
244 SCIP_SOL* sol;
245 int c;
246
247 assert( scip != NULL );
248 assert( heur != NULL );
249 assert( heurdata != NULL );
250 assert( nindconss == 0 || indconss != NULL );
251 assert( solcand != NULL );
252 assert( nfoundsols != NULL );
253
254 SCIPdebugMsg(scip, "Trying to generate feasible solution with indicators from solution candidate (obj: %f) ...\n", heurdata->obj);
255 *nfoundsols = 0;
256
258
259 /* we can stop here if we have already reached the maximal depth */
261 {
263 return SCIP_OKAY;
264 }
265
267
268 /* fix variables */
269 for (c = 0; c < nindconss; ++c)
270 {
271 SCIP_VAR* binvar;
272
273 /* skip nonactive constraints */
274 if ( ! SCIPconsIsActive(indconss[c]) )
275 continue;
276
277 binvar = SCIPgetBinaryVarIndicator(indconss[c]);
278 assert( binvar != NULL );
279
280 /* Fix binary variables not in cover to 1 and corresponding slack variables to 0. The other binary variables are fixed to 0. */
281 if ( ! solcand[c] )
282 {
283 /* to be sure, check for non-fixed variables */
284 if ( SCIPvarGetLbLocal(binvar) < 0.5 && SCIPvarGetUbLocal(binvar) > 0.5 )
285 {
286 SCIP_CALL( SCIPchgVarLbProbing(scip, binvar, 1.0) );
287 }
288 }
289 else
290 {
291 if ( SCIPvarGetUbLocal(binvar) > 0.5 && SCIPvarGetLbLocal(binvar) < 0.5 )
292 {
293 SCIP_CALL( SCIPchgVarUbProbing(scip, binvar, 0.0) );
294 }
295 }
296 }
297
298 /* propagate variables */
300 if ( cutoff )
301 {
302 SCIPdebugMsg(scip, "Solution candidate reaches cutoff (in propagation).\n");
304 return SCIP_OKAY;
305 }
306
307 /* solve LP to move continuous variables */
309
310 /* the LP often reaches the objective limit - we currently do not use such solutions */
312 {
313#ifdef SCIP_DEBUG
314 if ( lperror )
315 {
316 SCIPdebugMsg(scip, "An LP error occurred.\n");
317 }
318 else
319 {
320 SCIPdebugMsg(scip, "Solution candidate reaches cutoff (in LP solving).\n");
321 }
322#endif
324 return SCIP_OKAY;
325 }
326
327 /* create solution */
328 SCIP_CALL( SCIPcreateSol(scip, &sol, heur) );
329
330 /* copy the current LP solution to the working solution */
332
333 /* check solution for feasibility */
334#ifdef SCIP_DEBUG
335 SCIPdebugMsg(scip, "Found solution candidate with value %g.\n", SCIPgetSolTransObj(scip, sol));
336#ifdef SCIP_MORE_DEBUG
338#endif
339 SCIP_CALL( SCIPtrySolFree(scip, &sol, TRUE, TRUE, TRUE, TRUE, TRUE, &stored) );
340 if ( stored )
341 {
342 ++(*nfoundsols);
343 SCIPdebugMsg(scip, "Solution is feasible and stored.\n");
344 }
345 else
346 SCIPdebugMsg(scip, "Solution was not stored.\n");
347#else
348 /* only check integrality, because we solved an LP */
350 if ( stored )
351 ++(*nfoundsols);
352#endif
354
355 /* possibly perform one-opt */
356 if ( stored && heurdata->oneopt )
357 {
358 int nfound = 0;
359 assert( *nfoundsols > 0 );
360 SCIP_CALL( tryOneOpt(scip, heur, heurdata, nindconss, indconss, solcand, &nfound) );
361 }
362
363 return SCIP_OKAY;
364}
365
366
367/*
368 * Callback methods of primal heuristic
369 */
370
371/** copy method for primal heuristic plugins (called when SCIP copies plugins) */
372static
373SCIP_DECL_HEURCOPY(heurCopyIndicator)
374{ /*lint --e{715}*/
375 assert( scip != NULL );
376 assert( heur != NULL );
377 assert( strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0 );
378
379 /* call inclusion method of primal heuristic */
381
382 return SCIP_OKAY;
383}
384
385/** solving process initialization method of primal heuristic (called when branch and bound process is about to begin) */
386static
387SCIP_DECL_HEURINITSOL(heurInitsolIndicator)
388{ /*lint --e{715}*/
390
391 assert( scip != NULL );
392 assert( strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0 );
393
394 /* get heuristic data */
396 assert( heurdata != NULL );
397
398 /* find indicator handler */
399 heurdata->indicatorconshdlr = SCIPfindConshdlr(scip, "indicator");
400
401 /* store indicator timing */
402 heurdata->inittiming = SCIPheurGetTimingmask(heur);
403
404 /* disable indicator heuristic, enabled when indicators are passed */
405 if ( heurdata->indicatorconshdlr == NULL || SCIPconshdlrGetNConss(heurdata->indicatorconshdlr) == 0 || SCIPgetSubscipDepth(scip) > 0 )
407
408 return SCIP_OKAY;
409}
410
411/** solving process deinitialization method of primal heuristic (called before branch and bound process data is freed) */
412static
413SCIP_DECL_HEUREXITSOL(heurExitsolIndicator)
414{ /*lint --e{715}*/
416
417 assert( scip != NULL );
418 assert( strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0 );
419
420 /* get heuristic data */
422 assert( heurdata != NULL );
423
424 /* reset indicator timing */
425 SCIPheurSetTimingmask(heur, heurdata->inittiming);
426
427 return SCIP_OKAY;
428}
429
430/** destructor of primal heuristic to free user data (called when SCIP is exiting) */
431static
432SCIP_DECL_HEURFREE(heurFreeIndicator)
433{ /*lint --e{715}*/
435
436 assert( heur != NULL );
437 assert( scip != NULL );
438
439 /* get heuristic data */
441 assert( heurdata != NULL );
442
443 SCIPfreeBlockMemoryArrayNull(scip, &(heurdata->indconss), heurdata->nindconss);
444 SCIPfreeBlockMemoryArrayNull(scip, &(heurdata->solcand), heurdata->nindconss);
445
446 /* free heuristic data */
448 SCIPheurSetData(heur, NULL);
449
450 return SCIP_OKAY;
451}
452
453
454/** execution method of primal heuristic */
455static
456SCIP_DECL_HEUREXEC(heurExecIndicator)
457{ /*lint --e{715}*/
459 int nindconss;
460 int nfoundsols;
461
462 assert( scip != NULL );
463 assert( heur != NULL );
464 assert( result != NULL );
465
467
468 /* get heuristic's data */
470 assert( heurdata != NULL );
471 assert( heurdata->indicatorconshdlr != NULL );
472 nindconss = heurdata->solcand == NULL ? SCIPconshdlrGetNConss(heurdata->indicatorconshdlr) : heurdata->nindconss;
473
474 /* the heuristic will only be successful if there are indicator constraints, no binary variables except for the
475 * indicator variables, and no integral variables */
476 if ( nindconss == 0
479 return SCIP_OKAY;
480
481 /* call heuristic if solution candidate is available */
482 if ( heurdata->solcand != NULL )
483 {
484 assert( heurdata->indconss != NULL );
485
486 SCIP_CALL( trySolCandidate(scip, heur, heurdata, nindconss, heurdata->indconss, heurdata->solcand, &nfoundsols) );
487
488 if ( nfoundsols > 0 )
490 else
492
493 /* free memory */
494 SCIPfreeBlockMemoryArray(scip, &(heurdata->solcand), nindconss);
495 SCIPfreeBlockMemoryArray(scip, &(heurdata->indconss), nindconss);
496 }
497
498 /* try to improve solutions generated by other heuristics */
499 if ( heurdata->improvesols )
500 {
501 SCIP_CONS** indconss;
502 SCIP_Bool* solcand;
503 SCIP_SOL* bestsol;
504 int i;
505
506 /* check whether a new best solution has been found */
507 bestsol = SCIPgetBestSol(scip);
508 if ( bestsol == heurdata->lastsol )
509 return SCIP_OKAY;
510 heurdata->lastsol = bestsol;
511
512 /* avoid solutions produced by this heuristic */
513 if ( SCIPsolGetHeur(bestsol) == heur )
514 return SCIP_OKAY;
515
516 indconss = SCIPconshdlrGetConss(heurdata->indicatorconshdlr);
517 assert( indconss != NULL );
518
519 /* fill solution candidate */
520 SCIP_CALL( SCIPallocBufferArray(scip, &solcand, nindconss) );
521 for (i = 0; i < nindconss; ++i)
522 {
523 SCIP_VAR* binvar;
524 SCIP_Real val;
525
526 solcand[i] = FALSE;
527 if ( SCIPconsIsActive(indconss[i]) )
528 {
529 binvar = SCIPgetBinaryVarIndicator(indconss[i]);
530 assert( binvar != NULL );
531
532 val = SCIPgetSolVal(scip, bestsol, binvar);
534 if ( val > 0.5 )
535 solcand[i] = TRUE;
536 }
537 }
538
539 SCIPdebugMsg(scip, "Trying to improve best solution of value %f.\n", SCIPgetSolOrigObj(scip, bestsol) );
540
541 /* try one-opt heuristic */
542 SCIP_CALL( tryOneOpt(scip, heur, heurdata, nindconss, indconss, solcand, &nfoundsols) );
543
544 if ( nfoundsols > 0 )
546 else
548
549 SCIPfreeBufferArray(scip, &solcand);
550 }
551
552 return SCIP_OKAY;
553}
554
555
556/*
557 * primal heuristic specific interface methods
558 */
559
560/** creates the indicator primal heuristic and includes it in SCIP */
562 SCIP* scip /**< SCIP data structure */
563 )
564{
566 SCIP_HEUR* heur;
567
568 /* create Indicator primal heuristic data */
570 heurdata->nindconss = 0;
571 heurdata->indconss = NULL;
572 heurdata->solcand = NULL;
573 heurdata->lastsol = NULL;
574 heurdata->indicatorconshdlr = NULL;
575 heurdata->obj = SCIPinfinity(scip);
576 heurdata->inittiming = HEUR_TIMING;
577
578 /* include primal heuristic */
581 HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecIndicator, heurdata) );
582
583 assert( heur != NULL );
584
585 /* primal heuristic is safe to use in exact solving mode */
586 SCIPheurMarkExact(heur);
587
588 /* set non-NULL pointers to callback methods */
589 SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyIndicator) );
590 SCIP_CALL( SCIPsetHeurInitsol(scip, heur, heurInitsolIndicator) );
591 SCIP_CALL( SCIPsetHeurExitsol(scip, heur, heurExitsolIndicator) );
592 SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeIndicator) );
593
594 /* add parameters */
596 "heuristics/" HEUR_NAME "/oneopt",
597 "whether the one-opt heuristic should be started",
598 &heurdata->oneopt, TRUE, DEFAULT_ONEOPT, NULL, NULL) );
599
601 "heuristics/" HEUR_NAME "/improvesols",
602 "Try to improve other solutions by one-opt?",
603 &heurdata->improvesols, TRUE, DEFAULT_IMPROVESOLS, NULL, NULL) );
604
605 return SCIP_OKAY;
606}
607
608
609/** pass partial solution for indicator variables to heuristic */
611 SCIP* scip, /**< SCIP data structure */
612 SCIP_HEUR* heur, /**< indicator heuristic */
613 int nindconss, /**< number of indicator constraints */
614 SCIP_CONS** indconss, /**< indicator constraints */
615 SCIP_Bool* solcand, /**< values for indicator variables in partial solution */
616 SCIP_Real obj /**< objective of solution */
617 )
618{
620
621 assert( scip != NULL );
622 assert( heur != NULL );
623 assert( strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0 );
624 assert( nindconss > 0 );
625 assert( indconss != NULL );
626 assert( solcand != NULL );
627
628 /* get heuristic's data */
630 assert( heurdata != NULL );
631
632 if ( obj >= heurdata->obj )
633 return SCIP_OKAY;
634
635 /* copy indicator information */
636 if ( heurdata->indconss != NULL )
637 SCIPfreeBlockMemoryArray(scip, &(heurdata->indconss), heurdata->nindconss);
638
639 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &(heurdata->indconss), indconss, nindconss) );
640 heurdata->nindconss = nindconss;
641
642 /* copy partial solution */
643 if ( heurdata->solcand != NULL )
644 BMScopyMemoryArray(heurdata->solcand, solcand, nindconss);
645 else
646 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &(heurdata->solcand), solcand, nindconss) );
647 heurdata->obj = obj;
648
649 /* enable indicator heuristic */
650 SCIPheurSetTimingmask(heur, heurdata->inittiming);
651
652 return SCIP_OKAY;
653}
constraint handler for indicator constraints
#define NULL
Definition def.h:255
#define SCIP_MAXTREEDEPTH
Definition def.h:304
#define SCIP_Bool
Definition def.h:98
#define SCIP_Real
Definition def.h:163
#define TRUE
Definition def.h:100
#define FALSE
Definition def.h:101
#define SCIP_CALL(x)
Definition def.h:362
SCIP_VAR * SCIPgetBinaryVarIndicator(SCIP_CONS *cons)
int SCIPgetSubscipDepth(SCIP *scip)
Definition scip_copy.c:2588
SCIP_Bool SCIPisStopped(SCIP *scip)
int SCIPgetNIntVars(SCIP *scip)
Definition scip_prob.c:2340
int SCIPgetNBinImplVars(SCIP *scip)
Definition scip_prob.c:2432
int SCIPgetNIntImplVars(SCIP *scip)
Definition scip_prob.c:2477
int SCIPgetNBinVars(SCIP *scip)
Definition scip_prob.c:2293
#define SCIPdebugMsg
SCIP_RETCODE SCIPheurPassIndicator(SCIP *scip, SCIP_HEUR *heur, int nindconss, SCIP_CONS **indconss, SCIP_Bool *solcand, SCIP_Real obj)
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:57
SCIP_RETCODE SCIPincludeHeurIndicator(SCIP *scip)
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
Definition cons.c:4778
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition scip_cons.c:940
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
Definition cons.c:4735
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
Definition cons.c:8450
SCIP_RETCODE SCIPsetHeurFree(SCIP *scip, SCIP_HEUR *heur,)
Definition scip_heur.c:183
SCIP_HEURDATA * SCIPheurGetData(SCIP_HEUR *heur)
Definition heur.c:1368
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:122
SCIP_HEURTIMING SCIPheurGetTimingmask(SCIP_HEUR *heur)
Definition heur.c:1497
SCIP_RETCODE SCIPsetHeurInitsol(SCIP *scip, SCIP_HEUR *heur,)
Definition scip_heur.c:231
SCIP_RETCODE SCIPsetHeurCopy(SCIP *scip, SCIP_HEUR *heur,)
Definition scip_heur.c:167
void SCIPheurSetTimingmask(SCIP_HEUR *heur, SCIP_HEURTIMING timingmask)
Definition heur.c:1507
SCIP_RETCODE SCIPsetHeurExitsol(SCIP *scip, SCIP_HEUR *heur,)
Definition scip_heur.c:247
void SCIPheurMarkExact(SCIP_HEUR *heur)
Definition heur.c:1457
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition heur.c:1467
void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
Definition heur.c:1378
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
Definition scip_lp.c:174
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition scip_mem.h:110
#define SCIPallocBufferArray(scip, ptr, num)
Definition scip_mem.h:124
#define SCIPfreeBufferArray(scip, ptr)
Definition scip_mem.h:136
#define SCIPfreeBlockMemory(scip, ptr)
Definition scip_mem.h:108
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
Definition scip_mem.h:111
#define SCIPallocBlockMemory(scip, ptr)
Definition scip_mem.h:89
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
Definition scip_mem.h:105
SCIP_RETCODE SCIPchgVarUbProbing(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
SCIP_RETCODE SCIPchgVarLbProbing(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
SCIP_RETCODE SCIPpropagateProbing(SCIP *scip, int maxproprounds, SCIP_Bool *cutoff, SCIP_Longint *ndomredsfound)
SCIP_RETCODE SCIPbacktrackProbing(SCIP *scip, int probingdepth)
SCIP_RETCODE SCIPstartProbing(SCIP *scip)
SCIP_RETCODE SCIPnewProbingNode(SCIP *scip)
SCIP_RETCODE SCIPsolveProbingLP(SCIP *scip, int itlim, SCIP_Bool *lperror, SCIP_Bool *cutoff)
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
Definition scip_sol.c:2988
SCIP_RETCODE SCIPprintSol(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)
Definition scip_sol.c:2353
SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
Definition sol.c:4274
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:4116
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition scip_sol.c:1892
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
Definition scip_sol.c:1765
SCIP_Real SCIPgetSolTransObj(SCIP *scip, SCIP_SOL *sol)
Definition scip_sol.c:2005
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
int SCIPgetDepth(SCIP *scip)
Definition scip_tree.c:672
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
Definition var.c:24268
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
Definition var.c:24234
#define HEUR_TIMING
return SCIP_OKAY
#define HEUR_FREQOFS
#define HEUR_DESC
#define HEUR_DISPCHAR
#define HEUR_MAXDEPTH
#define HEUR_PRIORITY
#define HEUR_NAME
#define HEUR_FREQ
#define HEUR_USESSUBSCIP
SCIPcreateSol(scip, &heurdata->sol, heur))
static SCIP_RETCODE tryOneOpt(SCIP *scip, SCIP_HEUR *heur, SCIP_HEURDATA *heurdata, int nindconss, SCIP_CONS **indconss, SCIP_Bool *solcand, int *nfoundsols)
#define DEFAULT_ONEOPT
static SCIP_RETCODE trySolCandidate(SCIP *scip, SCIP_HEUR *heur, SCIP_HEURDATA *heurdata, int nindconss, SCIP_CONS **indconss, SCIP_Bool *solcand, int *nfoundsols)
#define DEFAULT_IMPROVESOLS
handle partial solutions for linear problems with indicators and otherwise continuous variables
SCIP_Bool lperror
int c
SCIPendProbing(scip))
SCIP_Bool cutoff
static SCIP_SOL * sol
SCIP_Real obj
assert(minobj< SCIPgetCutoffbound(scip))
SCIPlinkLPSol(scip, sol))
memory allocation routines
#define BMScopyMemoryArray(ptr, source, num)
Definition memory.h:134
public methods for managing constraints
public methods for primal heuristics
public methods for message output
public methods for primal CIP solutions
public methods for problem variables
public methods for constraint handler plugins and constraints
public methods for problem copies
general public methods
public methods for primal heuristic plugins and divesets
public methods for the LP relaxation, rows and columns
public methods for memory management
public methods for message handling
public methods for numerical tolerances
public methods for SCIP parameter handling
public methods for global and local (sub)problems
public methods for the probing mode
public methods for solutions
public methods for the branch-and-bound tree
struct SCIP_Cons SCIP_CONS
Definition type_cons.h:63
struct SCIP_Conshdlr SCIP_CONSHDLR
Definition type_cons.h:62
#define SCIP_DECL_HEURINITSOL(x)
Definition type_heur.h:132
#define SCIP_DECL_HEURCOPY(x)
Definition type_heur.h:97
struct SCIP_HeurData SCIP_HEURDATA
Definition type_heur.h:77
struct SCIP_Heur SCIP_HEUR
Definition type_heur.h:76
#define SCIP_DECL_HEURFREE(x)
Definition type_heur.h:105
#define SCIP_DECL_HEUREXITSOL(x)
Definition type_heur.h:143
#define SCIP_DECL_HEUREXEC(x)
Definition type_heur.h:163
@ SCIP_LPSOLSTAT_OPTIMAL
Definition type_lp.h:44
@ SCIP_DIDNOTRUN
Definition type_result.h:42
@ SCIP_DIDNOTFIND
Definition type_result.h:44
@ SCIP_FOUNDSOL
Definition type_result.h:56
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
Definition type_scip.h:39
struct SCIP_Sol SCIP_SOL
Definition type_sol.h:57
unsigned int SCIP_HEURTIMING
#define SCIP_HEURTIMING_NONE
Definition type_timing.h:79
struct SCIP_Var SCIP_VAR
Definition type_var.h:166