SCIP Doxygen Documentation
Loading...
Searching...
No Matches
cons_exactsol.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 cons_exactsol.c
26 * @ingroup DEFPLUGINS_CONS
27 * @brief constraint handler for ensuring that primal solution is exact
28 * @author Antonia Chmiela
29 * @author Leon Eifler
30 */
31
32/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
33
34#include "scip/def.h"
36#include "scip/cons_exactsol.h"
37#include "scip/pub_cons.h"
38#include "scip/pub_heur.h"
39#include "scip/pub_lp.h"
40#include "scip/pub_lpexact.h"
41#include "scip/pub_message.h"
42#include "scip/pub_misc.h"
43#include "scip/pub_sol.h"
44#include "scip/pub_var.h"
45#include "scip/rational.h"
47#include "scip/scip_cons.h"
48#include "scip/scip_exact.h"
49#include "scip/scip_general.h"
50#include "scip/scip_lp.h"
51#include "scip/scip_lpexact.h"
52#include "scip/scip_mem.h"
53#include "scip/scip_message.h"
54#include "scip/scip_numerics.h"
55#include "scip/scip_param.h"
56#include "scip/scip_prob.h"
58#include "scip/scip_tree.h"
59#include "scip/set.h"
60
61
62/* fundamental constraint handler properties */
63#define CONSHDLR_NAME "exactsol"
64#define CONSHDLR_DESC "constraint handler for repairing floating-point primal solutions to satisfy exact feasibility"
65#define CONSHDLR_ENFOPRIORITY -9999999 /**< priority of the constraint handler for constraint enforcing */
66#define CONSHDLR_CHECKPRIORITY -999999 /**< priority of the constraint handler for checking feasibility */
67#define CONSHDLR_EAGERFREQ 100 /**< frequency for using all instead of only the useful constraints in separation,
68 * propagation and enforcement, -1 for no eager evaluations, 0 for first only */
69#define CONSHDLR_NEEDSCONS FALSE /**< should the constraint handler be skipped, if no constraints are available? */
70
71#define DEFAULT_CHECKFPFEASIBILITY TRUE /**< should a solution be checked in floating-point arithmetic prior to being processed? */
72/**@todo determine checkcontimplint default */
73#define DEFAULT_CHECKCONTIMPLINT TRUE /**< should integrality of continuous implied integral variables be ensured? */
74/**@todo tune abortfrac default */
75#define DEFAULT_ABORTFRAC 1e-9 /**< fractionality of enforced integral value above which reparation is aborted */
76/**@todo tune unfixfrac default */
77#define DEFAULT_UNFIXFRAC 0.0 /**< fractionality of weakly implied value up to which reparation fixes variable */
78#define DEFAULT_MAXSTALLS 1000 /**< maximal number of consecutive repair calls without success */
79#define DEFAULT_SOLBUFSIZE 10 /**< size of solution buffer */
80#define DEFAULT_MINIMPROVE 0.2 /**< minimal percentage of primal improvement to trigger solution processing */
81
82/** constraint handler data */
84{
85 int* idx; /**< variable indices that are fixed, sorted increasing */
86 SCIP_Longint* vals; /**< values those vars were fixed to */
87 int len; /**< length of the two arrays */
88};
90
91struct SCIP_ConshdlrData
92{
93 SCIP_SOL** solubuffer; /**< buffer solutions for later checking here */
94 SCIP_HASHTABLE* solhash; /**< hash solutions so we don't use the same integer assignment twice */
95 SOLINTASSIGNMENT** hashedassignments; /**< array with all hashed assignments */
96 int nhashedassignments; /**< number of elements in the hashedassignments array */
97 int lenhash; /**< length of the hashedassignments array */
98 int nbufferedsols; /**< number of solutions currently in the solubuffer */
99 int lensolubuffer; /**< length of the solubuffer */
100 int probhasconteqs; /**< does the problem have equations with continuous variables? (-1 unknown, 0 no, 1 yes) */
101 int ncurrentstalls; /**< number of times the exact lp was solved unsuccessfully in a row */
102 SCIP_Bool checkfpfeasibility; /**< should a solution be checked in floating-point arithmetic prior to being processed? */
103 SCIP_Bool checkcontimplint; /**< should integrality of continuous implied integral variables be ensured? */
104 SCIP_Real abortfrac; /**< fractionality of enforced integral value above which reparation is aborted */
105 SCIP_Real unfixfrac; /**< fractionality of weakly implied value up to which reparation fixes variable */
106 int maxstalls; /**< maximal number of consecutive repair calls without success */
107 int solbufsize; /**< size of solution buffer */
108 SCIP_Real minimprove; /**< minimal percentage of primal improvement to trigger solution processing */
109};
110
111/** gets the key of the given element */
112static
113SCIP_DECL_HASHGETKEY(hashGetKeyAssignment)
114{ /*lint --e{715}*/
115 /* the key is the element itself */
116 return elem;
117}
118
119/** returns TRUE iff both keys are equal */
120static
121SCIP_DECL_HASHKEYEQ(hashKeyEqAssignment)
122{ /*lint --e{715}*/
123 SOLINTASSIGNMENT* sol1;
124 SOLINTASSIGNMENT* sol2;
125 int i;
126
127 assert(key1 != NULL);
128 assert(key2 != NULL);
129
130 sol1 = (SOLINTASSIGNMENT*)key1;
131 sol2 = (SOLINTASSIGNMENT*)key2;
132
133 if( sol1->len != sol2->len )
134 return false;
135
136 for( i = 0; i < sol1->len; i++ )
137 {
138 if( sol1->idx[i] != sol2->idx[i] || sol1->vals[i] != sol2->vals[i] )
139 return FALSE;
140 }
141
142 return TRUE;
143}
144
145/** returns the hash value of the key */
146static
147SCIP_DECL_HASHKEYVAL(hashKeyValAssignment)
148{ /*lint --e{715}*/
150 uint64_t signature;
151 int i;
152
153 sol = (SOLINTASSIGNMENT*)key;
154 signature = 0;
155 for( i = 0; i < sol->len; ++i )
156 signature |= SCIPhashSignature64(sol->vals[i] * sol->idx[i]);
157
158 return signature;
159}
160
161/** unlinks and copies a solution and adds it to the solution buffer */
162static
164 SCIP* scip, /**< SCIP data structure */
165 SCIP_SOL* sol, /**< solution to add */
166 SCIP_CONSHDLRDATA* conshdlrdata /**< exactsol constraint handler data */
167 )
168{
169 SCIP_SOL* insertsol;
170
171 SCIPdebugMessage("buffering solution from heuristic %s \n", SCIPheurGetName(SCIPsolGetHeur(sol)));
172
173 SCIP_CALL( SCIPcreateSolCopy(scip, &insertsol, sol) );
174 SCIP_CALL( SCIPunlinkSol(scip, insertsol) );
175
176 /* extend solubuffer, if necessary */
177 if( conshdlrdata->nbufferedsols == conshdlrdata->lensolubuffer )
178 {
179 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &conshdlrdata->solubuffer,
180 conshdlrdata->lensolubuffer, conshdlrdata->lensolubuffer * 2) );
181 conshdlrdata->lensolubuffer *= 2;
182 }
183
184 /* put solution in buffer */
185 conshdlrdata->solubuffer[conshdlrdata->nbufferedsols] = insertsol;
186 conshdlrdata->nbufferedsols++;
187
188 return SCIP_OKAY;
189}
190
191/** frees all remaining solutions in buffer */
192static
194 SCIP* scip, /**< SCIP data structure */
195 SCIP_CONSHDLRDATA* conshdlrdata /**< exactsol constraint handler data */
196 )
197{
198 int i;
199
200 for( i = 0; i < conshdlrdata->nbufferedsols; i++ )
201 {
202 SCIP_CALL_ABORT( SCIPfreeSol(scip, &conshdlrdata->solubuffer[i]) );
203 }
204
205 conshdlrdata->nbufferedsols = 0;
206}
207
208/** creates assignment from integer variable-values in solution */
209static
211 SCIP* scip, /**< SCIP data structure */
212 SCIP_SOL* sol, /**< solution to create assignment for */
213 SCIP_Bool checkcontimplint, /**< whether continuous implied integral variables should be included */
214 SOLINTASSIGNMENT** assignment /**< address of assignment */
215 )
216{ /*lint --e{522, 776}*/
217 SCIP_VAR** vars;
218 int nintegers;
219 int i;
220
221 assert(sol != NULL);
222 assert(scip != NULL);
223
224 /* get all problem variables and integer region in vars array */
225 if( checkcontimplint )
226 {
227 int nvars;
228 int ncontvars;
229 SCIP_CALL( SCIPgetSolVarsData(scip, sol, &vars, &nvars, NULL, NULL, NULL, NULL, NULL, &ncontvars) );
230 nintegers = nvars - ncontvars;
231 }
232 else
233 {
234 int nvars;
235 int ncontimplvars;
236 int ncontvars;
237 SCIP_CALL( SCIPgetSolVarsData(scip, sol, &vars, &nvars, NULL, NULL, NULL, NULL, &ncontimplvars, &ncontvars) );
238 nintegers = nvars - ncontvars - ncontimplvars;
239 }
240 assert(nintegers >= 0);
241
242 SCIP_CALL( SCIPallocBlockMemory(scip, assignment) );
243 SCIP_CALL( SCIPallocClearBlockMemoryArray(scip, &(*assignment)->vals, nintegers) );
244 SCIP_CALL( SCIPallocClearBlockMemoryArray(scip, &(*assignment)->idx, nintegers) );
245
246 for( i = 0; i < nintegers; i++ )
247 {
249
250 (*assignment)->vals[i] = (SCIP_Longint) SCIPround(scip, SCIPgetSolVal(scip, sol, vars[i]));
251 (*assignment)->idx[i] = SCIPvarGetIndex(vars[i]);
252 }
253
254 (*assignment)->len = nintegers;
255
256 return SCIP_OKAY;
257}
258
259/** creates assignment from integer variable-values in solution */
260static
262 SCIP* scip, /**< SCIP data structure */
263 SOLINTASSIGNMENT** assignment /**< address of assignment */
264 )
265{
266 assert(scip != NULL);
267 assert(*assignment != NULL);
268
269 SCIPfreeBlockMemoryArray(scip, &(*assignment)->idx, (*assignment)->len);
270 SCIPfreeBlockMemoryArray(scip, &(*assignment)->vals, (*assignment)->len);
271 SCIPfreeBlockMemory(scip, assignment);
272}
273
274/** checks whether equation constraints with non-integral variables are present */
275static
277 SCIP* scip, /**< SCIP data structure */
278 SCIP_CONSHDLRDATA* conshdlrdata /**< exactsol constraint handler data */
279 )
280{
281 SCIP_CONS** conss;
282 int nconss;
283 int c;
284 SCIP_Bool success;
285
286 assert(scip != NULL);
287 assert(conshdlrdata != NULL);
288
289 if( conshdlrdata->probhasconteqs != -1 )
290 return;
291
292 conss = SCIPgetConss(scip);
293 nconss = SCIPgetNConss(scip);
294 success = TRUE;
295
296 conshdlrdata->probhasconteqs = 0;
297
298 for( c = 0; c < nconss; ++c )
299 {
300 if( SCIPconsGetHdlr(conss[c]) == SCIPfindConshdlr(scip, "exactlinear") )
301 {
302 /* constraint is an equality constraint */
303 if( SCIPrationalIsEQ(SCIPconsGetRhsExact(scip, conss[c], &success), SCIPconsGetLhsExact(scip, conss[c], &success)) ) /*lint !e864*/
304 {
305 /* check if there are continuous variables involved */
307 int nvars = SCIPgetNVarsExactLinear(scip, conss[c]);
308
309 for( int i = 0; i < nvars; ++i )
310 {
311 if( !SCIPvarIsIntegral(vars[i]) )
312 {
313 conshdlrdata->probhasconteqs = 1;
314 break;
315 }
316 }
317 }
318 if( conshdlrdata->probhasconteqs == 1 )
319 break;
320 }
321 else
322 {
323 /* unsupported constraint type -> throw error */
324 SCIPerrorMessage("Unsupported constraint type in exactsol constraint handler: %s\n", SCIPconshdlrGetName(SCIPconsGetHdlr(conss[c])));
325 SCIPABORT();
326 }
327 }
328}
329
330/*
331 * Callback methods of constraint handler
332 */
333
334
335/** constraint enforcing method of constraint handler for LP solutions */
336static
337SCIP_DECL_CONSENFOLP(consEnfolpExactSol)
338{ /*lint --e{715}*/
339 assert(result != NULL);
341
342 /* returning feasible since we can't enforce anything */
344
345 return SCIP_OKAY;
346}
347
348/** constraint enforcing method of constraint handler for LP solutions */
349static
350SCIP_DECL_CONSENFORELAX(consEnforelaxExactSol)
351{ /*lint --e{715}*/
352 assert(result != NULL);
354
355 /* returning feasible since we can't enforce anything */
357
358 return SCIP_OKAY;
359}
360
361/** constraint enforcing method of constraint handler for pseudo solutions */
362static
363SCIP_DECL_CONSENFOPS(consEnfopsExactSol)
364{ /*lint --e{715}*/
365 assert(result != NULL);
367
368 /* returning feasible since we can't enforce anything */
370
371 return SCIP_OKAY;
372}
373
374/** feasibility check method of constraint handler for integral solutions */
375static
376SCIP_DECL_CONSCHECK(consCheckExactSol)
377{ /*lint --e{715}*/
378 SCIP_VAR** vars;
379 SCIP_CONS** consprob;
380 SCIP_SOL* exactsol;
381 SOLINTASSIGNMENT* assignment = NULL;
382 SCIP_SOL* worksol;
383 SCIP_Bool foundsol;
385 int nvars;
386 int nintegers;
387 int nconsprob;
388 int i;
389 int c;
390 SCIP_CONSHDLRDATA* conshdlrdata;
391#ifdef NDEBUG
392 SCIP_RETCODE retstat;
393#endif
394
395 assert(scip != NULL);
396 assert(conss != NULL || nconss == 0);
397 assert(result != NULL);
398
400
401 if( !SCIPisExact(scip) )
402 return SCIP_OKAY;
403
404 foundsol = FALSE;
405
406 conshdlrdata = SCIPconshdlrGetData(conshdlr);
407 assert(conshdlrdata != NULL);
408
409 /**@todo add event handler to check again if constraints were added/modified or a variable (impl) type changed */
410 if( conshdlrdata->probhasconteqs == -1 )
411 checkProbHasContEqs(scip, conshdlrdata);
412
413 /* disable exact sol if we stalled too often in a row */
414 if( conshdlrdata->ncurrentstalls >= conshdlrdata->maxstalls )
415 return SCIP_OKAY;
416
417 /* if the solution doesn't come from a heuristic, ignore it */
419 return SCIP_OKAY;
420
421 /* do not run if the solution comes from the trivial heuristic for the following reason: it typically creates the
422 * first solution, which would be processed immediately, because it improves the primal bound by an infinite amount;
423 * however, its quality is usually bad and superseeded quickly by solutions from other heuristics
424 */
425 if( strcmp(SCIPheurGetName(SCIPsolGetHeur(sol)), "trivial") == 0 )
426 return SCIP_OKAY;
427
428 /* do not run for problems that contain mostly continuous variables */
429 if( SCIPgetNContVars(scip) > 0.8 * SCIPgetNVars(scip) )
430 return SCIP_OKAY;
431
432 /* do not run for problems that are purely integer */
433 if( SCIPgetNContVars(scip) == 0 )
434 return SCIP_OKAY;
435
436 /* if we're already in exact diving mode, we already computed an exact solution
437 * with this constraint handler and are checking if it's actually feasible
438 */
439 if( SCIPinExactDive(scip) )
440 return SCIP_OKAY;
441
442 /* we also don't want to execute the handler, if we are in "normal" diving mode */
443 if( SCIPinDive(scip) )
444 return SCIP_OKAY;
445
446 /* do not run for solutions that are already exact */
447 if( SCIPsolIsExact(sol) )
448 return SCIP_OKAY;
449
450 /* do not run after solving is finished */
452 return SCIP_OKAY;
453
454 /* if we are at a point where we can't dive exactly, buffer the solution and return */
456 {
457 SCIP_CALL( bufferSolution(scip, sol, conshdlrdata) );
459 return SCIP_OKAY;
460 }
461
462 /* construct the LP; we ignore the (local) cutoff result, because we relax bounds later */
464 {
466
469 }
470
471 nconsprob = SCIPgetNConss(scip);
472 consprob = SCIPgetConss(scip);
473
474 /* check if solution is floating-point feasible */
475 if( conshdlrdata->checkfpfeasibility )
476 {
477 for( c = 0; c < nconsprob && *result == SCIP_FEASIBLE ; ++c )
478 {
479 SCIP_Real activity;
480 SCIP_ROW* row;
481
482 /* get row corresponding to constraint */
483 row = SCIPconsGetRow(scip, consprob[c]);
484 if( row == NULL )
485 continue;
486
487 /* get row activity */
488 activity = SCIPgetRowSolActivity(scip, row, sol);
489
490 /* check if the constraint is violated */
491 if( SCIPisFeasLT(scip, activity, SCIProwGetLhs(row)) || SCIPisFeasGT(scip, activity, SCIProwGetRhs(row)) )
493 }
494
495 /* do not continue for floating-point infeasible solutions */
496 if( *result == SCIP_INFEASIBLE )
497 return SCIP_OKAY;
498 }
499
500 /* first, check if we already tried a solution with this integer assignment */
501 SCIP_CALL( solCreateSolAssignment(scip, sol, conshdlrdata->checkcontimplint, &assignment) );
502 if( assignment != NULL && SCIPhashtableExists(conshdlrdata->solhash, (void*) assignment) )
503 {
504 SCIPdebugMessage("rejecting solution that was already checked\n");
506
507 solFreeAssignment(scip, &assignment);
509
510 return SCIP_OKAY;
511 }
512 else
513 {
514 SCIPdebugMessage("checking solution for the first time: \n");
516
517 /* add assignment to the hashtable, extend assignment array, if necessary */
518 if( conshdlrdata->lenhash == conshdlrdata->nhashedassignments )
519 {
520 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &conshdlrdata->hashedassignments,
521 conshdlrdata->lenhash, conshdlrdata->lenhash * 2) );
522 conshdlrdata->lenhash *= 2;
523 }
524 conshdlrdata->hashedassignments[conshdlrdata->nhashedassignments] = assignment;
525 conshdlrdata->nhashedassignments++;
526
527 SCIP_CALL( SCIPhashtableInsert(conshdlrdata->solhash, assignment) );
528 }
529
530 /* add solution to buffer */
531 SCIP_CALL( bufferSolution(scip, sol, conshdlrdata) );
532
533 /* stop if exact diving is not possible at this point in time (mostly if lp state is not clean) */
535 {
537 return SCIP_OKAY;
538 }
539
540 /* stop if the new solution does not improve the current upperbound sufficiently and the buffer is not full;
541 * otherwise we continue by processing the buffer
542 */
543 if( conshdlrdata->nbufferedsols < DEFAULT_SOLBUFSIZE )
544 {
545 SCIP_Real multiplier;
546
547 multiplier = SCIPgetSolTransObj(scip, sol) > 0 ? 1 + conshdlrdata->minimprove : 1 - conshdlrdata->minimprove;
549 {
551 return SCIP_OKAY;
552 }
553 }
554
555 /* start exact diving and set global bounds of continuous variables */
557
558 /* get all problem variables and integer region in vars array */
561 nintegers = nvars - SCIPgetNContVars(scip);
562 if( !conshdlrdata->checkcontimplint )
563 nintegers -= SCIPgetNContImplVars(scip);
564 assert(nintegers >= 0);
565
566 for( i = nintegers; i < nvars; ++i )
567 {
569 {
571
574
577 }
578 }
579
580 /* sort solubuffer by objval try to repair best solutions first */
581 SCIPsortPtr((void**)conshdlrdata->solubuffer, SCIPsolComp, conshdlrdata->nbufferedsols);
582
583 while( conshdlrdata->nbufferedsols > 0 && !foundsol )
584 {
585 /* best solution is last in solubuffer */
586 worksol = conshdlrdata->solubuffer[conshdlrdata->nbufferedsols - 1];
587
588 /* only try to fix solutions that improve the cutoffbound */
590 {
591 SCIPdebugMessage("don't repair heuristic with obj value (%g) greater than upper bound (%g) \n",
593 SCIP_CALL( SCIPfreeSol(scip, &worksol) );
594 conshdlrdata->nbufferedsols--;
595 continue;
596 }
597
598 SCIPdebugMessage("attempting to repair solution from heuristic %s with floating point objval %g \n",
600
601 /* set the bounds of the variables: fixed for integral variables, global bounds for continuous ones */
602 for( i = 0; i < nintegers; ++i )
603 {
605 {
606 SCIP_Real solval;
607
608 solval = SCIPgetSolVal(scip, worksol, vars[i]);
609
611
612 /* for all integer and implied integer variables we check if their solution value is near-integral and abort
613 * if not, except for continuous variables whose integrality is weakly implied: then the solution value
614 * could be fractional in a floating-point feasible solution and we only know that a feasible solution with
615 * integral value exists; in this case we leave it unfixed to avoid infeasibility
616 */
617 if( SCIPvarGetType(vars[i]) != SCIP_VARTYPE_CONTINUOUS && !EPSISINT(solval, conshdlrdata->abortfrac) )
618 {
620 break;
621 }
623 && SCIPvarGetImplType(vars[i]) == SCIP_IMPLINTTYPE_WEAK && !EPSISINT(solval, conshdlrdata->unfixfrac) )
624 {
627
630 }
631 else
632 {
634
635 SCIP_RATIONAL* newbound;
636
638
639 /* create rational solval and round it to the nearest integer */
640 SCIPrationalSetReal(newbound, solval);
642
645
646 SCIP_CALL( SCIPchgVarLbExactDive(scip, vars[i], newbound) );
647 SCIP_CALL( SCIPchgVarUbExactDive(scip, vars[i], newbound) );
648
650 }
651 }
652 }
653
654 if( *result == SCIP_INFEASIBLE )
655 {
656 SCIP_CALL( SCIPfreeSol(scip, &worksol) );
657 conshdlrdata->nbufferedsols--;
658 continue;
659 }
660
662
663 /* solve LP */
664
665 /* Errors in the LP solver should not kill the overall solving process, if the LP is just needed for a constraint
666 * handler. Hence in optimized mode, the return code is caught and a warning is printed, only in debug mode, SCIP
667 * will stop.
668 */
669#ifdef NDEBUG
670 retstat = SCIPsolveExactDiveLP(scip, -1, &lperror, NULL);
671 if( retstat != SCIP_OKAY )
672 {
673 SCIPwarningMessage(scip, "Error while solving LP in Exactsol Constraint Handler; exact LP solve terminated with code <%d>\n",retstat);
674 }
675#else
677#endif
678
679 /* check if this is a feasible solution */
681 {
682 SCIP_CALL( SCIPcreateLPSolExact(scip, &exactsol, NULL) );
683 SCIP_CALL( SCIPoverwriteFPsol(scip, exactsol) );
684
685 SCIPsolSetHeur(exactsol, SCIPsolGetHeur(worksol));
686 SCIP_CALL( SCIPtrySolFreeExact(scip, &exactsol, FALSE, FALSE, FALSE, FALSE, TRUE, &foundsol) );
687
688 /* if we found a solution we do not try to complete the others, since they have worse objective values */
689 if( foundsol )
690 {
691 clearSoluBuffer(scip, conshdlrdata);
692 }
693 else
694 {
695 SCIP_CALL( SCIPfreeSol(scip, &worksol) );
696 conshdlrdata->nbufferedsols--;
697 }
698 }
699 /**@todo handle the unbounded case */
700 else
701 {
702 SCIP_CALL( SCIPfreeSol(scip, &worksol) );
703 conshdlrdata->nbufferedsols--;
704 }
705 }
706
707 /* terminate exact diving */
709
710 if( foundsol )
711 {
712 SCIPdebugMessage("successfully found feasible improving solution, objval %g, upperbound %g\n",
714 conshdlrdata->ncurrentstalls = 0;
715 }
716 else
717 {
718 SCIPdebugMessage("repaired solution not feasible or not improving, objval %g, upperbound %g \n",
720 conshdlrdata->ncurrentstalls++;
721 }
722
723 return SCIP_OKAY;
724}
725
726/** variable rounding lock method of constraint handler */
727static
728SCIP_DECL_CONSLOCK(consLockExactSol)
729{ /*lint --e{715}*/
730 /* do nothing since we are not handling constraints */
731 return SCIP_OKAY;
732}
733
734/** destructor of constraint handler to free constraint handler data (called when SCIP is exiting) */
735static
736SCIP_DECL_CONSFREE(consFreeExactSol)
737{ /*lint --e{715}*/
738 SCIP_CONSHDLRDATA* conshdlrdata;
739
740 /* free constraint handler data */
741 conshdlrdata = SCIPconshdlrGetData(conshdlr);
742 assert(conshdlrdata != NULL);
743
744 SCIPfreeBlockMemory(scip, &conshdlrdata);
745
746 SCIPconshdlrSetData(conshdlr, NULL);
747
748 return SCIP_OKAY;
749}
750
751/** initialization method of constraint handler (called after problem was transformed) */
752static
753SCIP_DECL_CONSINIT(consInitExactSol)
754{ /*lint --e{715, 522}*/
755 SCIP_CONSHDLRDATA* conshdlrdata;
756
757 assert(scip != NULL);
758 assert(conshdlr != NULL);
759
760 /* disable exactsol handler */
761 if( !SCIPisExact(scip) )
762 {
764 return SCIP_OKAY;
765 }
766
767 conshdlrdata = SCIPconshdlrGetData(conshdlr);
768 assert(conshdlrdata != NULL);
769
770 /* create hashdata for integer assignments */
771 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &conshdlrdata->hashedassignments, DEFAULT_SOLBUFSIZE) );
772 SCIP_CALL( SCIPhashtableCreate(&(conshdlrdata->solhash), SCIPblkmem(scip), DEFAULT_SOLBUFSIZE, hashGetKeyAssignment, hashKeyEqAssignment, hashKeyValAssignment, NULL) );
773
774 conshdlrdata->nhashedassignments = 0;
775 conshdlrdata->lenhash = DEFAULT_SOLBUFSIZE;
776
777 /* allocate data for solution buffer */
778 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &conshdlrdata->solubuffer, DEFAULT_SOLBUFSIZE) );
779 conshdlrdata->lensolubuffer = DEFAULT_SOLBUFSIZE;
780 conshdlrdata->nbufferedsols = 0;
781
782 conshdlrdata->ncurrentstalls = 0;
783 conshdlrdata->probhasconteqs = -1;
784
785 return SCIP_OKAY;
786}
787
788/** deinitialization method of constraint handler (called before transformed problem is freed) */
789static
790SCIP_DECL_CONSEXIT(consExitExactSol)
791{ /*lint --e{715, 866}*/
792 SCIP_CONSHDLRDATA* conshdlrdata;
793 int i;
794
795 assert(scip != NULL);
796 assert(conshdlr != NULL);
797
798 /* reenable exactsol handler */
799 if( SCIPconshdlrNeedsCons(conshdlr) )
800 {
803 return SCIP_OKAY;
804 }
805
806 conshdlrdata = SCIPconshdlrGetData(conshdlr);
807 assert(conshdlrdata != NULL);
808
809 /* free solution hashdata */
810 SCIPhashtableRemoveAll(conshdlrdata->solhash);
811 SCIPhashtableFree(&(conshdlrdata->solhash));
812 for( i = 0; i < conshdlrdata->nhashedassignments; i++ )
813 {
814 SCIPfreeBlockMemoryArray(scip, &conshdlrdata->hashedassignments[i]->idx, conshdlrdata->hashedassignments[i]->len);
815 SCIPfreeBlockMemoryArray(scip, &conshdlrdata->hashedassignments[i]->vals, conshdlrdata->hashedassignments[i]->len);
816 SCIPfreeBlockMemory(scip, &conshdlrdata->hashedassignments[i]);
817 }
818 SCIPfreeBlockMemoryArray(scip, &conshdlrdata->hashedassignments, conshdlrdata->lenhash);
819 conshdlrdata->nhashedassignments = 0;
820
821 /* free solubuffer */
822 for( i = 0; i < conshdlrdata->nbufferedsols; i++ )
823 {
824 SCIP_CALL( SCIPfreeSol(scip, &conshdlrdata->solubuffer[i]) );
825 }
826 SCIPfreeBlockMemoryArray(scip, &conshdlrdata->solubuffer, conshdlrdata->lensolubuffer);
827 conshdlrdata->nbufferedsols = 0;
828
829 return SCIP_OKAY;
830}
831
832/** copy method for constraint handler plugins (called when SCIP copies plugins) */
833static
834SCIP_DECL_CONSHDLRCOPY(conshdlrCopyExactSol)
835{ /*lint --e{715}*/
836 assert(scip != NULL);
837 assert(conshdlr != NULL);
838
840
841 /* call inclusion method of constraint handler */
843
844 *valid = TRUE;
845
846 return SCIP_OKAY;
847}
848
849/*
850 * constraint specific interface methods
851 */
852
853/** creates the handler for ExactSol constraints and includes it in SCIP */
855 SCIP* scip /**< SCIP data structure */
856 )
857{
858 SCIP_CONSHDLRDATA* conshdlrdata;
859 SCIP_CONSHDLR* conshdlr;
860
861 /* create exactsol constraint handler data */
862 SCIP_CALL( SCIPallocBlockMemory(scip, &conshdlrdata) );
863 conshdlr = NULL;
864
865 /* include constraint handler */
868 consEnfolpExactSol, consEnfopsExactSol, consCheckExactSol, consLockExactSol,
869 conshdlrdata) );
870 assert(conshdlr != NULL);
871
872 /* mark constraint handler as exact */
873 SCIPconshdlrMarkExact(conshdlr);
874
875 /* set non-fundamental callbacks via specific setter functions */
876 SCIP_CALL( SCIPsetConshdlrCopy(scip, conshdlr, conshdlrCopyExactSol, NULL) );
877 SCIP_CALL( SCIPsetConshdlrEnforelax(scip, conshdlr, consEnforelaxExactSol) );
878 SCIP_CALL( SCIPsetConshdlrInit(scip, conshdlr, consInitExactSol) );
879 SCIP_CALL( SCIPsetConshdlrExit(scip, conshdlr, consExitExactSol) );
880 SCIP_CALL( SCIPsetConshdlrFree(scip, conshdlr, consFreeExactSol) );
881
882 /* add exactsol constraint handler parameters */
884 "constraints/" CONSHDLR_NAME "/checkfpfeasibility",
885 "should a solution be checked in floating-point arithmetic prior to being processed?",
886 &conshdlrdata->checkfpfeasibility, TRUE, DEFAULT_CHECKFPFEASIBILITY, NULL, NULL) );
888 "constraints/" CONSHDLR_NAME "/checkcontimplint",
889 "should integrality of continuous implied integral variables be ensured?",
890 &conshdlrdata->checkcontimplint, TRUE, DEFAULT_CHECKCONTIMPLINT, NULL, NULL) );
892 "constraints/" CONSHDLR_NAME "/abortfrac",
893 "fractionality of enforced integral value above which reparation is aborted",
894 &conshdlrdata->abortfrac, TRUE, DEFAULT_ABORTFRAC, 0.0, 0.5, NULL, NULL) );
896 "constraints/" CONSHDLR_NAME "/unfixfrac",
897 "fractionality of weakly implied value up to which reparation fixes variable",
898 &conshdlrdata->unfixfrac, TRUE, DEFAULT_UNFIXFRAC, 0.0, 0.5, NULL, NULL) );
900 "constraints/" CONSHDLR_NAME "/maxstalls",
901 "maximal number of consecutive repair calls without success",
902 &conshdlrdata->maxstalls, TRUE, DEFAULT_MAXSTALLS, 0, INT_MAX, NULL, NULL) );
904 "constraints/" CONSHDLR_NAME "/solbufsize",
905 "size of solution buffer",
906 &conshdlrdata->solbufsize, TRUE, DEFAULT_SOLBUFSIZE, 0, INT_MAX, NULL, NULL) );
908 "constraints/" CONSHDLR_NAME "/minimprove",
909 "minimal percentage of primal improvement to trigger solution processing",
910 &conshdlrdata->minimprove, TRUE, DEFAULT_MINIMPROVE, 0.0, SCIP_REAL_MAX, NULL, NULL) );
911
912 return SCIP_OKAY;
913}
#define CONSHDLR_NEEDSCONS
Definition cons_and.c:96
#define CONSHDLR_CHECKPRIORITY
Definition cons_and.c:88
#define CONSHDLR_DESC
Definition cons_and.c:85
#define CONSHDLR_EAGERFREQ
Definition cons_and.c:91
#define CONSHDLR_ENFOPRIORITY
Definition cons_and.c:87
#define CONSHDLR_NAME
Definition cons_and.c:84
Constraint handler for linear constraints in their most general form, .
#define DEFAULT_CHECKFPFEASIBILITY
#define DEFAULT_MAXSTALLS
#define DEFAULT_ABORTFRAC
struct SolIntAssignment SOLINTASSIGNMENT
static void clearSoluBuffer(SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata)
static SCIP_RETCODE bufferSolution(SCIP *scip, SCIP_SOL *sol, SCIP_CONSHDLRDATA *conshdlrdata)
#define DEFAULT_MINIMPROVE
static void checkProbHasContEqs(SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata)
#define DEFAULT_CHECKCONTIMPLINT
static void solFreeAssignment(SCIP *scip, SOLINTASSIGNMENT **assignment)
static SCIP_RETCODE solCreateSolAssignment(SCIP *scip, SCIP_SOL *sol, SCIP_Bool checkcontimplint, SOLINTASSIGNMENT **assignment)
#define DEFAULT_UNFIXFRAC
#define DEFAULT_SOLBUFSIZE
constraint handler for ensuring that primal solution is exact
common defines and data types used in all packages of SCIP
#define NULL
Definition def.h:257
#define SCIP_Longint
Definition def.h:150
#define EPSISINT(x, eps)
Definition def.h:204
#define SCIP_REAL_MAX
Definition def.h:167
#define SCIP_Bool
Definition def.h:100
#define SCIP_STRINGEQ(name, reference, retcode)
Definition def.h:454
#define SCIP_Real
Definition def.h:165
#define TRUE
Definition def.h:102
#define FALSE
Definition def.h:103
#define SCIP_CALL_ABORT(x)
Definition def.h:343
#define SCIPABORT()
Definition def.h:336
#define SCIP_CALL(x)
Definition def.h:364
SCIP_VAR ** SCIPgetVarsExactLinear(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsExactLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPincludeConshdlrExactSol(SCIP *scip)
SCIP_STAGE SCIPgetStage(SCIP *scip)
int SCIPgetNContVars(SCIP *scip)
Definition scip_prob.c:2569
SCIP_RETCODE SCIPgetSolVarsData(SCIP *scip, SCIP_SOL *sol, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nbinimplvars, int *nintimplvars, int *ncontimplvars, int *ncontvars)
Definition scip_prob.c:3114
SCIP_CONS ** SCIPgetConss(SCIP *scip)
Definition scip_prob.c:3666
int SCIPgetNVars(SCIP *scip)
Definition scip_prob.c:2246
int SCIPgetNConss(SCIP *scip)
Definition scip_prob.c:3620
SCIP_VAR ** SCIPgetVars(SCIP *scip)
Definition scip_prob.c:2201
int SCIPgetNContImplVars(SCIP *scip)
Definition scip_prob.c:2522
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
Definition misc.c:2348
SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
Definition misc.c:2647
SCIP_RETCODE SCIPhashtableCreate(SCIP_HASHTABLE **hashtable, BMS_BLKMEM *blkmem, int tablesize, SCIP_DECL_HASHGETKEY((*hashgetkey)), SCIP_DECL_HASHKEYEQ((*hashkeyeq)), SCIP_DECL_HASHKEYVAL((*hashkeyval)), void *userptr)
Definition misc.c:2298
void SCIPhashtableRemoveAll(SCIP_HASHTABLE *hashtable)
Definition misc.c:2743
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition misc.c:2535
#define SCIPhashSignature64(a)
Definition pub_misc.h:566
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition scip_param.c:83
SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition scip_param.c:139
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
void SCIPconshdlrSetData(SCIP_CONSHDLR *conshdlr, SCIP_CONSHDLRDATA *conshdlrdata)
Definition cons.c:4350
SCIP_RETCODE SCIPsetConshdlrFree(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
Definition scip_cons.c:372
SCIP_RETCODE SCIPsetConshdlrEnforelax(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
Definition scip_cons.c:323
SCIP_RETCODE SCIPincludeConshdlrBasic(SCIP *scip, SCIP_CONSHDLR **conshdlrptr, const char *name, const char *desc, int enfopriority, int chckpriority, int eagerfreq, SCIP_Bool needscons, SCIP_DECL_CONSENFOLP((*consenfolp)), SCIP_DECL_CONSENFOPS((*consenfops)), SCIP_DECL_CONSCHECK((*conscheck)), SCIP_DECL_CONSLOCK((*conslock)), SCIP_CONSHDLRDATA *conshdlrdata)
Definition scip_cons.c:181
void SCIPconshdlrMarkExact(SCIP_CONSHDLR *conshdlr)
Definition cons.c:4374
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
Definition cons.c:4320
SCIP_Bool SCIPconshdlrNeedsCons(SCIP_CONSHDLR *conshdlr)
Definition cons.c:5306
SCIP_RETCODE SCIPsetConshdlrCopy(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)),)
Definition scip_cons.c:347
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition scip_cons.c:940
void SCIPconshdlrSetNeedsCons(SCIP_CONSHDLR *conshdlr, SCIP_Bool needscons)
Definition cons.c:5316
SCIP_RETCODE SCIPsetConshdlrInit(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
Definition scip_cons.c:396
SCIP_CONSHDLRDATA * SCIPconshdlrGetData(SCIP_CONSHDLR *conshdlr)
Definition cons.c:4340
SCIP_RETCODE SCIPsetConshdlrExit(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
Definition scip_cons.c:420
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
Definition cons.c:8413
SCIP_Bool SCIPisExact(SCIP *scip)
Definition scip_exact.c:193
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition heur.c:1467
SCIP_RETCODE SCIPchgVarLbDive(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition scip_lp.c:2384
SCIP_RETCODE SCIPchgVarUbDive(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition scip_lp.c:2416
SCIP_Bool SCIPinDive(SCIP *scip)
Definition scip_lp.c:2740
SCIP_RETCODE SCIPsolveExactDiveLP(SCIP *scip, int itlim, SCIP_Bool *lperror, SCIP_Bool *cutoff)
SCIP_Bool SCIPisExactDivePossible(SCIP *scip)
SCIP_RETCODE SCIPchgVarLbExactDive(SCIP *scip, SCIP_VAR *var, SCIP_RATIONAL *newbound)
SCIP_LPSOLSTAT SCIPgetLPExactSolstat(SCIP *scip)
SCIP_RETCODE SCIPstartExactDive(SCIP *scip)
SCIP_RETCODE SCIPendExactDive(SCIP *scip)
SCIP_RETCODE SCIPchgVarUbExactDive(SCIP *scip, SCIP_VAR *var, SCIP_RATIONAL *newbound)
SCIP_Bool SCIPinExactDive(SCIP *scip)
SCIP_RETCODE SCIPflushLP(SCIP *scip)
Definition scip_lp.c:154
SCIP_Bool SCIPhasCurrentNodeLP(SCIP *scip)
Definition scip_lp.c:87
SCIP_RETCODE SCIPconstructLP(SCIP *scip, SCIP_Bool *cutoff)
Definition scip_lp.c:130
SCIP_Bool SCIPisLPConstructed(SCIP *scip)
Definition scip_lp.c:105
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition scip_mem.h:110
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition scip_mem.c:57
#define SCIPallocClearBlockMemoryArray(scip, ptr, num)
Definition scip_mem.h:97
BMS_BUFMEM * SCIPbuffer(SCIP *scip)
Definition scip_mem.c:72
#define SCIPallocBlockMemoryArray(scip, ptr, num)
Definition scip_mem.h:93
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
Definition scip_mem.h:99
#define SCIPfreeBlockMemory(scip, ptr)
Definition scip_mem.h:108
#define SCIPallocBlockMemory(scip, ptr)
Definition scip_mem.h:89
SCIP_NODETYPE SCIPnodeGetType(SCIP_NODE *node)
Definition tree.c:8503
void SCIPrationalRoundInteger(SCIP_RATIONAL *res, SCIP_RATIONAL *src, SCIP_ROUNDMODE_RAT roundmode)
void SCIPrationalSetReal(SCIP_RATIONAL *res, SCIP_Real real)
Definition rational.cpp:604
void SCIPrationalFreeBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **rational)
Definition rational.cpp:474
SCIP_RETCODE SCIPrationalCreateBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **rational)
Definition rational.cpp:124
SCIP_Bool SCIPrationalIsEQ(SCIP_RATIONAL *rat1, SCIP_RATIONAL *rat2)
SCIP_Bool SCIPrationalIsLE(SCIP_RATIONAL *rat1, SCIP_RATIONAL *rat2)
SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
Definition lp.c:17686
SCIP_Real SCIProwGetRhs(SCIP_ROW *row)
Definition lp.c:17696
SCIP_Real SCIPgetRowSolActivity(SCIP *scip, SCIP_ROW *row, SCIP_SOL *sol)
Definition scip_lp.c:2108
SCIP_RETCODE SCIPcreateSolCopy(SCIP *scip, SCIP_SOL **sol, SCIP_SOL *sourcesol)
Definition scip_sol.c:882
SCIP_RETCODE SCIPprintSol(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)
Definition scip_sol.c:2351
SCIP_RETCODE SCIPtrySolFreeExact(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:4525
SCIP_RETCODE SCIPoverwriteFPsol(SCIP *scip, SCIP_SOL *sol)
Definition scip_sol.c:4494
SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
Definition sol.c:4274
SCIP_RETCODE SCIPunlinkSol(SCIP *scip, SCIP_SOL *sol)
Definition scip_sol.c:1504
SCIP_RETCODE SCIPcreateLPSolExact(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition scip_sol.c:634
SCIP_SOLTYPE SCIPsolGetType(SCIP_SOL *sol)
Definition sol.c:4336
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
Definition scip_sol.c:1763
SCIP_Real SCIPgetSolTransObj(SCIP *scip, SCIP_SOL *sol)
Definition scip_sol.c:2003
void SCIPsolSetHeur(SCIP_SOL *sol, SCIP_HEUR *heur)
Definition sol.c:4319
SCIP_Bool SCIPsolIsExact(SCIP_SOL *sol)
Definition sol.c:4165
SCIP_Real SCIPgetUpperbound(SCIP *scip)
SCIP_Real SCIPround(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
Definition scip_tree.c:91
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
Definition var.c:23485
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
Definition var.c:24174
SCIP_VARSTATUS SCIPvarGetStatusExact(SCIP_VAR *var)
Definition var.c:23428
int SCIPvarGetIndex(SCIP_VAR *var)
Definition var.c:23684
SCIP_RATIONAL * SCIPvarGetUbLocalExact(SCIP_VAR *var)
Definition var.c:24310
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
Definition var.c:23522
SCIP_RATIONAL * SCIPvarGetLbGlobalExact(SCIP_VAR *var)
Definition var.c:24162
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
Definition var.c:24152
SCIP_RATIONAL * SCIPvarGetLbLocalExact(SCIP_VAR *var)
Definition var.c:24276
SCIP_IMPLINTTYPE SCIPvarGetImplType(SCIP_VAR *var)
Definition var.c:23495
SCIP_RATIONAL * SCIPvarGetUbGlobalExact(SCIP_VAR *var)
Definition var.c:24184
void SCIPsortPtr(void **ptrarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
return SCIP_OKAY
SCIPfreeSol(scip, &heurdata->sol))
SCIP_Bool lperror
int c
SCIP_Bool cutoff
static SCIP_SOL * sol
assert(minobj< SCIPgetCutoffbound(scip))
int nvars
static SCIP_VAR ** vars
SCIP_RATIONAL * SCIPconsGetRhsExact(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
SCIP_RATIONAL * SCIPconsGetLhsExact(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
SCIP_ROW * SCIPconsGetRow(SCIP *scip, SCIP_CONS *cons)
public methods for managing constraints
public methods for primal heuristics
public methods for LP management
public methods for LP management
public methods for message output
#define SCIPerrorMessage
Definition pub_message.h:64
#define SCIPdebug(x)
Definition pub_message.h:93
#define SCIPdebugMessage
Definition pub_message.h:96
public data structures and miscellaneous methods
public methods for primal CIP solutions
public methods for problem variables
wrapper for rational number arithmetic
public methods for certified solving
public methods for constraint handler plugins and constraints
public methods for exact solving
general public methods
public methods for the LP relaxation, rows and columns
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 querying solving statistics
public methods for the branch-and-bound tree
internal methods for global SCIP settings
SCIP_Longint * vals
#define SCIP_DECL_CONSENFOLP(x)
Definition type_cons.h:363
struct SCIP_Cons SCIP_CONS
Definition type_cons.h:63
#define SCIP_DECL_CONSEXIT(x)
Definition type_cons.h:136
struct SCIP_ConshdlrData SCIP_CONSHDLRDATA
Definition type_cons.h:64
#define SCIP_DECL_CONSENFORELAX(x)
Definition type_cons.h:388
#define SCIP_DECL_CONSENFOPS(x)
Definition type_cons.h:431
#define SCIP_DECL_CONSLOCK(x)
Definition type_cons.h:676
struct SCIP_Conshdlr SCIP_CONSHDLR
Definition type_cons.h:62
#define SCIP_DECL_CONSINIT(x)
Definition type_cons.h:126
#define SCIP_DECL_CONSCHECK(x)
Definition type_cons.h:474
#define SCIP_DECL_CONSHDLRCOPY(x)
Definition type_cons.h:108
#define SCIP_DECL_CONSFREE(x)
Definition type_cons.h:116
struct SCIP_Row SCIP_ROW
Definition type_lp.h:105
@ SCIP_LPSOLSTAT_OPTIMAL
Definition type_lp.h:44
#define SCIP_DECL_HASHKEYEQ(x)
Definition type_misc.h:195
#define SCIP_DECL_HASHGETKEY(x)
Definition type_misc.h:192
#define SCIP_DECL_HASHKEYVAL(x)
Definition type_misc.h:198
struct SCIP_HashTable SCIP_HASHTABLE
Definition type_misc.h:88
struct SCIP_Rational SCIP_RATIONAL
@ SCIP_R_ROUND_NEAREST
@ SCIP_FEASIBLE
Definition type_result.h:45
@ SCIP_INFEASIBLE
Definition type_result.h:46
@ SCIP_INVALIDCALL
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
Definition type_scip.h:39
@ SCIP_STAGE_SOLVING
Definition type_set.h:53
@ SCIP_SOLTYPE_HEUR
Definition type_sol.h:65
struct SCIP_Sol SCIP_SOL
Definition type_sol.h:57
@ SCIP_NODETYPE_FOCUSNODE
Definition type_tree.h:41
struct SCIP_Var SCIP_VAR
Definition type_var.h:166
@ SCIP_IMPLINTTYPE_WEAK
Definition type_var.h:91
@ SCIP_VARTYPE_CONTINUOUS
Definition type_var.h:71
@ SCIP_VARSTATUS_COLUMN
Definition type_var.h:53