Scippy

SCIP

Solving Constraint Integer Programs

scip_nlp.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 scip_nlp.c
26 * @ingroup OTHER_CFILES
27 * @brief public methods for nonlinear relaxation
28 * @author Thorsten Gellermann
29 * @author Stefan Vigerske
30 *
31 * @todo check all SCIP_STAGE_* switches, and include the new stages TRANSFORMED and INITSOLVE
32 */
33
34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35
37#include "scip/nlpi.h"
38#include "scip/debug.h"
39#include "scip/nlp.h"
40#include "scip/pub_message.h"
41#include "scip/pub_misc.h"
42#include "scip/pub_nlp.h"
43#include "scip/pub_paramset.h"
44#include "scip/scip_mem.h"
45#include "scip/scip_nlp.h"
46#include "scip/scip_param.h"
47#include "scip/scip_sol.h"
48#include "scip/set.h"
49#include "scip/struct_mem.h"
50#include "scip/struct_prob.h"
51#include "scip/struct_scip.h"
52#include "scip/struct_set.h"
53#include "scip/struct_var.h"
54
55/**@addtogroup PublicNLPMethods
56 * @{
57 */
58
59/** returns whether the NLP relaxation has been enabled
60 *
61 * If the NLP relaxation is enabled, then SCIP will construct the NLP relaxation when the solving process is about to begin.
62 * To check whether an NLP is existing, use SCIPisNLPConstructed().
63 *
64 * @pre This method can be called if SCIP is in one of the following stages:
65 * - \ref SCIP_STAGE_INITPRESOLVE
66 * - \ref SCIP_STAGE_PRESOLVING
67 * - \ref SCIP_STAGE_EXITPRESOLVE
68 * - \ref SCIP_STAGE_PRESOLVED
69 * - \ref SCIP_STAGE_INITSOLVE
70 * - \ref SCIP_STAGE_SOLVING
71 *
72 * @see SCIPenableNLP
73 */
75 SCIP* scip /**< SCIP data structure */
76 )
77{
79
80 return scip->transprob->nlpenabled;
81}
82
83/** notifies SCIP that the NLP relaxation should be initialized in INITSOLVE
84 *
85 * This method is typically called by a constraint handler that handles constraints that have a nonlinear representation as nonlinear rows, e.g., cons_nonlinear.
86 *
87 * The function should be called before the branch-and-bound process is initialized, e.g., when presolve is exiting.
88 *
89 * @pre This method can be called if SCIP is in one of the following stages:
90 * - \ref SCIP_STAGE_INITPRESOLVE
91 * - \ref SCIP_STAGE_PRESOLVING
92 * - \ref SCIP_STAGE_EXITPRESOLVE
93 * - \ref SCIP_STAGE_PRESOLVED
94 */
96 SCIP* scip /**< SCIP data structure */
97 )
98{
100
101 scip->transprob->nlpenabled = TRUE;
102}
103
104/** returns, whether an NLP has been constructed
105 *
106 * @pre This method can be called if SCIP is in one of the following stages:
107 * - \ref SCIP_STAGE_INITSOLVE
108 * - \ref SCIP_STAGE_SOLVING
109 */
111 SCIP* scip /**< SCIP data structure */
112 )
113{
115
116 return (scip->nlp != NULL);
117}
118
119/** checks whether the NLP has a continuous variable in a nonlinear term
120 *
121 * @pre This method can be called if SCIP is in one of the following stages:
122 * - \ref SCIP_STAGE_INITSOLVE
123 * - \ref SCIP_STAGE_SOLVING
124 */
126 SCIP* scip, /**< SCIP data structure */
127 SCIP_Bool* result /**< buffer to store result */
128 )
129{
130 SCIP_CALL( SCIPcheckStage(scip, "SCIPhasNLPContinuousNonlinearity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
131
132 if( scip->nlp == NULL )
133 {
134 SCIPerrorMessage("NLP has not been not constructed.\n");
135 return SCIP_ERROR;
136 }
137
138 SCIP_CALL( SCIPnlpHasContinuousNonlinearity(scip->nlp, scip->mem->probmem, scip->set, scip->stat, result) );
139
140 return SCIP_OKAY;
141}
142
143/** gets current NLP variables along with the current number of NLP variables
144 *
145 * @pre This method can be called if SCIP is in one of the following stages:
146 * - \ref SCIP_STAGE_INITSOLVE
147 * - \ref SCIP_STAGE_SOLVING
148 */
150 SCIP* scip, /**< SCIP data structure */
151 SCIP_VAR*** vars, /**< pointer to store the array of NLP variables, or NULL */
152 int* nvars /**< pointer to store the number of NLP variables, or NULL */
153 )
154{
156
157 if( scip->nlp != NULL )
158 {
159 if( vars != NULL )
160 *vars = SCIPnlpGetVars(scip->nlp);
161 if( nvars != NULL )
162 *nvars = SCIPnlpGetNVars(scip->nlp);
163 }
164 else
165 {
166 SCIPerrorMessage("NLP has not been constructed.\n");
167 return SCIP_INVALIDCALL;
168 }
169
170 return SCIP_OKAY;
171}
172
173/** gets array with variables of the NLP
174 *
175 * @pre This method can be called if SCIP is in one of the following stages:
176 * - \ref SCIP_STAGE_INITSOLVE
177 * - \ref SCIP_STAGE_SOLVING
178 */
180 SCIP* scip /**< SCIP data structure */
181 )
182{
184
185 if( scip->nlp == NULL )
186 {
187 SCIPerrorMessage("NLP has not been constructed.\n");
188 SCIPABORT();
189 return NULL; /*lint !e527*/
190 }
191
192 return SCIPnlpGetVars(scip->nlp);
193}
194
195/** gets current number of variables in NLP
196 *
197 * @pre This method can be called if SCIP is in one of the following stages:
198 * - \ref SCIP_STAGE_INITSOLVE
199 * - \ref SCIP_STAGE_SOLVING
200 */
202 SCIP* scip /**< SCIP data structure */
203 )
204{
206
207 if( scip->nlp == NULL )
208 {
209 SCIPerrorMessage("NLP has not been constructed.\n");
210 SCIPABORT();
211 return 0; /*lint !e527*/
212 }
213
214 return SCIPnlpGetNVars(scip->nlp);
215}
216
217/** computes for each variables the number of NLP rows in which the variable appears in the nonlinear part
218 *
219 * @pre This method can be called if SCIP is in one of the following stages:
220 * - \ref SCIP_STAGE_INITSOLVE
221 * - \ref SCIP_STAGE_SOLVING
222 */
224 SCIP* scip, /**< SCIP data structure */
225 int* nlcount /**< an array of length at least SCIPnlpGetNVars() to store nonlinearity counts of variables */
226 )
227{
228 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNLPVarsNonlinearity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
229
230 if( scip->nlp == NULL )
231 {
232 SCIPerrorMessage("NLP has not been constructed.\n");
233 return SCIP_INVALIDCALL;
234 }
235
236 SCIP_CALL( SCIPnlpGetVarsNonlinearity(scip->nlp, scip->mem->probmem, scip->set, scip->stat, nlcount) );
237
238 return SCIP_OKAY;
239}
240
241/** returns dual solution values associated with lower bounds of NLP variables
242 *
243 * @pre This method can be called if SCIP is in one of the following stages:
244 * - \ref SCIP_STAGE_INITSOLVE
245 * - \ref SCIP_STAGE_SOLVING
246 */
248 SCIP* scip /**< SCIP data structure */
249 )
250{
252
253 if( scip->nlp == NULL )
254 {
255 SCIPerrorMessage("NLP has not been constructed.\n");
256 SCIPABORT();
257 return NULL; /*lint !e527*/
258 }
259
260 return SCIPnlpGetVarsLbDualsol(scip->nlp);
261}
262
263/** returns dual solution values associated with upper bounds of NLP variables
264 *
265 * @pre This method can be called if SCIP is in one of the following stages:
266 * - \ref SCIP_STAGE_INITSOLVE
267 * - \ref SCIP_STAGE_SOLVING
268 */
270 SCIP* scip /**< SCIP data structure */
271 )
272{
274
275 if( scip->nlp == NULL )
276 {
277 SCIPerrorMessage("NLP has not been constructed.\n");
278 SCIPABORT();
279 return NULL; /*lint !e527*/
280 }
281
282 return SCIPnlpGetVarsUbDualsol(scip->nlp);
283}
284
285/** gets current NLP nonlinear rows along with the current number of NLP nonlinear rows
286 *
287 * @pre This method can be called if SCIP is in one of the following stages:
288 * - \ref SCIP_STAGE_INITSOLVE
289 * - \ref SCIP_STAGE_SOLVING
290 */
292 SCIP* scip, /**< SCIP data structure */
293 SCIP_NLROW*** nlrows, /**< pointer to store the array of NLP nonlinear rows, or NULL */
294 int* nnlrows /**< pointer to store the number of NLP nonlinear rows, or NULL */
295 )
296{
297 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNLPNlRowsData", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
298
299 if( scip->nlp == NULL )
300 {
301 SCIPerrorMessage("NLP has not been constructed.\n");
302 return SCIP_INVALIDCALL;
303 }
304
305 if( nlrows != NULL )
306 *nlrows = SCIPnlpGetNlRows(scip->nlp);
307 if( nnlrows != NULL )
308 *nnlrows = SCIPnlpGetNNlRows(scip->nlp);
309
310 return SCIP_OKAY;
311}
312
313/** gets array with nonlinear rows of the NLP
314 *
315 * @pre This method can be called if SCIP is in one of the following stages:
316 * - \ref SCIP_STAGE_INITSOLVE
317 * - \ref SCIP_STAGE_SOLVING
318 */
320 SCIP* scip /**< SCIP data structure */
321 )
322{
324
325 if( scip->nlp == NULL )
326 {
327 SCIPerrorMessage("NLP has not been constructed.\n");
328 SCIPABORT();
329 return NULL; /*lint !e527*/
330 }
331
332 return SCIPnlpGetNlRows(scip->nlp);
333}
334
335/** gets current number of nonlinear rows in NLP
336 *
337 * @pre This method can be called if SCIP is in one of the following stages:
338 * - \ref SCIP_STAGE_INITSOLVE
339 * - \ref SCIP_STAGE_SOLVING
340 */
342 SCIP* scip /**< SCIP data structure */
343 )
344{
346
347 if( scip->nlp == NULL )
348 {
349 SCIPerrorMessage("NLP has not been constructed.\n");
350 SCIPABORT();
351 return 0; /*lint !e527*/
352 }
353
354 return SCIPnlpGetNNlRows(scip->nlp);
355}
356
357/** gets statistics on convexity of rows in NLP
358 *
359 * Reports counts on the current number of linear rows, convex inequalities, nonconvex inequalities, and nonlinear equalities or ranged rows.
360 * - A nonlinear inequality with infinity left-hand-side is accounted as convex if its expression has been marked as convex.
361 * - A nonlinear inequality with infinity right-hand-side is accounted as convex if its expression has been marked as concave.
362 * - Other nonlinear rows are accounted as nonconvex. Note that convexity for a nonlinear row may just not have been detected.
363 *
364 * @pre This method can be called if SCIP is in one of the following stages:
365 * - \ref SCIP_STAGE_INITSOLVE
366 * - \ref SCIP_STAGE_SOLVING
367 * - \ref SCIP_STAGE_SOLVED
368 */
370 SCIP* scip, /**< SCIP data structure */
371 int* nlinear, /**< buffer to store number of linear rows in NLP, or NULL */
372 int* nconvexineq, /**< buffer to store number of convex inequalities in NLP, or NULL */
373 int* nnonconvexineq, /**< buffer to store number of nonconvex inequalities in NLP, or NULL */
374 int* nnonlineareq /**< buffer to store number of nonlinear equalities or ranged rows in NLP, or NULL */
375 )
376{
377 SCIP_CALL( SCIPcheckStage(scip, "SCIPnlpGetNlRowsStat", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
378
379 if( scip->nlp == NULL )
380 {
381 SCIPerrorMessage("NLP has not been constructed.\n");
382 return SCIP_ERROR;
383 }
384
385 SCIPnlpGetNlRowsStat(scip->nlp, nlinear, nconvexineq, nnonconvexineq, nnonlineareq);
386
387 return SCIP_OKAY;
388}
389
390/** adds a nonlinear row to the NLP. This row is captured by the NLP.
391 *
392 * @pre This method can be called if SCIP is in one of the following stages:
393 * - \ref SCIP_STAGE_INITSOLVE
394 * - \ref SCIP_STAGE_SOLVING
395 */
397 SCIP* scip, /**< SCIP data structure */
398 SCIP_NLROW* nlrow /**< nonlinear row to add to NLP */
399 )
400{
402
403 if( scip->nlp == NULL )
404 {
405 SCIPerrorMessage("NLP has not been constructed.\n");
406 return SCIP_INVALIDCALL;
407 }
408
409 SCIP_CALL( SCIPnlpAddNlRow(scip->nlp, SCIPblkmem(scip), scip->set, scip->stat, nlrow) );
410
411 return SCIP_OKAY;
412}
413
414/** removes a nonlinear row from the NLP
415 *
416 * This row is released in the NLP.
417 *
418 * @pre This method can be called if SCIP is in one of the following stages:
419 * - \ref SCIP_STAGE_INITSOLVE
420 * - \ref SCIP_STAGE_SOLVING
421 * - \ref SCIP_STAGE_SOLVED
422 * - \ref SCIP_STAGE_EXITSOLVE
423 */
425 SCIP* scip, /**< SCIP data structure */
426 SCIP_NLROW* nlrow /**< nonlinear row to add to NLP */
427 )
428{
430
431 if( scip->nlp == NULL )
432 {
433 SCIPerrorMessage("NLP has not been constructed.\n");
434 return SCIP_INVALIDCALL;
435 }
436
437 SCIP_CALL( SCIPnlpDelNlRow(scip->nlp, SCIPblkmem(scip), scip->set, scip->stat, nlrow) );
438
439 return SCIP_OKAY;
440}
441
442/** makes sure that the NLP of the current node is flushed
443 *
444 * @pre This method can be called if SCIP is in one of the following stages:
445 * - \ref SCIP_STAGE_INITSOLVE
446 * - \ref SCIP_STAGE_SOLVING
447 */
449 SCIP* scip /**< SCIP data structure */
450 )
451{
453
454 if( scip->nlp == NULL )
455 {
456 SCIPerrorMessage("NLP has not been constructed.\n");
457 return SCIP_INVALIDCALL;
458 }
459
460 SCIP_CALL( SCIPnlpFlush(scip->nlp, scip->mem->probmem, scip->set, scip->stat) );
461
462 return SCIP_OKAY;
463}
464
465/** sets or clears initial primal guess for NLP solution (start point for NLP solver)
466 *
467 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
468 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
469 *
470 * @pre This method can be called if SCIP is in one of the following stages:
471 * - \ref SCIP_STAGE_INITSOLVE
472 * - \ref SCIP_STAGE_SOLVING
473 */
475 SCIP* scip, /**< SCIP data structure */
476 SCIP_Real* initialguess /**< values of initial guess (corresponding to variables from SCIPgetNLPVarsData), or NULL to use no start point */
477 )
478{
479 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetNLPInitialGuess", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
480
481 if( scip->nlp == NULL )
482 {
483 SCIPerrorMessage("NLP has not been constructed.\n");
484 return SCIP_INVALIDCALL;
485 }
486
487 SCIP_CALL( SCIPnlpSetInitialGuess(scip->set, scip->nlp, SCIPblkmem(scip), initialguess) );
488
489 return SCIP_OKAY;
490}
491
492/** sets initial primal guess for NLP solution (start point for NLP solver)
493 *
494 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
495 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
496 *
497 * @pre This method can be called if SCIP is in one of the following stages:
498 * - \ref SCIP_STAGE_INITSOLVE
499 * - \ref SCIP_STAGE_SOLVING
500 */
502 SCIP* scip, /**< SCIP data structure */
503 SCIP_SOL* sol /**< solution which values should be taken as initial guess, or NULL for LP solution */
504 )
505{
506 SCIP_Real* vals;
507
508 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetNLPInitialGuessSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
509
510 if( scip->nlp == NULL )
511 {
512 SCIPerrorMessage("NLP has not been constructed.\n");
513 return SCIP_INVALIDCALL;
514 }
515
520
521 return SCIP_OKAY;
522}
523
524/** solves the current NLP (or diving NLP if in diving mode) with given parameters
525 *
526 * Typical use is
527 *
528 * SCIP_NLPPARAM nlparam = { SCIP_NLPPARAM_DEFAULT(scip); }
529 * nlpparam.iterlimit = 42;
530 * SCIP_CALL( SCIPsolveNLPParam(scip, nlpparam) );
531 *
532 * or, in one line:
533 *
534 * SCIP_CALL( SCIPsolveNLPParam(scip, (SCIP_NLPPARAM){ SCIP_NLPPARAM_DEFAULT(scip), .iterlimit = 42 }) );
535 *
536 * To get the latter, also \ref SCIPsolveNLP can be used.
537 *
538 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
539 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
540 *
541 * @pre This method can be called if SCIP is in one of the following stages:
542 * - \ref SCIP_STAGE_INITSOLVE
543 * - \ref SCIP_STAGE_SOLVING
544 */
546 SCIP* scip, /**< SCIP data structure */
547 SCIP_NLPPARAM param /**< NLP solve parameters */
548 )
549{
551
552 if( scip->nlp == NULL )
553 {
554 SCIPerrorMessage("NLP has not been constructed.\n");
555 return SCIP_INVALIDCALL;
556 }
557
558 SCIP_CALL( SCIPnlpSolve(scip->nlp, SCIPblkmem(scip), scip->set, scip->messagehdlr, scip->stat, scip->primal, scip->tree, &param) );
559
560 return SCIP_OKAY;
561}
562
563#if defined(_MSC_VER) && _MSC_VER < 1800
564/* warn that SCIPsolveNLP() macro isn't perfect with ancient MSVC */
565#pragma message ( "Warning: designated initializers not supported by this version of MSVC. Parameters given to NLP solves may be ignored." )
566#endif
567
568/** gets solution status of current NLP
569 *
570 * @pre This method can be called if SCIP is in one of the following stages:
571 * - \ref SCIP_STAGE_INITSOLVE
572 * - \ref SCIP_STAGE_SOLVING
573 */
575 SCIP* scip /**< SCIP data structure */
576 )
577{
579
580 if( scip->nlp == NULL )
581 {
582 SCIPerrorMessage("NLP has not been constructed.\n");
583 SCIPABORT();
584 return SCIP_NLPSOLSTAT_UNKNOWN; /*lint !e527*/
585 }
586
587 return SCIPnlpGetSolstat(scip->nlp);
588}
589
590/** gets termination status of last NLP solve
591 *
592 * @pre This method can be called if SCIP is in one of the following stages:
593 * - \ref SCIP_STAGE_INITSOLVE
594 * - \ref SCIP_STAGE_SOLVING
595 */
597 SCIP* scip /**< SCIP data structure */
598 )
599{
601
602 if( scip->nlp == NULL )
603 {
604 SCIPerrorMessage("NLP has not been constructed.\n");
605 SCIPABORT();
606 return SCIP_NLPTERMSTAT_OTHER; /*lint !e527*/
607 }
608
609 return SCIPnlpGetTermstat(scip->nlp);
610}
611
612/** gives statistics (number of iterations, solving time, ...) of last NLP solve
613 *
614 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
615 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
616 *
617 * @pre This method can be called if SCIP is in one of the following stages:
618 * - \ref SCIP_STAGE_INITSOLVE
619 * - \ref SCIP_STAGE_SOLVING
620 */
622 SCIP* scip, /**< SCIP data structure */
623 SCIP_NLPSTATISTICS* statistics /**< pointer to store statistics */
624 )
625{
626 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNLPStatistics", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
627
628 if( scip->nlp == NULL )
629 {
630 SCIPerrorMessage("NLP has not been constructed.\n");
631 return SCIP_INVALIDCALL;
632 }
633
634 SCIP_CALL( SCIPnlpGetStatistics(scip->set, scip->nlp, statistics) );
635
636 return SCIP_OKAY;
637}
638
639/** gets objective value of current NLP
640 *
641 * @pre This method can be called if SCIP is in one of the following stages:
642 * - \ref SCIP_STAGE_INITSOLVE
643 * - \ref SCIP_STAGE_SOLVING
644 */
646 SCIP* scip /**< SCIP data structure */
647 )
648{
650
651 if( scip->nlp != NULL )
652 {
653 return SCIPnlpGetObjval(scip->nlp);
654 }
655 else
656 {
657 SCIPerrorMessage("NLP has not been constructed.\n");
658 return SCIP_INVALID;
659 }
660}
661
662/** indicates whether a solution for the current NLP is available
663 *
664 * The solution may be optimal, feasible, or infeasible.
665 * Thus, returns whether the NLP solution status is at most \ref SCIP_NLPSOLSTAT_LOCINFEASIBLE.
666 *
667 * @pre This method can be called if SCIP is in one of the following stages:
668 * - \ref SCIP_STAGE_INITSOLVE
669 * - \ref SCIP_STAGE_SOLVING
670 */
672 SCIP* scip /**< SCIP data structure */
673 )
674{
676
677 if( scip->nlp == NULL )
678 {
679 SCIPerrorMessage("NLP has not been constructed.\n");
680 SCIPABORT();
681 return FALSE; /*lint !e527*/
682 }
683
684 return SCIPnlpHasSolution(scip->nlp);
685}
686
687/** gets fractional variables of last NLP solution along with solution values and fractionalities
688 *
689 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
690 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
691 *
692 * @pre This method can be called if SCIP is in one of the following stages:
693 * - \ref SCIP_STAGE_INITSOLVE
694 * - \ref SCIP_STAGE_SOLVING
695 */
697 SCIP* scip, /**< SCIP data structure */
698 SCIP_VAR*** fracvars, /**< pointer to store the array of NLP fractional variables, or NULL */
699 SCIP_Real** fracvarssol, /**< pointer to store the array of NLP fractional variables solution values, or NULL */
700 SCIP_Real** fracvarsfrac, /**< pointer to store the array of NLP fractional variables fractionalities, or NULL */
701 int* nfracvars, /**< pointer to store the number of NLP fractional variables , or NULL */
702 int* npriofracvars /**< pointer to store the number of NLP fractional variables with maximal branching priority, or NULL */
703 )
704{
706
707 if( scip->nlp == NULL )
708 {
709 SCIPerrorMessage("NLP has not been constructed.\n");
710 return SCIP_INVALIDCALL;
711 }
712
713 SCIP_CALL( SCIPnlpGetFracVars(scip->nlp, SCIPblkmem(scip), scip->set, scip->stat, fracvars, fracvarssol, fracvarsfrac, nfracvars, npriofracvars) );
714
715 return SCIP_OKAY;
716}
717
718/** writes current NLP to a file
719 *
720 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
721 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
722 *
723 * @pre This method can be called if SCIP is in one of the following stages:
724 * - \ref SCIP_STAGE_INITSOLVE
725 * - \ref SCIP_STAGE_SOLVING
726 */
728 SCIP* scip, /**< SCIP data structure */
729 const char* filename /**< file name */
730 )
731{
733
734 if( scip->nlp == NULL )
735 {
736 SCIPerrorMessage("NLP has not been constructed.\n");
737 return SCIP_INVALIDCALL;
738 }
739
740 SCIP_CALL( SCIPnlpWrite(scip->nlp, scip->mem->probmem, scip->set, scip->stat, scip->messagehdlr, filename) );
741
742 return SCIP_OKAY;
743}
744
745/** gets the NLP interface and problem used by the SCIP NLP
746 *
747 * @warning With the NLPI and its problem, all methods defined in \ref scip_nlpi.h and \ref pub_nlpi.h can be used.
748 * It needs to be ensured that the full internal state of the NLPI does not change or is recovered completely
749 * after the end of the method that uses the NLPI. In particular, if the NLP or its solution is manipulated
750 * (e.g. by calling one of the SCIPaddNlpi...() or the SCIPsolveNlpi() method), one has to check in advance
751 * whether the NLP is currently solved. If this is the case, one has to make sure that the internal solution
752 * status is recovered completely again. Additionally one has to resolve the NLP with
753 * SCIPsolveNlpi() in order to reinstall the internal solution status.
754 *
755 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
756 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
757 *
758 * @pre This method can be called if SCIP is in one of the following stages:
759 * - \ref SCIP_STAGE_INITSOLVE
760 * - \ref SCIP_STAGE_SOLVING
761 */
763 SCIP* scip, /**< SCIP data structure */
764 SCIP_NLPI** nlpi, /**< pointer to store the NLP solver interface */
765 SCIP_NLPIPROBLEM** nlpiproblem /**< pointer to store the NLP solver interface problem */
766 )
767{
768 assert(nlpi != NULL);
769 assert(nlpiproblem != NULL);
770
772
773 if( scip->nlp == NULL )
774 {
775 SCIPerrorMessage("NLP has not been constructed.\n");
776 return SCIP_INVALIDCALL;
777 }
778
779 *nlpi = SCIPnlpGetNLPI(scip->nlp);
780 *nlpiproblem = SCIPnlpGetNLPIProblem(scip->nlp);
781
782 return SCIP_OKAY;
783}
784
785/** @} */
786
787/**@addtogroup PublicNLPDiveMethods
788 * @{ */
789
790/** initiates NLP diving
791 *
792 * Makes functions SCIPchgVarObjDiveNLP(), SCIPchgVarBoundsDiveNLP() and SCIPchgVarsBoundsDiveNLP() available.
793 * Further, SCIPsolveNLP() can be used to solve the diving NLP.
794 *
795 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
796 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
797 *
798 * @pre This method can be called if SCIP is in one of the following stages:
799 * - \ref SCIP_STAGE_INITSOLVE
800 * - \ref SCIP_STAGE_SOLVING
801 */
803 SCIP* scip /**< SCIP data structure */
804 )
805{
807
808 if( scip->nlp == NULL )
809 {
810 SCIPerrorMessage("NLP has not been constructed.\n");
811 return SCIP_INVALIDCALL;
812 }
813
814 SCIP_CALL( SCIPnlpStartDive(scip->nlp, SCIPblkmem(scip), scip->set, scip->stat) );
815
816 return SCIP_OKAY;
817}
818
819/** ends NLP diving
820 *
821 * Resets changes made by SCIPchgVarObjDiveNLP(), SCIPchgVarBoundsDiveNLP(), and SCIPchgVarsBoundsDiveNLP().
822 *
823 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
824 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
825 *
826 * @pre This method can be called if SCIP is in one of the following stages:
827 * - \ref SCIP_STAGE_INITSOLVE
828 * - \ref SCIP_STAGE_SOLVING
829 */
831 SCIP* scip /**< SCIP data structure */
832 )
833{
835
836 if( scip->nlp == NULL )
837 {
838 SCIPerrorMessage("NLP has not been constructed.\n");
839 return SCIP_INVALIDCALL;
840 }
841
842 SCIP_CALL( SCIPnlpEndDive(scip->nlp, SCIPblkmem(scip), scip->set, scip->stat) );
843
844 return SCIP_OKAY;
845}
846
847/** changes linear objective coefficient of a variable in diving NLP
848 *
849 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
850 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
851 *
852 * @pre This method can be called if SCIP is in one of the following stages:
853 * - \ref SCIP_STAGE_INITSOLVE
854 * - \ref SCIP_STAGE_SOLVING
855 */
857 SCIP* scip, /**< SCIP data structure */
858 SCIP_VAR* var, /**< variable which coefficient to change */
859 SCIP_Real coef /**< new value for coefficient */
860 )
861{
862 SCIP_CALL( SCIPcheckStage(scip, "SCIPchgVarObjDiveNLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
863
864 assert( var->scip == scip );
865
866 if( scip->nlp == NULL )
867 {
868 SCIPerrorMessage("NLP has not been constructed.\n");
869 return SCIP_INVALIDCALL;
870 }
871
872 SCIP_CALL( SCIPnlpChgVarObjDive(scip->nlp, SCIPblkmem(scip), scip->set, scip->stat, var, coef) );
873
874 return SCIP_OKAY;
875}
876
877/** changes bounds of a variable in diving NLP
878 *
879 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
880 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
881 *
882 * @pre This method can be called if SCIP is in one of the following stages:
883 * - \ref SCIP_STAGE_INITSOLVE
884 * - \ref SCIP_STAGE_SOLVING
885 */
887 SCIP* scip, /**< SCIP data structure */
888 SCIP_VAR* var, /**< variable which bounds to change */
889 SCIP_Real lb, /**< new lower bound */
890 SCIP_Real ub /**< new upper bound */
891 )
892{
893 SCIP_CALL( SCIPcheckStage(scip, "SCIPchgVarBoundsDiveNLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
894
895 assert( var->scip == scip );
896
897 if( scip->nlp == NULL )
898 {
899 SCIPerrorMessage("NLP has not been constructed.\n");
900 return SCIP_INVALIDCALL;
901 }
902
903 SCIP_CALL( SCIPnlpChgVarBoundsDive(scip->set, scip->nlp, var, lb, ub) );
904
905 return SCIP_OKAY;
906}
907
908/** changes bounds of a set of variables in diving NLP
909 *
910 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
911 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
912 *
913 * @pre This method can be called if SCIP is in one of the following stages:
914 * - \ref SCIP_STAGE_INITSOLVE
915 * - \ref SCIP_STAGE_SOLVING
916 */
918 SCIP* scip, /**< SCIP data structure */
919 int nvars, /**< number of variables which bounds to changes */
920 SCIP_VAR** vars, /**< variables which bounds to change */
921 SCIP_Real* lbs, /**< new lower bounds */
922 SCIP_Real* ubs /**< new upper bounds */
923 )
924{
925 SCIP_CALL( SCIPcheckStage(scip, "SCIPchgVarsBoundsDiveNLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
926
927 if( scip->nlp == NULL )
928 {
929 SCIPerrorMessage("NLP has not been constructed.\n");
930 return SCIP_INVALIDCALL;
931 }
932
933 SCIP_CALL( SCIPnlpChgVarsBoundsDive(scip->nlp, scip->set, nvars, vars, lbs, ubs) );
934
935 return SCIP_OKAY;
936}
937
938/** @} */
939
940/**@addtogroup PublicNLRowMethods
941 * @{
942 */
943
944/** creates and captures a nonlinear row
945 *
946 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
947 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
948 *
949 * @pre This method can be called if SCIP is in one of the following stages:
950 * - \ref SCIP_STAGE_PRESOLVED
951 * - \ref SCIP_STAGE_INITSOLVE
952 * - \ref SCIP_STAGE_SOLVING
953 */
955 SCIP* scip, /**< SCIP data structure */
956 SCIP_NLROW** nlrow, /**< buffer to store pointer to nonlinear row */
957 const char* name, /**< name of nonlinear row */
958 SCIP_Real constant, /**< constant */
959 int nlinvars, /**< number of linear variables */
960 SCIP_VAR** linvars, /**< linear variables, or NULL if nlinvars == 0 */
961 SCIP_Real* lincoefs, /**< linear coefficients, or NULL if nlinvars == 0 */
962 SCIP_EXPR* expr, /**< nonlinear expression, or NULL */
963 SCIP_Real lhs, /**< left hand side */
964 SCIP_Real rhs, /**< right hand side */
965 SCIP_EXPRCURV curvature /**< curvature of the nonlinear row */
966 )
967{
969
970 SCIP_CALL( SCIPnlrowCreate(nlrow, scip->mem->probmem, scip->set, scip->stat,
971 name, constant, nlinvars, linvars, lincoefs, expr, lhs, rhs, curvature) );
972
973 return SCIP_OKAY;
974}
975
976/** creates and captures a nonlinear row without any coefficients
977 *
978 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
979 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
980 *
981 * @pre This method can be called if SCIP is in one of the following stages:
982 * - \ref SCIP_STAGE_PRESOLVED
983 * - \ref SCIP_STAGE_INITSOLVE
984 * - \ref SCIP_STAGE_SOLVING
985 */
987 SCIP* scip, /**< SCIP data structure */
988 SCIP_NLROW** nlrow, /**< pointer to nonlinear row */
989 const char* name, /**< name of nonlinear row */
990 SCIP_Real lhs, /**< left hand side */
991 SCIP_Real rhs /**< right hand side */
992 )
993{
994 SCIP_CALL( SCIPcheckStage(scip, "SCIPcreateEmptyNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
995
996 SCIP_CALL( SCIPnlrowCreate(nlrow, scip->mem->probmem, scip->set, scip->stat,
997 name, 0.0, 0, NULL, NULL, NULL, lhs, rhs, SCIP_EXPRCURV_UNKNOWN) );
998
999 return SCIP_OKAY;
1000}
1001
1002/** creates and captures a nonlinear row from a linear row
1003 *
1004 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1005 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1006 *
1007 * @pre This method can be called if SCIP is in one of the following stages:
1008 * - \ref SCIP_STAGE_PRESOLVED
1009 * - \ref SCIP_STAGE_INITSOLVE
1010 * - \ref SCIP_STAGE_SOLVING
1011 */
1013 SCIP* scip, /**< SCIP data structure */
1014 SCIP_NLROW** nlrow, /**< pointer to nonlinear row */
1015 SCIP_ROW* row /**< the linear row to copy */
1016 )
1017{
1018 SCIP_CALL( SCIPcheckStage(scip, "SCIPcreateNlRowFromRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1019
1020 SCIP_CALL( SCIPnlrowCreateFromRow(nlrow, scip->mem->probmem, scip->set, scip->stat, row) );
1021
1022 return SCIP_OKAY;
1023}
1024
1025/** increases usage counter of a nonlinear row
1026 *
1027 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1028 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1029 *
1030 * @pre This method can be called if SCIP is in one of the following stages:
1031 * - \ref SCIP_STAGE_PRESOLVED
1032 * - \ref SCIP_STAGE_INITSOLVE
1033 * - \ref SCIP_STAGE_SOLVING
1034 */
1036 SCIP* scip, /**< SCIP data structure */
1037 SCIP_NLROW* nlrow /**< nonlinear row to capture */
1038 )
1039{
1041
1042 SCIPnlrowCapture(nlrow);
1043
1044 return SCIP_OKAY;
1045}
1046
1047/** decreases usage counter of a nonlinear row, and frees memory if necessary
1048 *
1049 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1050 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1051 *
1052 * @pre This method can be called if SCIP is in one of the following stages:
1053 * - \ref SCIP_STAGE_PRESOLVED
1054 * - \ref SCIP_STAGE_INITSOLVE
1055 * - \ref SCIP_STAGE_SOLVING
1056 * - \ref SCIP_STAGE_EXITSOLVE
1057 */
1059 SCIP* scip, /**< SCIP data structure */
1060 SCIP_NLROW** nlrow /**< pointer to nonlinear row */
1061 )
1062{
1064
1065 SCIP_CALL( SCIPnlrowRelease(nlrow, scip->mem->probmem, scip->set, scip->stat) );
1066
1067 return SCIP_OKAY;
1068}
1069
1070/** changes left hand side of a nonlinear row
1071 *
1072 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1073 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1074 *
1075 * @pre This method can be called if SCIP is in one of the following stages:
1076 * - \ref SCIP_STAGE_PRESOLVED
1077 * - \ref SCIP_STAGE_INITSOLVE
1078 * - \ref SCIP_STAGE_SOLVING
1079 */
1081 SCIP* scip, /**< SCIP data structure */
1082 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1083 SCIP_Real lhs /**< new left hand side */
1084 )
1085{
1087
1088 SCIP_CALL( SCIPnlrowChgLhs(nlrow, scip->set, scip->stat, scip->nlp, lhs) );
1089
1090 return SCIP_OKAY;
1091}
1092
1093/** changes right hand side of a nonlinear row
1094 *
1095 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1096 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1097 *
1098 * @pre This method can be called if SCIP is in one of the following stages:
1099 * - \ref SCIP_STAGE_PRESOLVED
1100 * - \ref SCIP_STAGE_INITSOLVE
1101 * - \ref SCIP_STAGE_SOLVING
1102 */
1104 SCIP* scip, /**< SCIP data structure */
1105 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1106 SCIP_Real rhs /**< new right hand side */
1107 )
1108{
1110
1111 SCIP_CALL( SCIPnlrowChgRhs(nlrow, scip->set, scip->stat, scip->nlp, rhs) );
1112
1113 return SCIP_OKAY;
1114}
1115
1116/** changes constant of a nonlinear row
1117 *
1118 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1119 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1120 *
1121 * @pre This method can be called if SCIP is in one of the following stages:
1122 * - \ref SCIP_STAGE_PRESOLVED
1123 * - \ref SCIP_STAGE_INITSOLVE
1124 * - \ref SCIP_STAGE_SOLVING
1125 */
1127 SCIP* scip, /**< SCIP data structure */
1128 SCIP_NLROW* nlrow, /**< NLP row */
1129 SCIP_Real constant /**< new value for constant */
1130 )
1131{
1132 SCIP_CALL( SCIPcheckStage(scip, "SCIPchgNlRowConstant", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1133
1134 SCIP_CALL( SCIPnlrowChgConstant(nlrow, scip->set, scip->stat, scip->nlp, constant) );
1135
1136 return SCIP_OKAY;
1137}
1138
1139/** set curvature of a nonlinear row */
1141 SCIP* scip, /**< SCIP data structure */
1142 SCIP_NLROW* nlrow, /**< NLP row */
1143 SCIP_EXPRCURV curvature /**< curvature of NLP row */
1144 )
1145{
1146 assert(scip != NULL);
1147
1148 SCIPnlrowSetCurvature(scip->nlp, scip->set, nlrow, curvature);
1149}
1150
1151/** adds variable with a linear coefficient to a nonlinear row
1152 *
1153 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1154 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1155 *
1156 * @pre This method can be called if SCIP is in one of the following stages:
1157 * - \ref SCIP_STAGE_PRESOLVED
1158 * - \ref SCIP_STAGE_INITSOLVE
1159 * - \ref SCIP_STAGE_SOLVING
1160 */
1162 SCIP* scip, /**< SCIP data structure */
1163 SCIP_NLROW* nlrow, /**< NLP row */
1164 SCIP_VAR* var, /**< problem variable */
1165 SCIP_Real val /**< value of coefficient in linear part of row */
1166 )
1167{
1168 SCIP_CALL( SCIPcheckStage(scip, "SCIPaddLinearCoefToNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1169
1170 SCIP_CALL( SCIPnlrowAddLinearCoef(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, var, val) );
1171
1172 return SCIP_OKAY;
1173}
1174
1175/** adds variables with linear coefficients to a row
1176 *
1177 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1178 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1179 *
1180 * @pre This method can be called if SCIP is in one of the following stages:
1181 * - \ref SCIP_STAGE_PRESOLVED
1182 * - \ref SCIP_STAGE_INITSOLVE
1183 * - \ref SCIP_STAGE_SOLVING
1184 */
1186 SCIP* scip, /**< SCIP data structure */
1187 SCIP_NLROW* nlrow, /**< NLP row */
1188 int nvars, /**< number of variables to add to the row */
1189 SCIP_VAR** vars, /**< problem variables to add */
1190 SCIP_Real* vals /**< values of coefficients in linear part of row */
1191 )
1192{
1193 int v;
1194
1195 assert(nvars == 0 || vars != NULL);
1196 assert(nvars == 0 || vals != NULL);
1197
1198 SCIP_CALL( SCIPcheckStage(scip, "SCIPaddLinearCoefsToNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1199
1200 /* add the variables to the row */
1201 for( v = 0; v < nvars; ++v )
1202 {
1203 SCIP_CALL( SCIPnlrowAddLinearCoef(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, vars[v], vals[v]) );
1204 }
1205
1206 return SCIP_OKAY;
1207}
1208
1209/** changes linear coefficient of a variables in a nonlinear row
1210 *
1211 * Setting the coefficient to 0.0 means that it is removed from the row.
1212 * The variable does not need to exists before.
1213 *
1214 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1215 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1216 *
1217 * @pre This method can be called if SCIP is in one of the following stages:
1218 * - \ref SCIP_STAGE_PRESOLVED
1219 * - \ref SCIP_STAGE_INITSOLVE
1220 * - \ref SCIP_STAGE_SOLVING
1221 */
1223 SCIP* scip, /**< SCIP data structure */
1224 SCIP_NLROW* nlrow, /**< NLP row */
1225 SCIP_VAR* var, /**< variable */
1226 SCIP_Real coef /**< new value of coefficient */
1227 )
1228{
1229 assert(var != NULL);
1230
1231 SCIP_CALL( SCIPcheckStage(scip, "SCIPchgNlRowLinearCoef", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1232
1233 SCIP_CALL( SCIPnlrowChgLinearCoef(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, var, coef) );
1234
1235 return SCIP_OKAY;
1236}
1237
1238/** sets or deletes expression in a nonlinear row
1239 *
1240 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1241 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1242 *
1243 * @pre This method can be called if SCIP is in one of the following stages:
1244 * - \ref SCIP_STAGE_PRESOLVED
1245 * - \ref SCIP_STAGE_INITSOLVE
1246 * - \ref SCIP_STAGE_SOLVING
1247 */
1249 SCIP* scip, /**< SCIP data structure */
1250 SCIP_NLROW* nlrow, /**< NLP row */
1251 SCIP_EXPR* expr /**< expression, or NULL */
1252 )
1253{
1255
1256 SCIP_CALL( SCIPnlrowChgExpr(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, expr) );
1257
1258 /* invalidate curvature */
1260
1261 return SCIP_OKAY;
1262}
1263
1264/** recalculates the activity of a nonlinear row in the last NLP solution
1265 *
1266 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1267 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1268 *
1269 * @pre This method can be called if SCIP is in one of the following stages:
1270 * - \ref SCIP_STAGE_PRESOLVED
1271 * - \ref SCIP_STAGE_INITSOLVE
1272 * - \ref SCIP_STAGE_SOLVING
1273 */
1275 SCIP* scip, /**< SCIP data structure */
1276 SCIP_NLROW* nlrow /**< NLP nonlinear row */
1277 )
1278{
1279 SCIP_CALL( SCIPcheckStage(scip, "SCIPrecalcNlRowNLPActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1280
1281 if( scip->nlp == NULL )
1282 {
1283 SCIPerrorMessage("do not have NLP for computing NLP activity\n");
1284 return SCIP_INVALIDCALL;
1285 }
1286
1287 SCIP_CALL( SCIPnlrowRecalcNLPActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp) );
1288
1289 return SCIP_OKAY;
1290}
1291
1292/** returns the activity of a nonlinear row in the last NLP solution
1293 *
1294 * If row cannot be evaluated at NLP solution, then activity is set to SCIP_INVALID.
1295 *
1296 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1297 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1298 *
1299 * @pre This method can be called if SCIP is in one of the following stages:
1300 * - \ref SCIP_STAGE_INITSOLVE
1301 * - \ref SCIP_STAGE_SOLVING
1302 */
1304 SCIP* scip, /**< SCIP data structure */
1305 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1306 SCIP_Real* activity /**< pointer to store activity value */
1307 )
1308{
1309 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowNLPActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1310
1311 if( scip->nlp == NULL )
1312 {
1313 SCIPerrorMessage("do not have NLP for computing NLP activity\n");
1314 return SCIP_INVALIDCALL;
1315 }
1316
1317 SCIP_CALL( SCIPnlrowGetNLPActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp, activity) );
1318
1319 return SCIP_OKAY;
1320}
1321
1322/** gives the feasibility of a nonlinear row in the last NLP solution: negative value means infeasibility
1323 *
1324 * If row cannot be evaluated at NLP solution, then feasibility is set to SCIP_INVALID.
1325 *
1326 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1327 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1328 *
1329 * @pre This method can be called if SCIP is in one of the following stages:
1330 * - \ref SCIP_STAGE_INITSOLVE
1331 * - \ref SCIP_STAGE_SOLVING
1332 */
1334 SCIP* scip, /**< SCIP data structure */
1335 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1336 SCIP_Real* feasibility /**< pointer to store feasibility value */
1337 )
1338{
1339 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowNLPFeasibility", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1340
1341 if( scip->nlp == NULL )
1342 {
1343 SCIPerrorMessage("do not have NLP for computing NLP feasibility\n");
1344 return SCIP_INVALIDCALL;
1345 }
1346
1347 SCIP_CALL( SCIPnlrowGetNLPFeasibility(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp, feasibility) );
1348
1349 return SCIP_OKAY;
1350}
1351
1352/** recalculates the activity of a nonlinear row for the current pseudo solution
1353 *
1354 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1355 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1356 *
1357 * @pre This method can be called if SCIP is in one of the following stages:
1358 * - \ref SCIP_STAGE_INITSOLVE
1359 * - \ref SCIP_STAGE_SOLVING
1360 */
1362 SCIP* scip, /**< SCIP data structure */
1363 SCIP_NLROW* nlrow /**< NLP nonlinear row */
1364 )
1365{
1366 SCIP_CALL( SCIPcheckStage(scip, "SCIPrecalcNlRowPseudoActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1367
1368 SCIP_CALL( SCIPnlrowRecalcPseudoActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal, scip->tree, scip->lp) );
1369
1370 return SCIP_OKAY;
1371}
1372
1373/** gives the activity of a nonlinear row for the current pseudo solution
1374 *
1375 * If row cannot be evaluated at pseudo solution, then activity is set to SCIP_INVALID.
1376 *
1377 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1378 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1379 *
1380 * @pre This method can be called if SCIP is in one of the following stages:
1381 * - \ref SCIP_STAGE_INITSOLVE
1382 * - \ref SCIP_STAGE_SOLVING
1383 */
1385 SCIP* scip, /**< SCIP data structure */
1386 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1387 SCIP_Real* pseudoactivity /**< pointer to store pseudo activity value */
1388 )
1389{
1390 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowPseudoActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1391
1392 SCIP_CALL( SCIPnlrowGetPseudoActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal, scip->tree, scip->lp, pseudoactivity) );
1393
1394 return SCIP_OKAY;
1395}
1396
1397/** gives the feasibility of a nonlinear row for the current pseudo solution: negative value means infeasibility
1398 *
1399 * If row cannot be evaluated at pseudo solution, then feasibility is set to SCIP_INVALID.
1400 *
1401 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1402 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1403 *
1404 * @pre This method can be called if SCIP is in one of the following stages:
1405 * - \ref SCIP_STAGE_INITSOLVE
1406 * - \ref SCIP_STAGE_SOLVING
1407 */
1409 SCIP* scip, /**< SCIP data structure */
1410 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1411 SCIP_Real* pseudofeasibility /**< pointer to store pseudo feasibility value */
1412 )
1413{
1414 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowPseudoFeasibility", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1415
1416 SCIP_CALL( SCIPnlrowGetPseudoFeasibility(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal, scip->tree, scip->lp, pseudofeasibility) );
1417
1418 return SCIP_OKAY;
1419}
1420
1421/** recalculates the activity of a nonlinear row in the last NLP or pseudo solution
1422 *
1423 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1424 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1425 *
1426 * @pre This method can be called if SCIP is in one of the following stages:
1427 * - \ref SCIP_STAGE_INITSOLVE
1428 * - \ref SCIP_STAGE_SOLVING
1429 */
1431 SCIP* scip, /**< SCIP data structure */
1432 SCIP_NLROW* nlrow /**< NLP nonlinear row */
1433 )
1434{
1435 SCIP_CALL( SCIPcheckStage(scip, "SCIPrecalcNlRowActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1436
1437 if( scip->nlp != NULL && SCIPnlpHasCurrentNodeNLP(scip->nlp) && SCIPnlpHasSolution(scip->nlp) )
1438 {
1439 SCIP_CALL( SCIPnlrowRecalcNLPActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp) );
1440 }
1441 else
1442 {
1443 SCIP_CALL( SCIPnlrowRecalcPseudoActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal, scip->tree, scip->lp) );
1444 }
1445
1446 return SCIP_OKAY;
1447}
1448
1449/** gives the activity of a nonlinear row in the last NLP or pseudo solution
1450 *
1451 * If row cannot be evaluated, then activity is set to SCIP_INVALID.
1452 *
1453 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1454 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1455 *
1456 * @pre This method can be called if SCIP is in one of the following stages:
1457 * - \ref SCIP_STAGE_INITSOLVE
1458 * - \ref SCIP_STAGE_SOLVING
1459 */
1461 SCIP* scip, /**< SCIP data structure */
1462 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1463 SCIP_Real* activity /**< pointer to store activity value */
1464 )
1465{
1466 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1467
1468 if( scip->nlp != NULL && SCIPnlpHasCurrentNodeNLP(scip->nlp) && SCIPnlpHasSolution(scip->nlp) )
1469 {
1470 SCIP_CALL( SCIPnlrowGetNLPActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp, activity) );
1471 }
1472 else
1473 {
1474 SCIP_CALL( SCIPnlrowGetPseudoActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal, scip->tree, scip->lp, activity) );
1475 }
1476
1477 return SCIP_OKAY;
1478}
1479
1480/** gives the feasibility of a nonlinear row in the last NLP or pseudo solution
1481 *
1482 * If row cannot be evaluated, then feasibility is set to SCIP_INVALID.
1483 *
1484 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1485 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1486 *
1487 * @pre This method can be called if SCIP is in one of the following stages:
1488 * - \ref SCIP_STAGE_INITSOLVE
1489 * - \ref SCIP_STAGE_SOLVING
1490 */
1492 SCIP* scip, /**< SCIP data structure */
1493 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1494 SCIP_Real* feasibility /**< pointer to store feasibility value */
1495 )
1496{
1497 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowFeasibility", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1498
1499 if( scip->nlp != NULL && SCIPnlpHasCurrentNodeNLP(scip->nlp) && SCIPnlpHasSolution(scip->nlp) )
1500 {
1501 SCIP_CALL( SCIPnlrowGetNLPFeasibility(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp, feasibility) );
1502 }
1503 else
1504 {
1505 SCIP_CALL( SCIPnlrowGetPseudoFeasibility(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal, scip->tree, scip->lp, feasibility) );
1506 }
1507
1508 return SCIP_OKAY;
1509}
1510
1511/** gives the activity of a nonlinear row for the given primal solution or NLP solution or pseudo solution
1512 *
1513 * If row cannot be evaluated at given solution, then activity is set to SCIP_INVALID.
1514 *
1515 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1516 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1517 *
1518 * @pre This method can be called if SCIP is in one of the following stages:
1519 * - \ref SCIP_STAGE_INITSOLVE
1520 * - \ref SCIP_STAGE_SOLVING
1521 */
1523 SCIP* scip, /**< SCIP data structure */
1524 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1525 SCIP_SOL* sol, /**< primal CIP solution, or NULL for NLP solution of pseudo solution */
1526 SCIP_Real* activity /**< pointer to store activity value */
1527 )
1528{
1529 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowSolActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1530
1531 if( sol != NULL )
1532 {
1533 SCIP_CALL( SCIPnlrowGetSolActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, sol, activity) );
1534 }
1535 else if( scip->nlp != NULL && SCIPnlpHasCurrentNodeNLP(scip->nlp) && SCIPnlpHasSolution(scip->nlp) )
1536 {
1537 SCIP_CALL( SCIPnlrowGetNLPActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp, activity) );
1538 }
1539 else
1540 {
1541 SCIP_CALL( SCIPnlrowGetPseudoActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal, scip->tree, scip->lp, activity) );
1542 }
1543
1544 return SCIP_OKAY;
1545}
1546
1547/** gives the feasibility of a nonlinear row for the given primal solution
1548 *
1549 * If row cannot be evaluated at given solution, then feasibility is set to SCIP_INVALID.
1550 *
1551 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1552 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1553 *
1554 * @pre This method can be called if SCIP is in one of the following stages:
1555 * - \ref SCIP_STAGE_INITSOLVE
1556 * - \ref SCIP_STAGE_SOLVING
1557 */
1559 SCIP* scip, /**< SCIP data structure */
1560 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1561 SCIP_SOL* sol, /**< primal CIP solution */
1562 SCIP_Real* feasibility /**< pointer to store feasibility value */
1563 )
1564{
1565 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowSolFeasibility", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1566
1567 if( sol != NULL )
1568 {
1569 SCIP_CALL( SCIPnlrowGetSolFeasibility(nlrow, scip->mem->probmem, scip->set, scip->stat, sol, feasibility) );
1570 }
1571 else if( scip->nlp != NULL && SCIPnlpHasCurrentNodeNLP(scip->nlp) && SCIPnlpHasSolution(scip->nlp) )
1572 {
1573 SCIP_CALL( SCIPnlrowGetNLPFeasibility(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp, feasibility) );
1574 }
1575 else
1576 {
1577 SCIP_CALL( SCIPnlrowGetPseudoFeasibility(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal, scip->tree, scip->lp, feasibility) );
1578 }
1579
1580 return SCIP_OKAY;
1581}
1582
1583/** gives the minimal and maximal activity of a nonlinear row w.r.t. the variable's bounds
1584 *
1585 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1586 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1587 *
1588 * @pre This method can be called if SCIP is in one of the following stages:
1589 * - \ref SCIP_STAGE_PRESOLVED
1590 * - \ref SCIP_STAGE_INITSOLVE
1591 * - \ref SCIP_STAGE_SOLVING
1592 */
1594 SCIP* scip, /**< SCIP data structure */
1595 SCIP_NLROW* nlrow, /**< NLP row */
1596 SCIP_Real* minactivity, /**< buffer to store minimal activity, or NULL */
1597 SCIP_Real* maxactivity /**< buffer to store maximal activity, or NULL */
1598 )
1599{
1600 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowActivityBounds", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1601
1602 SCIP_CALL( SCIPnlrowGetActivityBounds(nlrow, scip->mem->probmem, scip->set, scip->stat, minactivity, maxactivity) );
1603
1604 return SCIP_OKAY;
1605}
1606
1607/** prints a nonlinear row to file stream
1608 *
1609 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1610 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1611 *
1612 * @pre This method can be called if SCIP is in one of the following stages:
1613 * - \ref SCIP_STAGE_PRESOLVED
1614 * - \ref SCIP_STAGE_INITSOLVE
1615 * - \ref SCIP_STAGE_SOLVING
1616 */
1618 SCIP* scip, /**< SCIP data structure */
1619 SCIP_NLROW* nlrow, /**< NLP row */
1620 FILE* file /**< output file (or NULL for standard output) */
1621 )
1622{
1623 assert(nlrow != NULL);
1624
1626
1627 SCIP_CALL( SCIPnlrowPrint(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->messagehdlr, file) );
1628
1629 return SCIP_OKAY;
1630}
1631
1632/** @} */
SCIP_RETCODE SCIPcheckStage(SCIP *scip, const char *method, SCIP_Bool init, SCIP_Bool problem, SCIP_Bool transforming, SCIP_Bool transformed, SCIP_Bool initpresolve, SCIP_Bool presolving, SCIP_Bool exitpresolve, SCIP_Bool presolved, SCIP_Bool initsolve, SCIP_Bool solving, SCIP_Bool solved, SCIP_Bool exitsolve, SCIP_Bool freetrans, SCIP_Bool freescip)
Definition: debug.c:2202
methods for debugging
#define NULL
Definition: def.h:262
#define SCIP_INVALID
Definition: def.h:192
#define SCIP_Bool
Definition: def.h:91
#define SCIP_Real
Definition: def.h:172
#define TRUE
Definition: def.h:93
#define FALSE
Definition: def.h:94
#define SCIP_CALL_ABORT(x)
Definition: def.h:348
#define SCIPABORT()
Definition: def.h:341
#define SCIP_CALL(x)
Definition: def.h:369
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:124
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:136
SCIP_RETCODE SCIPendDiveNLP(SCIP *scip)
Definition: scip_nlp.c:830
SCIP_RETCODE SCIPchgVarsBoundsDiveNLP(SCIP *scip, int nvars, SCIP_VAR **vars, SCIP_Real *lbs, SCIP_Real *ubs)
Definition: scip_nlp.c:917
SCIP_RETCODE SCIPstartDiveNLP(SCIP *scip)
Definition: scip_nlp.c:802
SCIP_RETCODE SCIPchgVarBoundsDiveNLP(SCIP *scip, SCIP_VAR *var, SCIP_Real lb, SCIP_Real ub)
Definition: scip_nlp.c:886
SCIP_RETCODE SCIPchgVarObjDiveNLP(SCIP *scip, SCIP_VAR *var, SCIP_Real coef)
Definition: scip_nlp.c:856
SCIP_RETCODE SCIPhasNLPContinuousNonlinearity(SCIP *scip, SCIP_Bool *result)
Definition: scip_nlp.c:125
SCIP_RETCODE SCIPdelNlRow(SCIP *scip, SCIP_NLROW *nlrow)
Definition: scip_nlp.c:424
SCIP_RETCODE SCIPaddNlRow(SCIP *scip, SCIP_NLROW *nlrow)
Definition: scip_nlp.c:396
SCIP_RETCODE SCIPflushNLP(SCIP *scip)
Definition: scip_nlp.c:448
SCIP_RETCODE SCIPwriteNLP(SCIP *scip, const char *filename)
Definition: scip_nlp.c:727
SCIP_Bool SCIPisNLPConstructed(SCIP *scip)
Definition: scip_nlp.c:110
SCIP_NLPSOLSTAT SCIPgetNLPSolstat(SCIP *scip)
Definition: scip_nlp.c:574
SCIP_RETCODE SCIPsetNLPInitialGuess(SCIP *scip, SCIP_Real *initialguess)
Definition: scip_nlp.c:474
SCIP_Real SCIPgetNLPObjval(SCIP *scip)
Definition: scip_nlp.c:645
SCIP_RETCODE SCIPsolveNLPParam(SCIP *scip, SCIP_NLPPARAM param)
Definition: scip_nlp.c:545
SCIP_RETCODE SCIPgetNLPI(SCIP *scip, SCIP_NLPI **nlpi, SCIP_NLPIPROBLEM **nlpiproblem)
Definition: scip_nlp.c:762
SCIP_RETCODE SCIPgetNLPFracVars(SCIP *scip, SCIP_VAR ***fracvars, SCIP_Real **fracvarssol, SCIP_Real **fracvarsfrac, int *nfracvars, int *npriofracvars)
Definition: scip_nlp.c:696
int SCIPgetNNLPVars(SCIP *scip)
Definition: scip_nlp.c:201
SCIP_Bool SCIPisNLPEnabled(SCIP *scip)
Definition: scip_nlp.c:74
SCIP_Real * SCIPgetNLPVarsUbDualsol(SCIP *scip)
Definition: scip_nlp.c:269
SCIP_RETCODE SCIPsetNLPInitialGuessSol(SCIP *scip, SCIP_SOL *sol)
Definition: scip_nlp.c:501
SCIP_RETCODE SCIPgetNLPVarsNonlinearity(SCIP *scip, int *nlcount)
Definition: scip_nlp.c:223
SCIP_RETCODE SCIPgetNLPNlRowsData(SCIP *scip, SCIP_NLROW ***nlrows, int *nnlrows)
Definition: scip_nlp.c:291
void SCIPenableNLP(SCIP *scip)
Definition: scip_nlp.c:95
int SCIPgetNNLPNlRows(SCIP *scip)
Definition: scip_nlp.c:341
SCIP_VAR ** SCIPgetNLPVars(SCIP *scip)
Definition: scip_nlp.c:179
SCIP_Bool SCIPhasNLPSolution(SCIP *scip)
Definition: scip_nlp.c:671
SCIP_RETCODE SCIPgetNLPNlRowsStat(SCIP *scip, int *nlinear, int *nconvexineq, int *nnonconvexineq, int *nnonlineareq)
Definition: scip_nlp.c:369
SCIP_NLROW ** SCIPgetNLPNlRows(SCIP *scip)
Definition: scip_nlp.c:319
SCIP_NLPTERMSTAT SCIPgetNLPTermstat(SCIP *scip)
Definition: scip_nlp.c:596
SCIP_RETCODE SCIPgetNLPVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars)
Definition: scip_nlp.c:149
SCIP_RETCODE SCIPgetNLPStatistics(SCIP *scip, SCIP_NLPSTATISTICS *statistics)
Definition: scip_nlp.c:621
SCIP_Real * SCIPgetNLPVarsLbDualsol(SCIP *scip)
Definition: scip_nlp.c:247
SCIP_RETCODE SCIPnlrowChgRhs(SCIP_NLROW *nlrow, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp, SCIP_Real rhs)
Definition: nlp.c:1444
SCIP_RETCODE SCIPnlrowCreate(SCIP_NLROW **nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, const char *name, SCIP_Real constant, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, SCIP_EXPR *expr, SCIP_Real lhs, SCIP_Real rhs, SCIP_EXPRCURV curvature)
Definition: nlp.c:895
SCIP_RETCODE SCIPnlrowRelease(SCIP_NLROW **nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: nlp.c:1154
SCIP_RETCODE SCIPnlrowGetNLPFeasibility(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_NLP *nlp, SCIP_Real *feasibility)
Definition: nlp.c:1585
SCIP_RETCODE SCIPsetNlRowExpr(SCIP *scip, SCIP_NLROW *nlrow, SCIP_EXPR *expr)
Definition: scip_nlp.c:1248
SCIP_RETCODE SCIPgetNlRowActivityBounds(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real *minactivity, SCIP_Real *maxactivity)
Definition: scip_nlp.c:1593
SCIP_RETCODE SCIPnlrowChgLinearCoef(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp, SCIP_VAR *var, SCIP_Real coef)
Definition: nlp.c:1305
SCIP_RETCODE SCIPaddLinearCoefToNlRow(SCIP *scip, SCIP_NLROW *nlrow, SCIP_VAR *var, SCIP_Real val)
Definition: scip_nlp.c:1161
SCIP_RETCODE SCIPcaptureNlRow(SCIP *scip, SCIP_NLROW *nlrow)
Definition: scip_nlp.c:1035
SCIP_RETCODE SCIPrecalcNlRowNLPActivity(SCIP *scip, SCIP_NLROW *nlrow)
Definition: scip_nlp.c:1274
SCIP_RETCODE SCIPnlrowGetActivityBounds(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_Real *minactivity, SCIP_Real *maxactivity)
Definition: nlp.c:1792
SCIP_RETCODE SCIPcreateEmptyNlRow(SCIP *scip, SCIP_NLROW **nlrow, const char *name, SCIP_Real lhs, SCIP_Real rhs)
Definition: scip_nlp.c:986
SCIP_RETCODE SCIPnlrowGetSolFeasibility(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_SOL *sol, SCIP_Real *feasibility)
Definition: nlp.c:1767
SCIP_RETCODE SCIPgetNlRowSolFeasibility(SCIP *scip, SCIP_NLROW *nlrow, SCIP_SOL *sol, SCIP_Real *feasibility)
Definition: scip_nlp.c:1558
SCIP_RETCODE SCIPchgNlRowLinearCoef(SCIP *scip, SCIP_NLROW *nlrow, SCIP_VAR *var, SCIP_Real coef)
Definition: scip_nlp.c:1222
SCIP_RETCODE SCIPgetNlRowActivity(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real *activity)
Definition: scip_nlp.c:1460
SCIP_RETCODE SCIPgetNlRowNLPFeasibility(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real *feasibility)
Definition: scip_nlp.c:1333
SCIP_RETCODE SCIPgetNlRowPseudoActivity(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real *pseudoactivity)
Definition: scip_nlp.c:1384
SCIP_RETCODE SCIPnlrowAddLinearCoef(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp, SCIP_VAR *var, SCIP_Real val)
Definition: nlp.c:1224
SCIP_RETCODE SCIPnlrowChgLhs(SCIP_NLROW *nlrow, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp, SCIP_Real lhs)
Definition: nlp.c:1418
SCIP_RETCODE SCIPchgNlRowRhs(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real rhs)
Definition: scip_nlp.c:1103
SCIP_RETCODE SCIPnlrowChgExpr(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp, SCIP_EXPR *expr)
Definition: nlp.c:1343
SCIP_RETCODE SCIPnlrowGetNLPActivity(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_NLP *nlp, SCIP_Real *activity)
Definition: nlp.c:1556
SCIP_RETCODE SCIPreleaseNlRow(SCIP *scip, SCIP_NLROW **nlrow)
Definition: scip_nlp.c:1058
SCIP_RETCODE SCIPgetNlRowFeasibility(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real *feasibility)
Definition: scip_nlp.c:1491
SCIP_RETCODE SCIPchgNlRowConstant(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real constant)
Definition: scip_nlp.c:1126
SCIP_RETCODE SCIPnlrowRecalcNLPActivity(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_NLP *nlp)
Definition: nlp.c:1504
SCIP_RETCODE SCIPrecalcNlRowActivity(SCIP *scip, SCIP_NLROW *nlrow)
Definition: scip_nlp.c:1430
SCIP_RETCODE SCIPchgNlRowLhs(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real lhs)
Definition: scip_nlp.c:1080
SCIP_RETCODE SCIPnlrowGetSolActivity(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_SOL *sol, SCIP_Real *activity)
Definition: nlp.c:1716
SCIP_RETCODE SCIPnlrowPrint(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: nlp.c:1092
SCIP_RETCODE SCIPgetNlRowNLPActivity(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real *activity)
Definition: scip_nlp.c:1303
SCIP_RETCODE SCIPnlrowChgConstant(SCIP_NLROW *nlrow, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp, SCIP_Real constant)
Definition: nlp.c:1398
SCIP_RETCODE SCIPgetNlRowPseudoFeasibility(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real *pseudofeasibility)
Definition: scip_nlp.c:1408
SCIP_RETCODE SCIPprintNlRow(SCIP *scip, SCIP_NLROW *nlrow, FILE *file)
Definition: scip_nlp.c:1617
void SCIPnlrowSetCurvature(SCIP_NLP *nlp, SCIP_SET *set, SCIP_NLROW *nlrow, SCIP_EXPRCURV curvature)
Definition: nlp.c:1470
SCIP_RETCODE SCIPgetNlRowSolActivity(SCIP *scip, SCIP_NLROW *nlrow, SCIP_SOL *sol, SCIP_Real *activity)
Definition: scip_nlp.c:1522
void SCIPsetNlRowCurvature(SCIP *scip, SCIP_NLROW *nlrow, SCIP_EXPRCURV curvature)
Definition: scip_nlp.c:1140
SCIP_RETCODE SCIPnlrowGetPseudoFeasibility(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LP *lp, SCIP_Real *pseudofeasibility)
Definition: nlp.c:1688
SCIP_RETCODE SCIPcreateNlRowFromRow(SCIP *scip, SCIP_NLROW **nlrow, SCIP_ROW *row)
Definition: scip_nlp.c:1012
SCIP_RETCODE SCIPnlrowCreateFromRow(SCIP_NLROW **nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_ROW *row)
Definition: nlp.c:1029
SCIP_RETCODE SCIPcreateNlRow(SCIP *scip, SCIP_NLROW **nlrow, const char *name, SCIP_Real constant, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, SCIP_EXPR *expr, SCIP_Real lhs, SCIP_Real rhs, SCIP_EXPRCURV curvature)
Definition: scip_nlp.c:954
SCIP_RETCODE SCIPnlrowRecalcPseudoActivity(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LP *lp)
Definition: nlp.c:1611
SCIP_RETCODE SCIPnlrowGetPseudoActivity(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LP *lp, SCIP_Real *pseudoactivity)
Definition: nlp.c:1658
SCIP_RETCODE SCIPaddLinearCoefsToNlRow(SCIP *scip, SCIP_NLROW *nlrow, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip_nlp.c:1185
SCIP_RETCODE SCIPrecalcNlRowPseudoActivity(SCIP *scip, SCIP_NLROW *nlrow)
Definition: scip_nlp.c:1361
void SCIPnlrowCapture(SCIP_NLROW *nlrow)
Definition: nlp.c:1142
SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip_sol.c:1250
memory allocation routines
SCIP_Real * SCIPnlpGetVarsUbDualsol(SCIP_NLP *nlp)
Definition: nlp.c:4431
SCIP_RETCODE SCIPnlpGetStatistics(SCIP_SET *set, SCIP_NLP *nlp, SCIP_NLPSTATISTICS *statistics)
Definition: nlp.c:4535
SCIP_RETCODE SCIPnlpEndDive(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: nlp.c:4601
SCIP_NLPI * SCIPnlpGetNLPI(SCIP_NLP *nlp)
Definition: nlp.c:4485
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip_mem.c:57
int SCIPnlpGetNNlRows(SCIP_NLP *nlp)
Definition: nlp.c:4451
SCIP_RETCODE SCIPnlpWrite(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_MESSAGEHDLR *messagehdlr, const char *fname)
Definition: nlp.c:4249
SCIP_RETCODE SCIPnlpChgVarBoundsDive(SCIP_SET *set, SCIP_NLP *nlp, SCIP_VAR *var, SCIP_Real lb, SCIP_Real ub)
Definition: nlp.c:4720
SCIP_Bool SCIPnlpHasCurrentNodeNLP(SCIP_NLP *nlp)
Definition: nlp.c:3775
SCIP_RETCODE SCIPnlpDelNlRow(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLROW *nlrow)
Definition: nlp.c:3992
SCIP_RETCODE SCIPnlpChgVarObjDive(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var, SCIP_Real coef)
Definition: nlp.c:4663
SCIP_Bool SCIPnlpHasSolution(SCIP_NLP *nlp)
Definition: nlp.c:4556
SCIP_RETCODE SCIPnlpSetInitialGuess(SCIP_SET *set, SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_Real *initguess)
Definition: nlp.c:4213
SCIP_RETCODE SCIPnlpGetVarsNonlinearity(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, int *nlcount)
Definition: nlp.c:4324
void SCIPnlpGetNlRowsStat(SCIP_NLP *nlp, int *nlinear, int *nconvexineq, int *nnonconvexineq, int *nnonlineareq)
Definition: nlp.c:4461
SCIP_RETCODE SCIPnlpChgVarsBoundsDive(SCIP_NLP *nlp, SCIP_SET *set, int nvars, SCIP_VAR **vars, SCIP_Real *lbs, SCIP_Real *ubs)
Definition: nlp.c:4749
SCIP_NLPTERMSTAT SCIPnlpGetTermstat(SCIP_NLP *nlp)
Definition: nlp.c:4525
SCIP_RETCODE SCIPnlpAddNlRow(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLROW *nlrow)
Definition: nlp.c:3936
SCIP_VAR ** SCIPnlpGetVars(SCIP_NLP *nlp)
Definition: nlp.c:4304
SCIP_RETCODE SCIPnlpFlush(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: nlp.c:4024
SCIP_NLPIPROBLEM * SCIPnlpGetNLPIProblem(SCIP_NLP *nlp)
Definition: nlp.c:4495
int SCIPnlpGetNVars(SCIP_NLP *nlp)
Definition: nlp.c:4314
SCIP_RETCODE SCIPnlpGetFracVars(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR ***fracvars, SCIP_Real **fracvarssol, SCIP_Real **fracvarsfrac, int *nfracvars, int *npriofracvars)
Definition: nlp.c:4133
SCIP_RETCODE SCIPnlpStartDive(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: nlp.c:4570
SCIP_Real * SCIPnlpGetVarsLbDualsol(SCIP_NLP *nlp)
Definition: nlp.c:4421
SCIP_RETCODE SCIPnlpSolve(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_NLPPARAM *nlpparam)
Definition: nlp.c:4062
SCIP_Real SCIPnlpGetObjval(SCIP_NLP *nlp)
Definition: nlp.c:4089
SCIP_NLROW ** SCIPnlpGetNlRows(SCIP_NLP *nlp)
Definition: nlp.c:4441
SCIP_RETCODE SCIPnlpHasContinuousNonlinearity(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_Bool *result)
Definition: nlp.c:4378
SCIP_NLPSOLSTAT SCIPnlpGetSolstat(SCIP_NLP *nlp)
Definition: nlp.c:4515
internal methods for NLP management
internal methods for NLP solver interfaces
public methods for message output
#define SCIPerrorMessage
Definition: pub_message.h:64
public data structures and miscellaneous methods
public methods for NLP management
public methods for handling parameter settings
public methods for memory management
public methods for nonlinear relaxation
public methods for SCIP parameter handling
public methods for solutions
internal methods for global SCIP settings
SCIP * scip
Definition: struct_var.h:288
datastructures for block memory pools and memory buffers
datastructures for storing and manipulating the main problem
SCIP main data structure.
datastructures for global SCIP settings
datastructures for problem variables
SCIP_EXPRCURV
Definition: type_expr.h:61
@ SCIP_EXPRCURV_UNKNOWN
Definition: type_expr.h:62
enum SCIP_NlpSolStat SCIP_NLPSOLSTAT
Definition: type_nlpi.h:168
@ SCIP_NLPTERMSTAT_OTHER
Definition: type_nlpi.h:182
@ SCIP_NLPSOLSTAT_UNKNOWN
Definition: type_nlpi.h:166
enum SCIP_NlpTermStat SCIP_NLPTERMSTAT
Definition: type_nlpi.h:194
@ SCIP_OKAY
Definition: type_retcode.h:42
@ SCIP_INVALIDCALL
Definition: type_retcode.h:51
@ SCIP_ERROR
Definition: type_retcode.h:43
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63