SCIP Doxygen Documentation
 
Loading...
Searching...
No Matches
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-2023 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/** adds a nonlinear row to the NLP. This row is captured by the NLP.
358 *
359 * @pre This method can be called if SCIP is in one of the following stages:
360 * - \ref SCIP_STAGE_INITSOLVE
361 * - \ref SCIP_STAGE_SOLVING
362 */
364 SCIP* scip, /**< SCIP data structure */
365 SCIP_NLROW* nlrow /**< nonlinear row to add to NLP */
366 )
367{
369
370 if( scip->nlp == NULL )
371 {
372 SCIPerrorMessage("NLP has not been constructed.\n");
373 return SCIP_INVALIDCALL;
374 }
375
376 SCIP_CALL( SCIPnlpAddNlRow(scip->nlp, SCIPblkmem(scip), scip->set, scip->stat, nlrow) );
377
378 return SCIP_OKAY;
379}
380
381/** removes a nonlinear row from the NLP
382 *
383 * This row is released in the NLP.
384 *
385 * @pre This method can be called if SCIP is in one of the following stages:
386 * - \ref SCIP_STAGE_INITSOLVE
387 * - \ref SCIP_STAGE_SOLVING
388 * - \ref SCIP_STAGE_SOLVED
389 * - \ref SCIP_STAGE_EXITSOLVE
390 */
392 SCIP* scip, /**< SCIP data structure */
393 SCIP_NLROW* nlrow /**< nonlinear row to add to NLP */
394 )
395{
397
398 if( scip->nlp == NULL )
399 {
400 SCIPerrorMessage("NLP has not been constructed.\n");
401 return SCIP_INVALIDCALL;
402 }
403
404 SCIP_CALL( SCIPnlpDelNlRow(scip->nlp, SCIPblkmem(scip), scip->set, scip->stat, nlrow) );
405
406 return SCIP_OKAY;
407}
408
409/** makes sure that the NLP of the current node is flushed
410 *
411 * @pre This method can be called if SCIP is in one of the following stages:
412 * - \ref SCIP_STAGE_INITSOLVE
413 * - \ref SCIP_STAGE_SOLVING
414 */
416 SCIP* scip /**< SCIP data structure */
417 )
418{
420
421 if( scip->nlp == NULL )
422 {
423 SCIPerrorMessage("NLP has not been constructed.\n");
424 return SCIP_INVALIDCALL;
425 }
426
427 SCIP_CALL( SCIPnlpFlush(scip->nlp, scip->mem->probmem, scip->set, scip->stat) );
428
429 return SCIP_OKAY;
430}
431
432/** sets or clears initial primal guess for NLP solution (start point for NLP solver)
433 *
434 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
435 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
436 *
437 * @pre This method can be called if SCIP is in one of the following stages:
438 * - \ref SCIP_STAGE_INITSOLVE
439 * - \ref SCIP_STAGE_SOLVING
440 */
442 SCIP* scip, /**< SCIP data structure */
443 SCIP_Real* initialguess /**< values of initial guess (corresponding to variables from SCIPgetNLPVarsData), or NULL to use no start point */
444 )
445{
446 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetNLPInitialGuess", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
447
448 if( scip->nlp == NULL )
449 {
450 SCIPerrorMessage("NLP has not been constructed.\n");
451 return SCIP_INVALIDCALL;
452 }
453
454 SCIP_CALL( SCIPnlpSetInitialGuess(scip->set, scip->nlp, SCIPblkmem(scip), initialguess) );
455
456 return SCIP_OKAY;
457}
458
459/** sets initial primal guess for NLP solution (start point for NLP solver)
460 *
461 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
462 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
463 *
464 * @pre This method can be called if SCIP is in one of the following stages:
465 * - \ref SCIP_STAGE_INITSOLVE
466 * - \ref SCIP_STAGE_SOLVING
467 */
469 SCIP* scip, /**< SCIP data structure */
470 SCIP_SOL* sol /**< solution which values should be taken as initial guess, or NULL for LP solution */
471 )
472{
473 SCIP_Real* vals;
474
475 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetNLPInitialGuessSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
476
477 if( scip->nlp == NULL )
478 {
479 SCIPerrorMessage("NLP has not been constructed.\n");
480 return SCIP_INVALIDCALL;
481 }
482
487
488 return SCIP_OKAY;
489}
490
491/** solves the current NLP (or diving NLP if in diving mode) with given parameters
492 *
493 * Typical use is
494 *
495 * SCIP_NLPPARAM nlparam = { SCIP_NLPPARAM_DEFAULT(scip); }
496 * nlpparam.iterlimit = 42;
497 * SCIP_CALL( SCIPsolveNLPParam(scip, nlpparam) );
498 *
499 * or, in one line:
500 *
501 * SCIP_CALL( SCIPsolveNLPParam(scip, (SCIP_NLPPARAM){ SCIP_NLPPARAM_DEFAULT(scip), .iterlimit = 42 }) );
502 *
503 * To get the latter, also \ref SCIPsolveNLP can be used.
504 *
505 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
506 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
507 *
508 * @pre This method can be called if SCIP is in one of the following stages:
509 * - \ref SCIP_STAGE_INITSOLVE
510 * - \ref SCIP_STAGE_SOLVING
511 */
513 SCIP* scip, /**< SCIP data structure */
514 SCIP_NLPPARAM param /**< NLP solve parameters */
515 )
516{
518
519 if( scip->nlp == NULL )
520 {
521 SCIPerrorMessage("NLP has not been constructed.\n");
522 return SCIP_INVALIDCALL;
523 }
524
525 SCIP_CALL( SCIPnlpSolve(scip->nlp, SCIPblkmem(scip), scip->set, scip->messagehdlr, scip->stat, scip->primal, scip->tree, &param) );
526
527 return SCIP_OKAY;
528}
529
530#if defined(_MSC_VER) && _MSC_VER < 1800
531/* warn that SCIPsolveNLP() macro isn't perfect with ancient MSVC */
532#pragma message ( "Warning: designated initializers not supported by this version of MSVC. Parameters given to NLP solves may be ignored." )
533#endif
534
535/** gets solution status of current NLP
536 *
537 * @pre This method can be called if SCIP is in one of the following stages:
538 * - \ref SCIP_STAGE_INITSOLVE
539 * - \ref SCIP_STAGE_SOLVING
540 */
542 SCIP* scip /**< SCIP data structure */
543 )
544{
546
547 if( scip->nlp == NULL )
548 {
549 SCIPerrorMessage("NLP has not been constructed.\n");
550 SCIPABORT();
551 return SCIP_NLPSOLSTAT_UNKNOWN; /*lint !e527*/
552 }
553
554 return SCIPnlpGetSolstat(scip->nlp);
555}
556
557/** gets termination status of last NLP solve
558 *
559 * @pre This method can be called if SCIP is in one of the following stages:
560 * - \ref SCIP_STAGE_INITSOLVE
561 * - \ref SCIP_STAGE_SOLVING
562 */
564 SCIP* scip /**< SCIP data structure */
565 )
566{
568
569 if( scip->nlp == NULL )
570 {
571 SCIPerrorMessage("NLP has not been constructed.\n");
572 SCIPABORT();
573 return SCIP_NLPTERMSTAT_OTHER; /*lint !e527*/
574 }
575
576 return SCIPnlpGetTermstat(scip->nlp);
577}
578
579/** gives statistics (number of iterations, solving time, ...) of last NLP solve
580 *
581 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
582 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
583 *
584 * @pre This method can be called if SCIP is in one of the following stages:
585 * - \ref SCIP_STAGE_INITSOLVE
586 * - \ref SCIP_STAGE_SOLVING
587 */
589 SCIP* scip, /**< SCIP data structure */
590 SCIP_NLPSTATISTICS* statistics /**< pointer to store statistics */
591 )
592{
593 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNLPStatistics", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
594
595 if( scip->nlp == NULL )
596 {
597 SCIPerrorMessage("NLP has not been constructed.\n");
598 return SCIP_INVALIDCALL;
599 }
600
602
603 return SCIP_OKAY;
604}
605
606/** gets objective value of current NLP
607 *
608 * @pre This method can be called if SCIP is in one of the following stages:
609 * - \ref SCIP_STAGE_INITSOLVE
610 * - \ref SCIP_STAGE_SOLVING
611 */
613 SCIP* scip /**< SCIP data structure */
614 )
615{
617
618 if( scip->nlp != NULL )
619 {
620 return SCIPnlpGetObjval(scip->nlp);
621 }
622 else
623 {
624 SCIPerrorMessage("NLP has not been constructed.\n");
625 return SCIP_INVALID;
626 }
627}
628
629/** indicates whether a solution for the current NLP is available
630 *
631 * The solution may be optimal, feasible, or infeasible.
632 * Thus, returns whether the NLP solution status is at most \ref SCIP_NLPSOLSTAT_LOCINFEASIBLE.
633 *
634 * @pre This method can be called if SCIP is in one of the following stages:
635 * - \ref SCIP_STAGE_INITSOLVE
636 * - \ref SCIP_STAGE_SOLVING
637 */
639 SCIP* scip /**< SCIP data structure */
640 )
641{
643
644 if( scip->nlp == NULL )
645 {
646 SCIPerrorMessage("NLP has not been constructed.\n");
647 SCIPABORT();
648 return FALSE; /*lint !e527*/
649 }
650
651 return SCIPnlpHasSolution(scip->nlp);
652}
653
654/** gets fractional variables of last NLP solution along with solution values and fractionalities
655 *
656 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
657 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
658 *
659 * @pre This method can be called if SCIP is in one of the following stages:
660 * - \ref SCIP_STAGE_INITSOLVE
661 * - \ref SCIP_STAGE_SOLVING
662 */
664 SCIP* scip, /**< SCIP data structure */
665 SCIP_VAR*** fracvars, /**< pointer to store the array of NLP fractional variables, or NULL */
666 SCIP_Real** fracvarssol, /**< pointer to store the array of NLP fractional variables solution values, or NULL */
667 SCIP_Real** fracvarsfrac, /**< pointer to store the array of NLP fractional variables fractionalities, or NULL */
668 int* nfracvars, /**< pointer to store the number of NLP fractional variables , or NULL */
669 int* npriofracvars /**< pointer to store the number of NLP fractional variables with maximal branching priority, or NULL */
670 )
671{
673
674 if( scip->nlp == NULL )
675 {
676 SCIPerrorMessage("NLP has not been constructed.\n");
677 return SCIP_INVALIDCALL;
678 }
679
680 SCIP_CALL( SCIPnlpGetFracVars(scip->nlp, SCIPblkmem(scip), scip->set, scip->stat, fracvars, fracvarssol, fracvarsfrac, nfracvars, npriofracvars) );
681
682 return SCIP_OKAY;
683}
684
685/** writes current NLP to a file
686 *
687 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
688 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
689 *
690 * @pre This method can be called if SCIP is in one of the following stages:
691 * - \ref SCIP_STAGE_INITSOLVE
692 * - \ref SCIP_STAGE_SOLVING
693 */
695 SCIP* scip, /**< SCIP data structure */
696 const char* filename /**< file name */
697 )
698{
700
701 if( scip->nlp == NULL )
702 {
703 SCIPerrorMessage("NLP has not been constructed.\n");
704 return SCIP_INVALIDCALL;
705 }
706
707 SCIP_CALL( SCIPnlpWrite(scip->nlp, scip->mem->probmem, scip->set, scip->stat, scip->messagehdlr, filename) );
708
709 return SCIP_OKAY;
710}
711
712/** gets the NLP interface and problem used by the SCIP NLP
713 *
714 * @warning With the NLPI and its problem, all methods defined in \ref scip_nlpi.h and \ref pub_nlpi.h can be used.
715 * It needs to be ensured that the full internal state of the NLPI does not change or is recovered completely
716 * after the end of the method that uses the NLPI. In particular, if the NLP or its solution is manipulated
717 * (e.g. by calling one of the SCIPaddNlpi...() or the SCIPsolveNlpi() method), one has to check in advance
718 * whether the NLP is currently solved. If this is the case, one has to make sure that the internal solution
719 * status is recovered completely again. Additionally one has to resolve the NLP with
720 * SCIPsolveNlpi() in order to reinstall the internal solution status.
721 *
722 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
723 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
724 *
725 * @pre This method can be called if SCIP is in one of the following stages:
726 * - \ref SCIP_STAGE_INITSOLVE
727 * - \ref SCIP_STAGE_SOLVING
728 */
730 SCIP* scip, /**< SCIP data structure */
731 SCIP_NLPI** nlpi, /**< pointer to store the NLP solver interface */
732 SCIP_NLPIPROBLEM** nlpiproblem /**< pointer to store the NLP solver interface problem */
733 )
734{
735 assert(nlpi != NULL);
736 assert(nlpiproblem != NULL);
737
739
740 if( scip->nlp == NULL )
741 {
742 SCIPerrorMessage("NLP has not been constructed.\n");
743 return SCIP_INVALIDCALL;
744 }
745
746 *nlpi = SCIPnlpGetNLPI(scip->nlp);
747 *nlpiproblem = SCIPnlpGetNLPIProblem(scip->nlp);
748
749 return SCIP_OKAY;
750}
751
752/** @} */
753
754/**@addtogroup PublicNLPDiveMethods
755 * @{ */
756
757/** initiates NLP diving
758 *
759 * Makes functions SCIPchgVarObjDiveNLP(), SCIPchgVarBoundsDiveNLP() and SCIPchgVarsBoundsDiveNLP() available.
760 * Further, SCIPsolveNLP() can be used to solve the diving NLP.
761 *
762 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
763 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
764 *
765 * @pre This method can be called if SCIP is in one of the following stages:
766 * - \ref SCIP_STAGE_INITSOLVE
767 * - \ref SCIP_STAGE_SOLVING
768 */
770 SCIP* scip /**< SCIP data structure */
771 )
772{
774
775 if( scip->nlp == NULL )
776 {
777 SCIPerrorMessage("NLP has not been constructed.\n");
778 return SCIP_INVALIDCALL;
779 }
780
781 SCIP_CALL( SCIPnlpStartDive(scip->nlp, SCIPblkmem(scip), scip->set, scip->stat) );
782
783 return SCIP_OKAY;
784}
785
786/** ends NLP diving
787 *
788 * Resets changes made by SCIPchgVarObjDiveNLP(), SCIPchgVarBoundsDiveNLP(), and SCIPchgVarsBoundsDiveNLP().
789 *
790 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
791 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
792 *
793 * @pre This method can be called if SCIP is in one of the following stages:
794 * - \ref SCIP_STAGE_INITSOLVE
795 * - \ref SCIP_STAGE_SOLVING
796 */
798 SCIP* scip /**< SCIP data structure */
799 )
800{
802
803 if( scip->nlp == NULL )
804 {
805 SCIPerrorMessage("NLP has not been constructed.\n");
806 return SCIP_INVALIDCALL;
807 }
808
809 SCIP_CALL( SCIPnlpEndDive(scip->nlp, SCIPblkmem(scip), scip->set, scip->stat) );
810
811 return SCIP_OKAY;
812}
813
814/** changes linear objective coefficient of a variable in diving NLP
815 *
816 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
817 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
818 *
819 * @pre This method can be called if SCIP is in one of the following stages:
820 * - \ref SCIP_STAGE_INITSOLVE
821 * - \ref SCIP_STAGE_SOLVING
822 */
824 SCIP* scip, /**< SCIP data structure */
825 SCIP_VAR* var, /**< variable which coefficient to change */
826 SCIP_Real coef /**< new value for coefficient */
827 )
828{
829 SCIP_CALL( SCIPcheckStage(scip, "SCIPchgVarObjDiveNLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
830
831 assert( var->scip == scip );
832
833 if( scip->nlp == NULL )
834 {
835 SCIPerrorMessage("NLP has not been constructed.\n");
836 return SCIP_INVALIDCALL;
837 }
838
839 SCIP_CALL( SCIPnlpChgVarObjDive(scip->nlp, SCIPblkmem(scip), scip->set, scip->stat, var, coef) );
840
841 return SCIP_OKAY;
842}
843
844/** changes bounds of a variable in diving NLP
845 *
846 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
847 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
848 *
849 * @pre This method can be called if SCIP is in one of the following stages:
850 * - \ref SCIP_STAGE_INITSOLVE
851 * - \ref SCIP_STAGE_SOLVING
852 */
854 SCIP* scip, /**< SCIP data structure */
855 SCIP_VAR* var, /**< variable which bounds to change */
856 SCIP_Real lb, /**< new lower bound */
857 SCIP_Real ub /**< new upper bound */
858 )
859{
860 SCIP_CALL( SCIPcheckStage(scip, "SCIPchgVarBoundsDiveNLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
861
862 assert( var->scip == scip );
863
864 if( scip->nlp == NULL )
865 {
866 SCIPerrorMessage("NLP has not been constructed.\n");
867 return SCIP_INVALIDCALL;
868 }
869
870 SCIP_CALL( SCIPnlpChgVarBoundsDive(scip->set, scip->nlp, var, lb, ub) );
871
872 return SCIP_OKAY;
873}
874
875/** changes bounds of a set of variables in diving NLP
876 *
877 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
878 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
879 *
880 * @pre This method can be called if SCIP is in one of the following stages:
881 * - \ref SCIP_STAGE_INITSOLVE
882 * - \ref SCIP_STAGE_SOLVING
883 */
885 SCIP* scip, /**< SCIP data structure */
886 int nvars, /**< number of variables which bounds to changes */
887 SCIP_VAR** vars, /**< variables which bounds to change */
888 SCIP_Real* lbs, /**< new lower bounds */
889 SCIP_Real* ubs /**< new upper bounds */
890 )
891{
892 SCIP_CALL( SCIPcheckStage(scip, "SCIPchgVarsBoundsDiveNLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
893
894 if( scip->nlp == NULL )
895 {
896 SCIPerrorMessage("NLP has not been constructed.\n");
897 return SCIP_INVALIDCALL;
898 }
899
900 SCIP_CALL( SCIPnlpChgVarsBoundsDive(scip->nlp, scip->set, nvars, vars, lbs, ubs) );
901
902 return SCIP_OKAY;
903}
904
905/** @} */
906
907/**@addtogroup PublicNLRowMethods
908 * @{
909 */
910
911/** creates and captures a nonlinear row
912 *
913 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
914 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
915 *
916 * @pre This method can be called if SCIP is in one of the following stages:
917 * - \ref SCIP_STAGE_PRESOLVED
918 * - \ref SCIP_STAGE_INITSOLVE
919 * - \ref SCIP_STAGE_SOLVING
920 */
922 SCIP* scip, /**< SCIP data structure */
923 SCIP_NLROW** nlrow, /**< buffer to store pointer to nonlinear row */
924 const char* name, /**< name of nonlinear row */
925 SCIP_Real constant, /**< constant */
926 int nlinvars, /**< number of linear variables */
927 SCIP_VAR** linvars, /**< linear variables, or NULL if nlinvars == 0 */
928 SCIP_Real* lincoefs, /**< linear coefficients, or NULL if nlinvars == 0 */
929 SCIP_EXPR* expr, /**< nonlinear expression, or NULL */
930 SCIP_Real lhs, /**< left hand side */
931 SCIP_Real rhs, /**< right hand side */
932 SCIP_EXPRCURV curvature /**< curvature of the nonlinear row */
933 )
934{
936
937 SCIP_CALL( SCIPnlrowCreate(nlrow, scip->mem->probmem, scip->set, scip->stat,
938 name, constant, nlinvars, linvars, lincoefs, expr, lhs, rhs, curvature) );
939
940 return SCIP_OKAY;
941}
942
943/** creates and captures a nonlinear row without any coefficients
944 *
945 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
946 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
947 *
948 * @pre This method can be called if SCIP is in one of the following stages:
949 * - \ref SCIP_STAGE_PRESOLVED
950 * - \ref SCIP_STAGE_INITSOLVE
951 * - \ref SCIP_STAGE_SOLVING
952 */
954 SCIP* scip, /**< SCIP data structure */
955 SCIP_NLROW** nlrow, /**< pointer to nonlinear row */
956 const char* name, /**< name of nonlinear row */
957 SCIP_Real lhs, /**< left hand side */
958 SCIP_Real rhs /**< right hand side */
959 )
960{
961 SCIP_CALL( SCIPcheckStage(scip, "SCIPcreateEmptyNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
962
963 SCIP_CALL( SCIPnlrowCreate(nlrow, scip->mem->probmem, scip->set, scip->stat,
964 name, 0.0, 0, NULL, NULL, NULL, lhs, rhs, SCIP_EXPRCURV_UNKNOWN) );
965
966 return SCIP_OKAY;
967}
968
969/** creates and captures a nonlinear row from a linear row
970 *
971 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
972 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
973 *
974 * @pre This method can be called if SCIP is in one of the following stages:
975 * - \ref SCIP_STAGE_PRESOLVED
976 * - \ref SCIP_STAGE_INITSOLVE
977 * - \ref SCIP_STAGE_SOLVING
978 */
980 SCIP* scip, /**< SCIP data structure */
981 SCIP_NLROW** nlrow, /**< pointer to nonlinear row */
982 SCIP_ROW* row /**< the linear row to copy */
983 )
984{
985 SCIP_CALL( SCIPcheckStage(scip, "SCIPcreateNlRowFromRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
986
987 SCIP_CALL( SCIPnlrowCreateFromRow(nlrow, scip->mem->probmem, scip->set, scip->stat, row) );
988
989 return SCIP_OKAY;
990}
991
992/** increases usage counter of a nonlinear row
993 *
994 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
995 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
996 *
997 * @pre This method can be called if SCIP is in one of the following stages:
998 * - \ref SCIP_STAGE_PRESOLVED
999 * - \ref SCIP_STAGE_INITSOLVE
1000 * - \ref SCIP_STAGE_SOLVING
1001 */
1003 SCIP* scip, /**< SCIP data structure */
1004 SCIP_NLROW* nlrow /**< nonlinear row to capture */
1005 )
1006{
1008
1009 SCIPnlrowCapture(nlrow);
1010
1011 return SCIP_OKAY;
1012}
1013
1014/** decreases usage counter of a nonlinear row, and frees memory if necessary
1015 *
1016 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1017 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1018 *
1019 * @pre This method can be called if SCIP is in one of the following stages:
1020 * - \ref SCIP_STAGE_PRESOLVED
1021 * - \ref SCIP_STAGE_INITSOLVE
1022 * - \ref SCIP_STAGE_SOLVING
1023 * - \ref SCIP_STAGE_EXITSOLVE
1024 */
1026 SCIP* scip, /**< SCIP data structure */
1027 SCIP_NLROW** nlrow /**< pointer to nonlinear row */
1028 )
1029{
1031
1032 SCIP_CALL( SCIPnlrowRelease(nlrow, scip->mem->probmem, scip->set, scip->stat) );
1033
1034 return SCIP_OKAY;
1035}
1036
1037/** changes left hand side of a nonlinear row
1038 *
1039 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1040 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1041 *
1042 * @pre This method can be called if SCIP is in one of the following stages:
1043 * - \ref SCIP_STAGE_PRESOLVED
1044 * - \ref SCIP_STAGE_INITSOLVE
1045 * - \ref SCIP_STAGE_SOLVING
1046 */
1048 SCIP* scip, /**< SCIP data structure */
1049 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1050 SCIP_Real lhs /**< new left hand side */
1051 )
1052{
1054
1055 SCIP_CALL( SCIPnlrowChgLhs(nlrow, scip->set, scip->stat, scip->nlp, lhs) );
1056
1057 return SCIP_OKAY;
1058}
1059
1060/** changes right hand side of a nonlinear row
1061 *
1062 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1063 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1064 *
1065 * @pre This method can be called if SCIP is in one of the following stages:
1066 * - \ref SCIP_STAGE_PRESOLVED
1067 * - \ref SCIP_STAGE_INITSOLVE
1068 * - \ref SCIP_STAGE_SOLVING
1069 */
1071 SCIP* scip, /**< SCIP data structure */
1072 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1073 SCIP_Real rhs /**< new right hand side */
1074 )
1075{
1077
1078 SCIP_CALL( SCIPnlrowChgRhs(nlrow, scip->set, scip->stat, scip->nlp, rhs) );
1079
1080 return SCIP_OKAY;
1081}
1082
1083/** changes constant of a nonlinear row
1084 *
1085 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1086 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1087 *
1088 * @pre This method can be called if SCIP is in one of the following stages:
1089 * - \ref SCIP_STAGE_PRESOLVED
1090 * - \ref SCIP_STAGE_INITSOLVE
1091 * - \ref SCIP_STAGE_SOLVING
1092 */
1094 SCIP* scip, /**< SCIP data structure */
1095 SCIP_NLROW* nlrow, /**< NLP row */
1096 SCIP_Real constant /**< new value for constant */
1097 )
1098{
1099 SCIP_CALL( SCIPcheckStage(scip, "SCIPchgNlRowConstant", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1100
1101 SCIP_CALL( SCIPnlrowChgConstant(nlrow, scip->set, scip->stat, scip->nlp, constant) );
1102
1103 return SCIP_OKAY;
1104}
1105
1106/** adds variable with a linear coefficient to a nonlinear row
1107 *
1108 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1109 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1110 *
1111 * @pre This method can be called if SCIP is in one of the following stages:
1112 * - \ref SCIP_STAGE_PRESOLVED
1113 * - \ref SCIP_STAGE_INITSOLVE
1114 * - \ref SCIP_STAGE_SOLVING
1115 */
1117 SCIP* scip, /**< SCIP data structure */
1118 SCIP_NLROW* nlrow, /**< NLP row */
1119 SCIP_VAR* var, /**< problem variable */
1120 SCIP_Real val /**< value of coefficient in linear part of row */
1121 )
1122{
1123 SCIP_CALL( SCIPcheckStage(scip, "SCIPaddLinearCoefToNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1124
1125 SCIP_CALL( SCIPnlrowAddLinearCoef(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, var, val) );
1126
1127 return SCIP_OKAY;
1128}
1129
1130/** adds variables with linear coefficients to a row
1131 *
1132 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1133 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1134 *
1135 * @pre This method can be called if SCIP is in one of the following stages:
1136 * - \ref SCIP_STAGE_PRESOLVED
1137 * - \ref SCIP_STAGE_INITSOLVE
1138 * - \ref SCIP_STAGE_SOLVING
1139 */
1141 SCIP* scip, /**< SCIP data structure */
1142 SCIP_NLROW* nlrow, /**< NLP row */
1143 int nvars, /**< number of variables to add to the row */
1144 SCIP_VAR** vars, /**< problem variables to add */
1145 SCIP_Real* vals /**< values of coefficients in linear part of row */
1146 )
1147{
1148 int v;
1149
1150 assert(nvars == 0 || vars != NULL);
1151 assert(nvars == 0 || vals != NULL);
1152
1153 SCIP_CALL( SCIPcheckStage(scip, "SCIPaddLinearCoefsToNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1154
1155 /* add the variables to the row */
1156 for( v = 0; v < nvars; ++v )
1157 {
1158 SCIP_CALL( SCIPnlrowAddLinearCoef(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, vars[v], vals[v]) );
1159 }
1160
1161 return SCIP_OKAY;
1162}
1163
1164/** changes linear coefficient of a variables in a nonlinear row
1165 *
1166 * Setting the coefficient to 0.0 means that it is removed from the row.
1167 * The variable does not need to exists before.
1168 *
1169 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1170 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1171 *
1172 * @pre This method can be called if SCIP is in one of the following stages:
1173 * - \ref SCIP_STAGE_PRESOLVED
1174 * - \ref SCIP_STAGE_INITSOLVE
1175 * - \ref SCIP_STAGE_SOLVING
1176 */
1178 SCIP* scip, /**< SCIP data structure */
1179 SCIP_NLROW* nlrow, /**< NLP row */
1180 SCIP_VAR* var, /**< variable */
1181 SCIP_Real coef /**< new value of coefficient */
1182 )
1183{
1184 assert(var != NULL);
1185
1186 SCIP_CALL( SCIPcheckStage(scip, "SCIPchgNlRowLinearCoef", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1187
1188 SCIP_CALL( SCIPnlrowChgLinearCoef(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, var, coef) );
1189
1190 return SCIP_OKAY;
1191}
1192
1193/** sets or deletes expression in a nonlinear row
1194 *
1195 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1196 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1197 *
1198 * @pre This method can be called if SCIP is in one of the following stages:
1199 * - \ref SCIP_STAGE_PRESOLVED
1200 * - \ref SCIP_STAGE_INITSOLVE
1201 * - \ref SCIP_STAGE_SOLVING
1202 */
1204 SCIP* scip, /**< SCIP data structure */
1205 SCIP_NLROW* nlrow, /**< NLP row */
1206 SCIP_EXPR* expr /**< expression, or NULL */
1207 )
1208{
1210
1211 SCIP_CALL( SCIPnlrowChgExpr(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, expr) );
1212
1213 /* invalidate curvature */
1215
1216 return SCIP_OKAY;
1217}
1218
1219/** recalculates the activity of a nonlinear row in the last NLP solution
1220 *
1221 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1222 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1223 *
1224 * @pre This method can be called if SCIP is in one of the following stages:
1225 * - \ref SCIP_STAGE_PRESOLVED
1226 * - \ref SCIP_STAGE_INITSOLVE
1227 * - \ref SCIP_STAGE_SOLVING
1228 */
1230 SCIP* scip, /**< SCIP data structure */
1231 SCIP_NLROW* nlrow /**< NLP nonlinear row */
1232 )
1233{
1234 SCIP_CALL( SCIPcheckStage(scip, "SCIPrecalcNlRowNLPActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1235
1236 if( scip->nlp == NULL )
1237 {
1238 SCIPerrorMessage("do not have NLP for computing NLP activity\n");
1239 return SCIP_INVALIDCALL;
1240 }
1241
1242 SCIP_CALL( SCIPnlrowRecalcNLPActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp) );
1243
1244 return SCIP_OKAY;
1245}
1246
1247/** returns the activity of a nonlinear row in the last NLP solution
1248 *
1249 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1250 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1251 *
1252 * @pre This method can be called if SCIP is in one of the following stages:
1253 * - \ref SCIP_STAGE_INITSOLVE
1254 * - \ref SCIP_STAGE_SOLVING
1255 */
1257 SCIP* scip, /**< SCIP data structure */
1258 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1259 SCIP_Real* activity /**< pointer to store activity value */
1260 )
1261{
1262 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowNLPActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1263
1264 if( scip->nlp == NULL )
1265 {
1266 SCIPerrorMessage("do not have NLP for computing NLP activity\n");
1267 return SCIP_INVALIDCALL;
1268 }
1269
1270 SCIP_CALL( SCIPnlrowGetNLPActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp, activity) );
1271
1272 return SCIP_OKAY;
1273}
1274
1275/** gives the feasibility of a nonlinear row in the last NLP solution: negative value means infeasibility
1276 *
1277 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1278 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1279 *
1280 * @pre This method can be called if SCIP is in one of the following stages:
1281 * - \ref SCIP_STAGE_INITSOLVE
1282 * - \ref SCIP_STAGE_SOLVING
1283 */
1285 SCIP* scip, /**< SCIP data structure */
1286 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1287 SCIP_Real* feasibility /**< pointer to store feasibility value */
1288 )
1289{
1290 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowNLPFeasibility", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1291
1292 if( scip->nlp == NULL )
1293 {
1294 SCIPerrorMessage("do not have NLP for computing NLP feasibility\n");
1295 return SCIP_INVALIDCALL;
1296 }
1297
1298 SCIP_CALL( SCIPnlrowGetNLPFeasibility(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp, feasibility) );
1299
1300 return SCIP_OKAY;
1301}
1302
1303/** recalculates the activity of a nonlinear row for the current pseudo solution
1304 *
1305 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1306 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1307 *
1308 * @pre This method can be called if SCIP is in one of the following stages:
1309 * - \ref SCIP_STAGE_INITSOLVE
1310 * - \ref SCIP_STAGE_SOLVING
1311 */
1313 SCIP* scip, /**< SCIP data structure */
1314 SCIP_NLROW* nlrow /**< NLP nonlinear row */
1315 )
1316{
1317 SCIP_CALL( SCIPcheckStage(scip, "SCIPrecalcNlRowPseudoActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1318
1319 SCIP_CALL( SCIPnlrowRecalcPseudoActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal, scip->tree, scip->lp) );
1320
1321 return SCIP_OKAY;
1322}
1323
1324/** gives the activity of a nonlinear row for the current pseudo solution
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* pseudoactivity /**< pointer to store pseudo activity value */
1337 )
1338{
1339 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowPseudoActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1340
1341 SCIP_CALL( SCIPnlrowGetPseudoActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal, scip->tree, scip->lp, pseudoactivity) );
1342
1343 return SCIP_OKAY;
1344}
1345
1346/** gives the feasibility of a nonlinear row for the current pseudo solution: negative value means infeasibility
1347 *
1348 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1349 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1350 *
1351 * @pre This method can be called if SCIP is in one of the following stages:
1352 * - \ref SCIP_STAGE_INITSOLVE
1353 * - \ref SCIP_STAGE_SOLVING
1354 */
1356 SCIP* scip, /**< SCIP data structure */
1357 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1358 SCIP_Real* pseudofeasibility /**< pointer to store pseudo feasibility value */
1359 )
1360{
1361 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowPseudoFeasibility", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1362
1363 SCIP_CALL( SCIPnlrowGetPseudoFeasibility(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal, scip->tree, scip->lp, pseudofeasibility) );
1364
1365 return SCIP_OKAY;
1366}
1367
1368/** recalculates the activity of a nonlinear row in the last NLP or pseudo solution
1369 *
1370 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1371 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1372 *
1373 * @pre This method can be called if SCIP is in one of the following stages:
1374 * - \ref SCIP_STAGE_INITSOLVE
1375 * - \ref SCIP_STAGE_SOLVING
1376 */
1378 SCIP* scip, /**< SCIP data structure */
1379 SCIP_NLROW* nlrow /**< NLP nonlinear row */
1380 )
1381{
1382 SCIP_CALL( SCIPcheckStage(scip, "SCIPrecalcNlRowActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1383
1384 if( scip->nlp != NULL && SCIPnlpHasCurrentNodeNLP(scip->nlp) && SCIPnlpHasSolution(scip->nlp) )
1385 {
1386 SCIP_CALL( SCIPnlrowRecalcNLPActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp) );
1387 }
1388 else
1389 {
1390 SCIP_CALL( SCIPnlrowRecalcPseudoActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal, scip->tree, scip->lp) );
1391 }
1392
1393 return SCIP_OKAY;
1394}
1395
1396/** gives the activity of a nonlinear row in the last NLP or pseudo solution
1397 *
1398 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1399 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1400 *
1401 * @pre This method can be called if SCIP is in one of the following stages:
1402 * - \ref SCIP_STAGE_INITSOLVE
1403 * - \ref SCIP_STAGE_SOLVING
1404 */
1406 SCIP* scip, /**< SCIP data structure */
1407 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1408 SCIP_Real* activity /**< pointer to store activity value */
1409 )
1410{
1411 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1412
1413 if( scip->nlp != NULL && SCIPnlpHasCurrentNodeNLP(scip->nlp) && SCIPnlpHasSolution(scip->nlp) )
1414 {
1415 SCIP_CALL( SCIPnlrowGetNLPActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp, activity) );
1416 }
1417 else
1418 {
1419 SCIP_CALL( SCIPnlrowGetPseudoActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal, scip->tree, scip->lp, activity) );
1420 }
1421
1422 return SCIP_OKAY;
1423}
1424
1425/** gives the feasibility of a nonlinear row in the last NLP or pseudo solution
1426 *
1427 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1428 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1429 *
1430 * @pre This method can be called if SCIP is in one of the following stages:
1431 * - \ref SCIP_STAGE_INITSOLVE
1432 * - \ref SCIP_STAGE_SOLVING
1433 */
1435 SCIP* scip, /**< SCIP data structure */
1436 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1437 SCIP_Real* feasibility /**< pointer to store feasibility value */
1438 )
1439{
1440 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowFeasibility", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1441
1442 if( scip->nlp != NULL && SCIPnlpHasCurrentNodeNLP(scip->nlp) && SCIPnlpHasSolution(scip->nlp) )
1443 {
1444 SCIP_CALL( SCIPnlrowGetNLPFeasibility(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp, feasibility) );
1445 }
1446 else
1447 {
1448 SCIP_CALL( SCIPnlrowGetPseudoFeasibility(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal, scip->tree, scip->lp, feasibility) );
1449 }
1450
1451 return SCIP_OKAY;
1452}
1453
1454/** gives the activity of a nonlinear row for the given primal solution or NLP solution or pseudo solution
1455 *
1456 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1457 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1458 *
1459 * @pre This method can be called if SCIP is in one of the following stages:
1460 * - \ref SCIP_STAGE_INITSOLVE
1461 * - \ref SCIP_STAGE_SOLVING
1462 */
1464 SCIP* scip, /**< SCIP data structure */
1465 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1466 SCIP_SOL* sol, /**< primal CIP solution, or NULL for NLP solution of pseudo solution */
1467 SCIP_Real* activity /**< pointer to store activity value */
1468 )
1469{
1470 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowSolActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1471
1472 if( sol != NULL )
1473 {
1474 SCIP_CALL( SCIPnlrowGetSolActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, sol, activity) );
1475 }
1476 else if( scip->nlp != NULL && SCIPnlpHasCurrentNodeNLP(scip->nlp) && SCIPnlpHasSolution(scip->nlp) )
1477 {
1478 SCIP_CALL( SCIPnlrowGetNLPActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp, activity) );
1479 }
1480 else
1481 {
1482 SCIP_CALL( SCIPnlrowGetPseudoActivity(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal, scip->tree, scip->lp, activity) );
1483 }
1484
1485 return SCIP_OKAY;
1486}
1487
1488/** gives the feasibility of a nonlinear row for the given primal solution
1489 *
1490 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1491 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1492 *
1493 * @pre This method can be called if SCIP is in one of the following stages:
1494 * - \ref SCIP_STAGE_INITSOLVE
1495 * - \ref SCIP_STAGE_SOLVING
1496 */
1498 SCIP* scip, /**< SCIP data structure */
1499 SCIP_NLROW* nlrow, /**< NLP nonlinear row */
1500 SCIP_SOL* sol, /**< primal CIP solution */
1501 SCIP_Real* feasibility /**< pointer to store feasibility value */
1502 )
1503{
1504 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowSolFeasibility", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1505
1506 if( sol != NULL )
1507 {
1508 SCIP_CALL( SCIPnlrowGetSolFeasibility(nlrow, scip->mem->probmem, scip->set, scip->stat, sol, feasibility) );
1509 }
1510 else if( scip->nlp != NULL && SCIPnlpHasCurrentNodeNLP(scip->nlp) && SCIPnlpHasSolution(scip->nlp) )
1511 {
1512 SCIP_CALL( SCIPnlrowGetNLPFeasibility(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp, feasibility) );
1513 }
1514 else
1515 {
1516 SCIP_CALL( SCIPnlrowGetPseudoFeasibility(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal, scip->tree, scip->lp, feasibility) );
1517 }
1518
1519 return SCIP_OKAY;
1520}
1521
1522/** gives the minimal and maximal activity of a nonlinear row w.r.t. the variable's bounds
1523 *
1524 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1525 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1526 *
1527 * @pre This method can be called if SCIP is in one of the following stages:
1528 * - \ref SCIP_STAGE_PRESOLVED
1529 * - \ref SCIP_STAGE_INITSOLVE
1530 * - \ref SCIP_STAGE_SOLVING
1531 */
1533 SCIP* scip, /**< SCIP data structure */
1534 SCIP_NLROW* nlrow, /**< NLP row */
1535 SCIP_Real* minactivity, /**< buffer to store minimal activity, or NULL */
1536 SCIP_Real* maxactivity /**< buffer to store maximal activity, or NULL */
1537 )
1538{
1539 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetNlRowActivityBounds", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1540
1541 SCIP_CALL( SCIPnlrowGetActivityBounds(nlrow, scip->mem->probmem, scip->set, scip->stat, minactivity, maxactivity) );
1542
1543 return SCIP_OKAY;
1544}
1545
1546/** prints a nonlinear row to file stream
1547 *
1548 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1549 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1550 *
1551 * @pre This method can be called if SCIP is in one of the following stages:
1552 * - \ref SCIP_STAGE_PRESOLVED
1553 * - \ref SCIP_STAGE_INITSOLVE
1554 * - \ref SCIP_STAGE_SOLVING
1555 */
1557 SCIP* scip, /**< SCIP data structure */
1558 SCIP_NLROW* nlrow, /**< NLP row */
1559 FILE* file /**< output file (or NULL for standard output) */
1560 )
1561{
1562 assert(nlrow != NULL);
1563
1565
1566 SCIP_CALL( SCIPnlrowPrint(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->messagehdlr, file) );
1567
1568 return SCIP_OKAY;
1569}
1570
1571/** @} */
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:2208
methods for debugging
#define SCIP_INVALID
Definition def.h:206
#define TRUE
Definition def.h:95
#define FALSE
Definition def.h:96
#define SCIP_CALL_ABORT(x)
Definition def.h:367
#define SCIPABORT()
Definition def.h:360
#define SCIP_CALL(x)
Definition def.h:388
#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:797
SCIP_RETCODE SCIPchgVarsBoundsDiveNLP(SCIP *scip, int nvars, SCIP_VAR **vars, SCIP_Real *lbs, SCIP_Real *ubs)
Definition scip_nlp.c:884
SCIP_RETCODE SCIPstartDiveNLP(SCIP *scip)
Definition scip_nlp.c:769
SCIP_RETCODE SCIPchgVarBoundsDiveNLP(SCIP *scip, SCIP_VAR *var, SCIP_Real lb, SCIP_Real ub)
Definition scip_nlp.c:853
SCIP_RETCODE SCIPchgVarObjDiveNLP(SCIP *scip, SCIP_VAR *var, SCIP_Real coef)
Definition scip_nlp.c:823
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:391
SCIP_RETCODE SCIPaddNlRow(SCIP *scip, SCIP_NLROW *nlrow)
Definition scip_nlp.c:363
SCIP_RETCODE SCIPflushNLP(SCIP *scip)
Definition scip_nlp.c:415
SCIP_RETCODE SCIPwriteNLP(SCIP *scip, const char *filename)
Definition scip_nlp.c:694
SCIP_Bool SCIPisNLPConstructed(SCIP *scip)
Definition scip_nlp.c:110
SCIP_NLPSOLSTAT SCIPgetNLPSolstat(SCIP *scip)
Definition scip_nlp.c:541
SCIP_RETCODE SCIPsetNLPInitialGuess(SCIP *scip, SCIP_Real *initialguess)
Definition scip_nlp.c:441
SCIP_Real SCIPgetNLPObjval(SCIP *scip)
Definition scip_nlp.c:612
SCIP_RETCODE SCIPsolveNLPParam(SCIP *scip, SCIP_NLPPARAM param)
Definition scip_nlp.c:512
SCIP_RETCODE SCIPgetNLPI(SCIP *scip, SCIP_NLPI **nlpi, SCIP_NLPIPROBLEM **nlpiproblem)
Definition scip_nlp.c:729
SCIP_RETCODE SCIPgetNLPFracVars(SCIP *scip, SCIP_VAR ***fracvars, SCIP_Real **fracvarssol, SCIP_Real **fracvarsfrac, int *nfracvars, int *npriofracvars)
Definition scip_nlp.c:663
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:468
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:638
SCIP_NLROW ** SCIPgetNLPNlRows(SCIP *scip)
Definition scip_nlp.c:319
SCIP_NLPTERMSTAT SCIPgetNLPTermstat(SCIP *scip)
Definition scip_nlp.c:563
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:588
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:1374
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:842
SCIP_RETCODE SCIPnlrowRelease(SCIP_NLROW **nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition nlp.c:1098
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:1491
SCIP_RETCODE SCIPsetNlRowExpr(SCIP *scip, SCIP_NLROW *nlrow, SCIP_EXPR *expr)
Definition scip_nlp.c:1203
SCIP_RETCODE SCIPgetNlRowActivityBounds(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real *minactivity, SCIP_Real *maxactivity)
Definition scip_nlp.c:1532
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:1249
SCIP_RETCODE SCIPaddLinearCoefToNlRow(SCIP *scip, SCIP_NLROW *nlrow, SCIP_VAR *var, SCIP_Real val)
Definition scip_nlp.c:1116
SCIP_RETCODE SCIPcaptureNlRow(SCIP *scip, SCIP_NLROW *nlrow)
Definition scip_nlp.c:1002
SCIP_RETCODE SCIPrecalcNlRowNLPActivity(SCIP *scip, SCIP_NLROW *nlrow)
Definition scip_nlp.c:1229
SCIP_RETCODE SCIPnlrowGetActivityBounds(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_Real *minactivity, SCIP_Real *maxactivity)
Definition nlp.c:1688
SCIP_RETCODE SCIPcreateEmptyNlRow(SCIP *scip, SCIP_NLROW **nlrow, const char *name, SCIP_Real lhs, SCIP_Real rhs)
Definition scip_nlp.c:953
SCIP_RETCODE SCIPnlrowGetSolFeasibility(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_SOL *sol, SCIP_Real *feasibility)
Definition nlp.c:1666
SCIP_RETCODE SCIPgetNlRowSolFeasibility(SCIP *scip, SCIP_NLROW *nlrow, SCIP_SOL *sol, SCIP_Real *feasibility)
Definition scip_nlp.c:1497
void SCIPnlrowSetCurvature(SCIP_NLROW *nlrow, SCIP_EXPRCURV curvature)
Definition nlp.c:1842
SCIP_RETCODE SCIPchgNlRowLinearCoef(SCIP *scip, SCIP_NLROW *nlrow, SCIP_VAR *var, SCIP_Real coef)
Definition scip_nlp.c:1177
SCIP_RETCODE SCIPgetNlRowActivity(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real *activity)
Definition scip_nlp.c:1405
SCIP_RETCODE SCIPgetNlRowNLPFeasibility(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real *feasibility)
Definition scip_nlp.c:1284
SCIP_RETCODE SCIPgetNlRowPseudoActivity(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real *pseudoactivity)
Definition scip_nlp.c:1333
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:1168
SCIP_RETCODE SCIPnlrowChgLhs(SCIP_NLROW *nlrow, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp, SCIP_Real lhs)
Definition nlp.c:1354
SCIP_RETCODE SCIPchgNlRowRhs(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real rhs)
Definition scip_nlp.c:1070
SCIP_RETCODE SCIPnlrowChgExpr(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp, SCIP_EXPR *expr)
Definition nlp.c:1287
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:1461
SCIP_RETCODE SCIPreleaseNlRow(SCIP *scip, SCIP_NLROW **nlrow)
Definition scip_nlp.c:1025
SCIP_RETCODE SCIPgetNlRowFeasibility(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real *feasibility)
Definition scip_nlp.c:1434
SCIP_RETCODE SCIPchgNlRowConstant(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real constant)
Definition scip_nlp.c:1093
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:1409
SCIP_RETCODE SCIPrecalcNlRowActivity(SCIP *scip, SCIP_NLROW *nlrow)
Definition scip_nlp.c:1377
SCIP_RETCODE SCIPchgNlRowLhs(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real lhs)
Definition scip_nlp.c:1047
SCIP_RETCODE SCIPnlrowGetSolActivity(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_SOL *sol, SCIP_Real *activity)
Definition nlp.c:1617
SCIP_RETCODE SCIPnlrowPrint(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition nlp.c:1039
SCIP_RETCODE SCIPgetNlRowNLPActivity(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real *activity)
Definition scip_nlp.c:1256
SCIP_RETCODE SCIPnlrowChgConstant(SCIP_NLROW *nlrow, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp, SCIP_Real constant)
Definition nlp.c:1334
SCIP_RETCODE SCIPgetNlRowPseudoFeasibility(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real *pseudofeasibility)
Definition scip_nlp.c:1355
SCIP_RETCODE SCIPprintNlRow(SCIP *scip, SCIP_NLROW *nlrow, FILE *file)
Definition scip_nlp.c:1556
SCIP_RETCODE SCIPgetNlRowSolActivity(SCIP *scip, SCIP_NLROW *nlrow, SCIP_SOL *sol, SCIP_Real *activity)
Definition scip_nlp.c:1463
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:1592
SCIP_RETCODE SCIPcreateNlRowFromRow(SCIP *scip, SCIP_NLROW **nlrow, SCIP_ROW *row)
Definition scip_nlp.c:979
SCIP_RETCODE SCIPnlrowCreateFromRow(SCIP_NLROW **nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_ROW *row)
Definition nlp.c:976
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:921
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:1514
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:1561
SCIP_RETCODE SCIPaddLinearCoefsToNlRow(SCIP *scip, SCIP_NLROW *nlrow, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition scip_nlp.c:1140
SCIP_RETCODE SCIPrecalcNlRowPseudoActivity(SCIP *scip, SCIP_NLROW *nlrow)
Definition scip_nlp.c:1312
void SCIPnlrowCapture(SCIP_NLROW *nlrow)
Definition nlp.c:1086
SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition scip_sol.c:1398
return SCIP_OKAY
static SCIP_SOL * sol
assert(minobj< SCIPgetCutoffbound(scip))
int nvars
SCIP_VAR * var
static SCIP_VAR ** vars
#define NULL
Definition lpi_spx1.cpp:161
memory allocation routines
SCIP_Real * SCIPnlpGetVarsUbDualsol(SCIP_NLP *nlp)
Definition nlp.c:4329
SCIP_RETCODE SCIPnlpGetStatistics(SCIP_SET *set, SCIP_NLP *nlp, SCIP_NLPSTATISTICS *statistics)
Definition nlp.c:4409
SCIP_RETCODE SCIPnlpEndDive(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition nlp.c:4475
SCIP_NLPI * SCIPnlpGetNLPI(SCIP_NLP *nlp)
Definition nlp.c:4359
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition scip_mem.c:57
int SCIPnlpGetNNlRows(SCIP_NLP *nlp)
Definition nlp.c:4349
SCIP_RETCODE SCIPnlpWrite(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_MESSAGEHDLR *messagehdlr, const char *fname)
Definition nlp.c:4147
SCIP_RETCODE SCIPnlpChgVarBoundsDive(SCIP_SET *set, SCIP_NLP *nlp, SCIP_VAR *var, SCIP_Real lb, SCIP_Real ub)
Definition nlp.c:4594
SCIP_Bool SCIPnlpHasCurrentNodeNLP(SCIP_NLP *nlp)
Definition nlp.c:3673
SCIP_RETCODE SCIPnlpDelNlRow(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLROW *nlrow)
Definition nlp.c:3890
SCIP_RETCODE SCIPnlpChgVarObjDive(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var, SCIP_Real coef)
Definition nlp.c:4537
SCIP_Bool SCIPnlpHasSolution(SCIP_NLP *nlp)
Definition nlp.c:4430
SCIP_RETCODE SCIPnlpSetInitialGuess(SCIP_SET *set, SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_Real *initguess)
Definition nlp.c:4111
SCIP_RETCODE SCIPnlpGetVarsNonlinearity(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, int *nlcount)
Definition nlp.c:4222
SCIP_RETCODE SCIPnlpChgVarsBoundsDive(SCIP_NLP *nlp, SCIP_SET *set, int nvars, SCIP_VAR **vars, SCIP_Real *lbs, SCIP_Real *ubs)
Definition nlp.c:4623
SCIP_NLPTERMSTAT SCIPnlpGetTermstat(SCIP_NLP *nlp)
Definition nlp.c:4399
SCIP_RETCODE SCIPnlpAddNlRow(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLROW *nlrow)
Definition nlp.c:3834
SCIP_VAR ** SCIPnlpGetVars(SCIP_NLP *nlp)
Definition nlp.c:4202
SCIP_RETCODE SCIPnlpFlush(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition nlp.c:3922
SCIP_NLPIPROBLEM * SCIPnlpGetNLPIProblem(SCIP_NLP *nlp)
Definition nlp.c:4369
int SCIPnlpGetNVars(SCIP_NLP *nlp)
Definition nlp.c:4212
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:4031
SCIP_RETCODE SCIPnlpStartDive(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition nlp.c:4444
SCIP_Real * SCIPnlpGetVarsLbDualsol(SCIP_NLP *nlp)
Definition nlp.c:4319
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:3960
SCIP_Real SCIPnlpGetObjval(SCIP_NLP *nlp)
Definition nlp.c:3987
SCIP_NLROW ** SCIPnlpGetNlRows(SCIP_NLP *nlp)
Definition nlp.c:4339
SCIP_RETCODE SCIPnlpHasContinuousNonlinearity(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_Bool *result)
Definition nlp.c:4276
SCIP_NLPSOLSTAT SCIPnlpGetSolstat(SCIP_NLP *nlp)
Definition nlp.c:4389
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:58
@ SCIP_EXPRCURV_UNKNOWN
Definition type_expr.h:59
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_INVALIDCALL
@ SCIP_ERROR
enum SCIP_Retcode SCIP_RETCODE