SCIP Doxygen Documentation
 
Loading...
Searching...
No Matches
nlhdlr.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-2024 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 nlhdlr.c
26 * @ingroup OTHER_CFILES
27 * @brief functions for nonlinearity handlers of nonlinear constraint handler
28 * @author Ksenia Bestuzheva
29 * @author Benjamin Mueller
30 * @author Felipe Serrano
31 * @author Stefan Vigerske
32 */
33
34#include <assert.h>
35#include <string.h>
36
37#include "scip/pub_nlhdlr.h"
38#include "scip/nlhdlr.h"
39#include "scip/struct_nlhdlr.h"
40#include "scip/scip_timing.h"
41#include "scip/scip_mem.h"
42#include "scip/scip_param.h"
43#include "scip/scip_message.h"
44#include "scip/pub_message.h"
45#include "scip/pub_misc.h"
46
47/**@addtogroup PublicNlhdlrInterfaceMethods
48 * @{
49 */
50
51#ifdef NDEBUG
52/* Undo the defines from pub_nlhdlr.h, which exist if NDEBUG is defined. */
53#undef SCIPnlhdlrSetCopyHdlr
54#undef SCIPnlhdlrSetFreeHdlrData
55#undef SCIPnlhdlrSetFreeExprData
56#undef SCIPnlhdlrSetInitExit
57#undef SCIPnlhdlrSetProp
58#undef SCIPnlhdlrSetSepa
59#undef SCIPnlhdlrSetSollinearize
60#undef SCIPnlhdlrGetName
61#undef SCIPnlhdlrGetDesc
62#undef SCIPnlhdlrGetDetectPriority
63#undef SCIPnlhdlrGetEnfoPriority
64#undef SCIPnlhdlrIsEnabled
65#undef SCIPnlhdlrGetData
66#undef SCIPnlhdlrHasIntEval
67#undef SCIPnlhdlrHasReverseProp
68#undef SCIPnlhdlrHasInitSepa
69#undef SCIPnlhdlrHasExitSepa
70#undef SCIPnlhdlrHasEnfo
71#undef SCIPnlhdlrHasEstimate
72#undef SCIPnlhdlrHasSollinearize
73#endif
74
75/** sets the copy handler callback of a nonlinear handler */
77 SCIP_NLHDLR* nlhdlr, /**< nonlinear handler */
78 SCIP_DECL_NLHDLRCOPYHDLR((*copy)) /**< copy callback (can be NULL) */
79 )
80{
81 assert(nlhdlr != NULL);
82
83 nlhdlr->copyhdlr = copy;
84}
85
86/** sets the nonlinear handler callback to free the nonlinear handler data */
88 SCIP_NLHDLR* nlhdlr, /**< nonlinear handler */
89 SCIP_DECL_NLHDLRFREEHDLRDATA((*freehdlrdata)) /**< handler free callback (can be NULL) */
90 )
91{
92 assert(nlhdlr != NULL);
93
94 nlhdlr->freehdlrdata = freehdlrdata;
95}
96
97/** sets the nonlinear handler callback to free expression specific data of nonlinear handler */
99 SCIP_NLHDLR* nlhdlr, /**< nonlinear handler */
100 SCIP_DECL_NLHDLRFREEEXPRDATA((*freeexprdata)) /**< nonlinear handler expression data free callback
101 * (can be NULL if data does not need to be freed) */
102 )
103{
104 assert(nlhdlr != NULL);
105
106 nlhdlr->freeexprdata = freeexprdata;
107}
108
109/** sets the initialization and deinitialization callback of a nonlinear handler */
111 SCIP_NLHDLR* nlhdlr, /**< nonlinear handler */
112 SCIP_DECL_NLHDLRINIT((*init)), /**< initialization callback (can be NULL) */
113 SCIP_DECL_NLHDLREXIT((*exit_)) /**< deinitialization callback (can be NULL) */
114 )
115{
116 assert(nlhdlr != NULL);
117
118 nlhdlr->init = init;
119 nlhdlr->exit = exit_;
120}
121
122/** sets the propagation callbacks of a nonlinear handler */
124 SCIP_NLHDLR* nlhdlr, /**< nonlinear handler */
125 SCIP_DECL_NLHDLRINTEVAL((*inteval)), /**< interval evaluation callback (can be NULL) */
126 SCIP_DECL_NLHDLRREVERSEPROP((*reverseprop)) /**< reverse propagation callback (can be NULL) */
127 )
128{
129 assert(nlhdlr != NULL);
130
131 nlhdlr->inteval = inteval;
132 nlhdlr->reverseprop = reverseprop;
133}
134
135/** sets the enforcement callbacks of a nonlinear handler */
137 SCIP_NLHDLR* nlhdlr, /**< nonlinear handler */
138 SCIP_DECL_NLHDLRINITSEPA((*initsepa)), /**< separation initialization callback (can be NULL) */
139 SCIP_DECL_NLHDLRENFO((*enfo)), /**< enforcement callback (can be NULL if estimate is not NULL) */
140 SCIP_DECL_NLHDLRESTIMATE((*estimate)), /**< estimation callback (can be NULL if sepa is not NULL) */
141 SCIP_DECL_NLHDLREXITSEPA((*exitsepa)) /**< separation deinitialization callback (can be NULL) */
142 )
143{
144 assert(nlhdlr != NULL);
145 assert(enfo != NULL || estimate != NULL);
146
147 nlhdlr->initsepa = initsepa;
148 nlhdlr->enfo = enfo;
149 nlhdlr->estimate = estimate;
150 nlhdlr->exitsepa = exitsepa;
151}
152
153/** sets the solution linearization callback of a nonlinear handler */
155 SCIP_NLHDLR* nlhdlr, /**< nonlinear handler */
156 SCIP_DECL_NLHDLRSOLLINEARIZE((*sollinearize)) /**< solution linearization callback */
157 )
158{
159 assert(nlhdlr != NULL);
161
162 nlhdlr->sollinearize = sollinearize;
163}
164
165/** gives name of nonlinear handler */
167 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */
168 )
169{
170 assert(nlhdlr != NULL);
171
172 return nlhdlr->name;
173}
174
175/** gives description of nonlinear handler, can be NULL */
177 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */
178 )
179{
180 assert(nlhdlr != NULL);
181
182 return nlhdlr->desc;
183}
184
185/** gives detection priority of nonlinear handler */
187 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */
188 )
189{
190 assert(nlhdlr != NULL);
191
192 return nlhdlr->detectpriority;
193}
194
195/** gives enforcement priority of nonlinear handler */
197 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */
198 )
199{
200 assert(nlhdlr != NULL);
201
202 return nlhdlr->enfopriority;
203}
204
205/** returns whether nonlinear handler is enabled */
207 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */
208 )
209{
210 assert(nlhdlr != NULL);
211
212 return nlhdlr->enabled;
213}
214
215/** gives handler data of nonlinear handler */
217 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */
218 )
219{
220 assert(nlhdlr != NULL);
221
222 return nlhdlr->data;
223}
224
225/** returns whether nonlinear handler implements the interval evaluation callback */
227 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */
228 )
229{
230 assert(nlhdlr != NULL);
231
232 return nlhdlr->inteval != NULL;
233}
234
235/** returns whether nonlinear handler implements the reverse propagation callback */
237 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */
238 )
239{
240 assert(nlhdlr != NULL);
241
242 return nlhdlr->reverseprop != NULL;
243}
244
245/** returns whether nonlinear handler implements the separation initialization callback */
247 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */
248 )
249{
250 assert(nlhdlr != NULL);
251
252 return nlhdlr->initsepa != NULL;
253}
254
255/** returns whether nonlinear handler implements the separation deinitialization callback */
257 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */
258 )
259{
260 assert(nlhdlr != NULL);
261
262 return nlhdlr->exitsepa != NULL;
263}
264
265/** returns whether nonlinear handler implements the enforcement callback */
267 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */
268 )
269{
270 assert(nlhdlr != NULL);
271
272 return nlhdlr->enfo != NULL;
273}
274
275/** returns whether nonlinear handler implements the estimator callback */
277 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */
278 )
279{
280 assert(nlhdlr != NULL);
281
282 return nlhdlr->estimate != NULL;
283}
284
285/** returns whether nonlinear handler implements the solution linearization callback */
287 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */
288 )
289{
290 assert(nlhdlr != NULL);
291
292 return nlhdlr->sollinearize != NULL;
293}
294
295/** compares two nonlinear handlers by detection priority
296 *
297 * if handlers have same detection priority, then compare by name
298 */
300{
303
304 assert(elem1 != NULL);
305 assert(elem2 != NULL);
306
307 h1 = (SCIP_NLHDLR*)elem1;
308 h2 = (SCIP_NLHDLR*)elem2;
309
310 if( h1->detectpriority != h2->detectpriority )
311 return h1->detectpriority - h2->detectpriority;
312
313 return strcmp(h1->name, h2->name);
314}
315
316#ifdef SCIP_DISABLED_CODE
317/** compares nonlinear handler by enforcement priority
318 *
319 * if handlers have same enforcement priority, then compare by detection priority, then by name
320 */
322{
325
326 assert(elem1 != NULL);
327 assert(elem2 != NULL);
328
329 h1 = (SCIP_NLHDLR*)elem1;
330 h2 = (SCIP_NLHDLR*)elem2;
331
332 if( h1->enfopriority != h2->enfopriority )
333 return h1->enfopriority - h2->enfopriority;
334
335 if( h1->detectpriority != h2->detectpriority )
336 return h1->detectpriority - h2->detectpriority;
337
338 return strcmp(h1->name, h2->name);
339}
340#endif
341
342/** @} */
343
344/* nlhdlr private API functions from nlhdlr.h */
345
346#ifndef NDEBUG
347#undef SCIPnlhdlrResetNDetectionslast
348#undef SCIPnlhdlrIncrementNCutoffs
349#undef SCIPnlhdlrIncrementNSeparated
350#endif
351
352/** creates a nonlinear handler */
354 SCIP* scip, /**< SCIP data structure */
355 SCIP_NLHDLR** nlhdlr, /**< buffer to store pointer to created nonlinear handler */
356 const char* name, /**< name of nonlinear handler (must not be NULL) */
357 const char* desc, /**< description of nonlinear handler (can be NULL) */
358 int detectpriority, /**< detection priority of nonlinear handler */
359 int enfopriority, /**< enforcement priority of nonlinear handler */
360 SCIP_DECL_NLHDLRDETECT((*detect)), /**< structure detection callback of nonlinear handler */
361 SCIP_DECL_NLHDLREVALAUX((*evalaux)), /**< auxiliary evaluation callback of nonlinear handler */
362 SCIP_NLHDLRDATA* nlhdlrdata /**< data of nonlinear handler (can be NULL) */
363 )
364{
366
367 assert(scip != NULL);
368 assert(nlhdlr != NULL);
369 assert(name != NULL);
370 assert(detect != NULL);
371 assert(evalaux != NULL);
372
374
375 SCIP_CALL( SCIPduplicateMemoryArray(scip, &(*nlhdlr)->name, name, strlen(name)+1) );
376 if( desc != NULL )
377 {
378 SCIP_CALL_FINALLY( SCIPduplicateMemoryArray(scip, &(*nlhdlr)->desc, desc, strlen(desc)+1),
379 SCIPfreeMemoryArray(scip, &(*nlhdlr)->name) );
380 }
381
382 (*nlhdlr)->detectpriority = detectpriority;
383 (*nlhdlr)->enfopriority = enfopriority;
384 (*nlhdlr)->data = nlhdlrdata;
385 (*nlhdlr)->detect = detect;
386 (*nlhdlr)->evalaux = evalaux;
387
388 SCIP_CALL( SCIPcreateClock(scip, &(*nlhdlr)->detecttime) );
389 SCIP_CALL( SCIPcreateClock(scip, &(*nlhdlr)->enfotime) );
390 SCIP_CALL( SCIPcreateClock(scip, &(*nlhdlr)->proptime) );
391 SCIP_CALL( SCIPcreateClock(scip, &(*nlhdlr)->intevaltime) );
392
393 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "nlhdlr/%s/enabled", name);
394 SCIP_CALL( SCIPaddBoolParam(scip, paramname, "should this nonlinear handler be used",
395 &(*nlhdlr)->enabled, FALSE, TRUE, NULL, NULL) );
396
397 return SCIP_OKAY;
398}
399
400/** frees a nonlinear handler */
402 SCIP* scip, /**< SCIP data structure */
403 SCIP_NLHDLR** nlhdlr /**< pointer to nonlinear handler to be freed */
404 )
405{
406 assert(nlhdlr != NULL);
407 assert(*nlhdlr != NULL);
408
409 if( (*nlhdlr)->freehdlrdata != NULL )
410 {
411 SCIP_CALL( (*nlhdlr)->freehdlrdata(scip, *nlhdlr, &(*nlhdlr)->data) );
412 }
413
414 /* free clocks */
415 SCIP_CALL( SCIPfreeClock(scip, &(*nlhdlr)->detecttime) );
416 SCIP_CALL( SCIPfreeClock(scip, &(*nlhdlr)->enfotime) );
417 SCIP_CALL( SCIPfreeClock(scip, &(*nlhdlr)->proptime) );
418 SCIP_CALL( SCIPfreeClock(scip, &(*nlhdlr)->intevaltime) );
419
420 SCIPfreeMemory(scip, &(*nlhdlr)->name);
421 SCIPfreeMemoryNull(scip, &(*nlhdlr)->desc);
422
423 SCIPfreeBlockMemory(scip, nlhdlr);
424
425 return SCIP_OKAY;
426}
427
428/** call the handler copy callback of a nonlinear handler */
430{
431 /* TODO for now just don't copy disabled nlhdlr, a clean way would probably be to first copy and disable then */
432 if( sourcenlhdlr->copyhdlr != NULL && sourcenlhdlr->enabled )
433 {
435 }
436
437 return SCIP_OKAY;
438}
439
440/** call the free expression specific data callback of a nonlinear handler */
442{
443 assert(nlhdlr != NULL);
444 assert(nlhdlrexprdata != NULL);
445 assert(*nlhdlrexprdata != NULL);
446
447 if( nlhdlr->freeexprdata != NULL )
448 {
449 SCIP_CALL( nlhdlr->freeexprdata(scip, nlhdlr, expr, nlhdlrexprdata) );
450 assert(*nlhdlrexprdata == NULL);
451 }
452
453 return SCIP_OKAY;
454}
455
456/** call the initialization callback of a nonlinear handler */
458{
459 assert(nlhdlr != NULL);
460
461 nlhdlr->nenfocalls = 0;
462 nlhdlr->nintevalcalls = 0;
463 nlhdlr->npropcalls = 0;
464 nlhdlr->nseparated = 0;
465 nlhdlr->ncutoffs = 0;
466 nlhdlr->ndomreds = 0;
467 nlhdlr->nbranchscores = 0;
468 nlhdlr->ndetections = 0;
469 nlhdlr->ndetectionslast = 0;
470
475
476 if( nlhdlr->init != NULL )
477 {
478 SCIP_CALL( nlhdlr->init(scip, nlhdlr) );
479 }
480
481 return SCIP_OKAY;
482}
483
484/** call the deinitialization callback of a nonlinear handler */
486{
487 assert(nlhdlr != NULL);
488
489 if( nlhdlr->exit != NULL )
490 {
491 SCIP_CALL( nlhdlr->exit(scip, nlhdlr) );
492 }
493
494 return SCIP_OKAY;
495}
496
497/** call the detect callback of a nonlinear handler */
499{
500 assert(scip != NULL);
501 assert(nlhdlr != NULL);
502 assert(nlhdlr->detect != NULL);
503 assert(nlhdlr->detecttime != NULL);
505
507 SCIP_CALL( nlhdlr->detect(scip, conshdlr, nlhdlr, expr, cons, enforcing, participating, nlhdlrexprdata) );
509
511 {
512 ++nlhdlr->ndetections;
513 ++nlhdlr->ndetectionslast;
514 }
515
516 return SCIP_OKAY;
517}
518
519/** call the auxiliary evaluation callback of a nonlinear handler */
521{
522 assert(nlhdlr != NULL);
523 assert(nlhdlr->evalaux != NULL);
524
525 SCIP_CALL( nlhdlr->evalaux(scip, nlhdlr, expr, nlhdlrexprdata, auxvalue, sol) );
526
527 return SCIP_OKAY;
528}
529
530/** call the interval evaluation callback of a nonlinear handler */
532{
533 assert(scip != NULL);
534 assert(nlhdlr != NULL);
535 assert(nlhdlr->intevaltime != NULL);
536
537 if( nlhdlr->inteval != NULL )
538 {
540 SCIP_CALL( nlhdlr->inteval(scip, nlhdlr, expr, nlhdlrexprdata, interval, intevalvar, intevalvardata) );
542
543 ++nlhdlr->nintevalcalls;
544 }
545
546 return SCIP_OKAY;
547}
548
549/** call the reverse propagation callback of a nonlinear handler */
551{
552 assert(scip != NULL);
553 assert(nlhdlr != NULL);
554 assert(nlhdlr->proptime != NULL);
555 assert(infeasible != NULL);
556 assert(nreductions != NULL);
557
558 if( nlhdlr->reverseprop == NULL )
559 {
560 *infeasible = FALSE;
561 *nreductions = 0;
562
563 return SCIP_OKAY;
564 }
565
567 SCIP_CALL( nlhdlr->reverseprop(scip, conshdlr, nlhdlr, expr, nlhdlrexprdata, bounds, infeasible, nreductions) );
569
570 /* update statistics */
571 nlhdlr->ndomreds += *nreductions;
572 if( *infeasible )
573 ++nlhdlr->ncutoffs;
574 ++nlhdlr->npropcalls;
575
576 return SCIP_OKAY;
577}
578
579/** call the separation initialization callback of a nonlinear handler */
581{
582 assert(scip != NULL);
583 assert(nlhdlr != NULL);
584 assert(nlhdlr->enfotime != NULL);
585 assert(infeasible != NULL);
586
587 if( nlhdlr->initsepa == NULL )
588 {
589 *infeasible = FALSE;
590 return SCIP_OKAY;
591 }
592
594 SCIP_CALL( nlhdlr->initsepa(scip, conshdlr, cons, nlhdlr, expr, nlhdlrexprdata, overestimate, underestimate, infeasible) );
596
597 ++nlhdlr->nenfocalls;
598 if( *infeasible )
599 ++nlhdlr->ncutoffs;
600
601 return SCIP_OKAY;
602}
603
604/** call the separation deinitialization callback of a nonlinear handler */
606{
607 assert(scip != NULL);
608 assert(nlhdlr != NULL);
609 assert(nlhdlr->enfotime != NULL);
610
611 if( nlhdlr->exitsepa != NULL )
612 {
614 SCIP_CALL( nlhdlr->exitsepa(scip, nlhdlr, expr, nlhdlrexprdata) );
616 }
617
618 return SCIP_OKAY;
619}
620
621/** call the enforcement callback of a nonlinear handler */
623{
624 assert(scip != NULL);
625 assert(nlhdlr != NULL);
626 assert(nlhdlr->enfotime != NULL);
627 assert(result != NULL);
628
629 if( nlhdlr->enfo == NULL )
630 {
632 return SCIP_OKAY;
633 }
634
635#ifndef NDEBUG
636 /* check that auxvalue is correct by reevaluating */
637 {
638 SCIP_Real auxvaluetest;
639 SCIP_CALL( SCIPnlhdlrEvalaux(scip, nlhdlr, expr, nlhdlrexprdata, &auxvaluetest, sol) );
640 /* we should get EXACTLY the same value from calling evalaux with the same solution as before */
641 assert(auxvalue == auxvaluetest); /*lint !e777*/
642 }
643#endif
644
646 SCIP_CALL( nlhdlr->enfo(scip, conshdlr, cons, nlhdlr, expr, nlhdlrexprdata, sol, auxvalue,
647 overestimate, allowweakcuts, separated, addbranchscores, result) );
649
650 /* update statistics */
651 ++nlhdlr->nenfocalls;
652 switch( *result )
653 {
654 case SCIP_SEPARATED :
655 ++nlhdlr->nseparated;
656 break;
657 case SCIP_BRANCHED:
658 ++nlhdlr->nbranchscores;
659 break;
660 case SCIP_CUTOFF:
661 ++nlhdlr->ncutoffs;
662 break;
663 case SCIP_REDUCEDDOM:
664 ++nlhdlr->ndomreds;
665 break;
666 default: ;
667 } /*lint !e788*/
668
669 return SCIP_OKAY;
670}
671
672/** call the estimator callback of a nonlinear handler */
674{
675 assert(scip != NULL);
676 assert(nlhdlr != NULL);
677 assert(nlhdlr->enfotime != NULL);
678 assert(success != NULL);
680
681 if( nlhdlr->estimate == NULL )
682 {
683 *success = FALSE;
685 return SCIP_OKAY;
686 }
687
688#ifndef NDEBUG
689 /* check that auxvalue is correct by reevaluating */
690 {
691 SCIP_Real auxvaluetest;
692 SCIP_CALL( SCIPnlhdlrEvalaux(scip, nlhdlr, expr, nlhdlrexprdata, &auxvaluetest, sol) );
693 /* we should get EXACTLY the same value from calling evalaux with the same solution as before */
694 assert(auxvalue == auxvaluetest); /*lint !e777*/
695 }
696#endif
697
699 SCIP_CALL( nlhdlr->estimate(scip, conshdlr, nlhdlr, expr, nlhdlrexprdata, sol, auxvalue, overestimate, targetvalue, addbranchscores, rowpreps, success, addedbranchscores) );
701
702 /* update statistics */
703 ++nlhdlr->nenfocalls;
704
705 return SCIP_OKAY;
706}
707
708/** call the solution notification callback of a nonlinear handler */
710{
711 assert(scip != NULL);
712 assert(nlhdlr != NULL);
713
714 if( nlhdlr->sollinearize == NULL )
715 return SCIP_OKAY;
716
717 SCIP_CALL( nlhdlr->sollinearize(scip, conshdlr, cons, nlhdlr, expr, nlhdlrexprdata, sol, solisbest, overestimate, underestimate) );
718
719 return SCIP_OKAY;
720}
721
722/** reset number of detections counter for last round */
724 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */
725 )
726{
727 assert(nlhdlr != NULL);
728 nlhdlr->ndetectionslast = 0;
729}
730
731/** increments number of cutoffs in statistics */
733 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */
734 )
735{
736 assert(nlhdlr != NULL);
737 ++nlhdlr->ncutoffs;
738}
739
740/** increments number of separations in statistics */
742 SCIP_NLHDLR* nlhdlr /**< nonlinear handler */
743 )
744{
745 assert(nlhdlr != NULL);
746 ++nlhdlr->nseparated;
747}
748
749/** print statistics for nonlinear handlers */
751 SCIP* scip, /**< SCIP data structure */
752 SCIP_NLHDLR** nlhdlrs, /**< nonlinear handlers */
753 int nnlhdlrs, /**< number of nonlinear handlers */
754 FILE* file /**< file handle, or NULL for standard out */
755 )
756{
757 int i;
758
759 SCIPinfoMessage(scip, file, "Nlhdlrs : %10s %10s %10s %10s %10s %10s %10s %10s %10s %10s %10s %10s %10s\n",
760 "Detects", "DetectAll", "DetectTime",
761 "#IntEval", "IntEvalTi",
762 "#RevProp", "RevPropTi", "DomReds", "Cutoffs",
763 "#Enforce", "EnfoTime", "Cuts", "Branching");
764
765 for( i = 0; i < nnlhdlrs; ++i )
766 {
767 /* skip disabled nlhdlr */
768 if( !nlhdlrs[i]->enabled )
769 continue;
770
771 SCIPinfoMessage(scip, file, " %-17s:", nlhdlrs[i]->name);
772 SCIPinfoMessage(scip, file, " %10lld", nlhdlrs[i]->ndetectionslast);
773 SCIPinfoMessage(scip, file, " %10lld", nlhdlrs[i]->ndetections);
774 SCIPinfoMessage(scip, file, " %10.2f", SCIPgetClockTime(scip, nlhdlrs[i]->detecttime));
775
776 SCIPinfoMessage(scip, file, " %10lld", nlhdlrs[i]->nintevalcalls);
777 SCIPinfoMessage(scip, file, " %10.2f", SCIPgetClockTime(scip, nlhdlrs[i]->intevaltime));
778
779 SCIPinfoMessage(scip, file, " %10lld", nlhdlrs[i]->npropcalls);
780 SCIPinfoMessage(scip, file, " %10.2f", SCIPgetClockTime(scip, nlhdlrs[i]->proptime));
781 SCIPinfoMessage(scip, file, " %10lld", nlhdlrs[i]->ndomreds);
782 SCIPinfoMessage(scip, file, " %10lld", nlhdlrs[i]->ncutoffs);
783
784 SCIPinfoMessage(scip, file, " %10lld", nlhdlrs[i]->nenfocalls);
785 SCIPinfoMessage(scip, file, " %10.2f", SCIPgetClockTime(scip, nlhdlrs[i]->enfotime));
786 SCIPinfoMessage(scip, file, " %10lld", nlhdlrs[i]->nseparated);
787 SCIPinfoMessage(scip, file, " %10lld", nlhdlrs[i]->nbranchscores);
788
789 SCIPinfoMessage(scip, file, "\n");
790 }
791}
#define NULL
Definition def.h:267
#define SCIP_MAXSTRLEN
Definition def.h:288
#define TRUE
Definition def.h:93
#define FALSE
Definition def.h:94
#define SCIP_CALL(x)
Definition def.h:374
#define SCIP_CALL_FINALLY(x, y)
Definition def.h:416
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
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
#define SCIPallocClearBlockMemory(scip, ptr)
Definition scip_mem.h:91
#define SCIPfreeMemoryNull(scip, ptr)
Definition scip_mem.h:79
#define SCIPduplicateMemoryArray(scip, ptr, source, num)
Definition scip_mem.h:76
#define SCIPfreeMemoryArray(scip, ptr)
Definition scip_mem.h:80
#define SCIPfreeMemory(scip, ptr)
Definition scip_mem.h:78
#define SCIPfreeBlockMemory(scip, ptr)
Definition scip_mem.h:108
void SCIPnlhdlrSetInitExit(SCIP_NLHDLR *nlhdlr, SCIP_DECL_NLHDLRINIT((*init)),)
Definition nlhdlr.c:110
const char * SCIPnlhdlrGetDesc(SCIP_NLHDLR *nlhdlr)
Definition nlhdlr.c:176
SCIP_NLHDLRDATA * SCIPnlhdlrGetData(SCIP_NLHDLR *nlhdlr)
Definition nlhdlr.c:216
void SCIPnlhdlrSetFreeExprData(SCIP_NLHDLR *nlhdlr,)
Definition nlhdlr.c:98
SCIP_Bool SCIPnlhdlrHasIntEval(SCIP_NLHDLR *nlhdlr)
Definition nlhdlr.c:226
SCIP_Bool SCIPnlhdlrHasEnfo(SCIP_NLHDLR *nlhdlr)
Definition nlhdlr.c:266
int SCIPnlhdlrGetDetectPriority(SCIP_NLHDLR *nlhdlr)
Definition nlhdlr.c:186
SCIP_Bool SCIPnlhdlrIsEnabled(SCIP_NLHDLR *nlhdlr)
Definition nlhdlr.c:206
SCIP_Bool SCIPnlhdlrHasReverseProp(SCIP_NLHDLR *nlhdlr)
Definition nlhdlr.c:236
const char * SCIPnlhdlrGetName(SCIP_NLHDLR *nlhdlr)
Definition nlhdlr.c:166
SCIP_Bool SCIPnlhdlrHasSollinearize(SCIP_NLHDLR *nlhdlr)
Definition nlhdlr.c:286
void SCIPnlhdlrSetSollinearize(SCIP_NLHDLR *nlhdlr,)
Definition nlhdlr.c:154
SCIP_Bool SCIPnlhdlrHasEstimate(SCIP_NLHDLR *nlhdlr)
Definition nlhdlr.c:276
void SCIPnlhdlrSetSepa(SCIP_NLHDLR *nlhdlr, SCIP_DECL_NLHDLRINITSEPA((*initsepa)), SCIP_DECL_NLHDLRENFO((*enfo)), SCIP_DECL_NLHDLRESTIMATE((*estimate)),)
Definition nlhdlr.c:136
void SCIPnlhdlrSetFreeHdlrData(SCIP_NLHDLR *nlhdlr,)
Definition nlhdlr.c:87
void SCIPnlhdlrSetCopyHdlr(SCIP_NLHDLR *nlhdlr,)
Definition nlhdlr.c:76
SCIP_Bool SCIPnlhdlrHasInitSepa(SCIP_NLHDLR *nlhdlr)
Definition nlhdlr.c:246
int SCIPnlhdlrGetEnfoPriority(SCIP_NLHDLR *nlhdlr)
Definition nlhdlr.c:196
void SCIPnlhdlrSetProp(SCIP_NLHDLR *nlhdlr, SCIP_DECL_NLHDLRINTEVAL((*inteval)),)
Definition nlhdlr.c:123
SCIP_Bool SCIPnlhdlrHasExitSepa(SCIP_NLHDLR *nlhdlr)
Definition nlhdlr.c:256
SCIP_RETCODE SCIPcreateClock(SCIP *scip, SCIP_CLOCK **clck)
Definition scip_timing.c:76
SCIP_RETCODE SCIPresetClock(SCIP *scip, SCIP_CLOCK *clck)
SCIP_RETCODE SCIPstopClock(SCIP *scip, SCIP_CLOCK *clck)
SCIP_RETCODE SCIPfreeClock(SCIP *scip, SCIP_CLOCK **clck)
SCIP_Real SCIPgetClockTime(SCIP *scip, SCIP_CLOCK *clck)
SCIP_RETCODE SCIPstartClock(SCIP *scip, SCIP_CLOCK *clck)
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition misc.c:10877
return SCIP_OKAY
static SCIP_SOL * sol
assert(minobj< SCIPgetCutoffbound(scip))
static const char * paramname[]
Definition lpi_msk.c:5096
SCIP_RETCODE SCIPnlhdlrFree(SCIP *scip, SCIP_NLHDLR **nlhdlr)
Definition nlhdlr.c:401
SCIP_RETCODE SCIPnlhdlrCreate(SCIP *scip, SCIP_NLHDLR **nlhdlr, const char *name, const char *desc, int detectpriority, int enfopriority, SCIP_DECL_NLHDLRDETECT((*detect)), SCIP_DECL_NLHDLREVALAUX((*evalaux)), SCIP_NLHDLRDATA *nlhdlrdata)
Definition nlhdlr.c:353
void SCIPnlhdlrPrintStatistics(SCIP *scip, SCIP_NLHDLR **nlhdlrs, int nnlhdlrs, FILE *file)
Definition nlhdlr.c:750
private functions of nonlinear handlers of nonlinear constraints
#define SCIPnlhdlrIncrementNSeparated(nlhdlr)
Definition nlhdlr.h:131
#define SCIPnlhdlrResetNDetectionslast(nlhdlr)
Definition nlhdlr.h:129
#define SCIPnlhdlrIncrementNCutoffs(nlhdlr)
Definition nlhdlr.h:130
public methods for message output
public data structures and miscellaneous methods
public functions of nonlinear handlers of nonlinear constraints
public methods for memory management
public methods for message handling
public methods for SCIP parameter handling
public methods for timing
SCIP_Longint ndetections
SCIP_CLOCK * proptime
SCIP_CLOCK * detecttime
SCIP_Bool enabled
SCIP_Longint npropcalls
SCIP_CLOCK * enfotime
SCIP_CLOCK * intevaltime
SCIP_NLHDLRDATA * data
SCIP_Longint ndetectionslast
SCIP_Longint ncutoffs
SCIP_Longint nseparated
SCIP_Longint nenfocalls
SCIP_Longint ndomreds
SCIP_Longint nintevalcalls
SCIP_Longint nbranchscores
structure definitions related to nonlinear handlers of nonlinear constraints
#define SCIP_DECL_SORTPTRCOMP(x)
Definition type_misc.h:188
#define SCIP_DECL_NLHDLREVALAUX(x)
#define SCIP_DECL_NLHDLRESTIMATE(x)
struct SCIP_NlhdlrData SCIP_NLHDLRDATA
#define SCIP_DECL_NLHDLRCOPYHDLR(x)
Definition type_nlhdlr.h:70
#define SCIP_DECL_NLHDLRINIT(x)
#define SCIP_DECL_NLHDLRSOLLINEARIZE(x)
#define SCIP_DECL_NLHDLREXIT(x)
#define SCIP_DECL_NLHDLRFREEEXPRDATA(x)
Definition type_nlhdlr.h:94
#define SCIP_DECL_NLHDLRDETECT(x)
#define SCIP_NLHDLR_METHOD_NONE
Definition type_nlhdlr.h:50
#define SCIP_DECL_NLHDLREXITSEPA(x)
#define SCIP_DECL_NLHDLRINITSEPA(x)
#define SCIP_DECL_NLHDLRFREEHDLRDATA(x)
Definition type_nlhdlr.h:82
#define SCIP_DECL_NLHDLRREVERSEPROP(x)
#define SCIP_DECL_NLHDLRENFO(x)
#define SCIP_DECL_NLHDLRINTEVAL(x)
@ SCIP_DIDNOTRUN
Definition type_result.h:42
@ SCIP_CUTOFF
Definition type_result.h:48
@ SCIP_REDUCEDDOM
Definition type_result.h:51
@ SCIP_BRANCHED
Definition type_result.h:54
@ SCIP_SEPARATED
Definition type_result.h:49
enum SCIP_Retcode SCIP_RETCODE