Scippy

SCIP

Solving Constraint Integer Programs

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