Scippy

SCIP

Solving Constraint Integer Programs

nlp.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (c) 2002-2024 Zuse Institute Berlin (ZIB) */
7 /* */
8 /* Licensed under the Apache License, Version 2.0 (the "License"); */
9 /* you may not use this file except in compliance with the License. */
10 /* You may obtain a copy of the License at */
11 /* */
12 /* http://www.apache.org/licenses/LICENSE-2.0 */
13 /* */
14 /* Unless required by applicable law or agreed to in writing, software */
15 /* distributed under the License is distributed on an "AS IS" BASIS, */
16 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17 /* See the License for the specific language governing permissions and */
18 /* limitations under the License. */
19 /* */
20 /* You should have received a copy of the Apache-2.0 license */
21 /* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22 /* */
23 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24 
25 /**@file nlp.h
26  * @ingroup INTERNALAPI
27  * @brief internal methods for NLP management
28  * @author Thorsten Gellermann
29  * @author Stefan Vigerske
30  */
31 
32 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
33 
34 #ifndef __SCIP_NLP_H__
35 #define __SCIP_NLP_H__
36 
37 
38 #include <stdio.h>
39 
40 #include "scip/def.h"
41 #include "blockmemshell/memory.h"
42 #include "scip/type_event.h"
43 #include "scip/type_set.h"
44 #include "scip/type_stat.h"
45 #include "scip/type_misc.h"
46 #include "scip/type_lp.h"
47 #include "scip/type_var.h"
48 #include "scip/type_prob.h"
49 #include "scip/type_sol.h"
50 #include "scip/type_primal.h"
51 #include "scip/pub_nlp.h"
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 /**@name Nonlinear row methods */
58 /**@{ */
59 
60 /** create a new nonlinear row
61  *
62  * the new row is already captured
63  */
65  SCIP_NLROW** nlrow, /**< buffer to store pointer to nonlinear row */
66  BMS_BLKMEM* blkmem, /**< block memory */
67  SCIP_SET* set, /**< global SCIP settings */
68  SCIP_STAT* stat, /**< problem statistics data */
69  const char* name, /**< name of nonlinear row */
70  SCIP_Real constant, /**< constant */
71  int nlinvars, /**< number of linear variables */
72  SCIP_VAR** linvars, /**< linear variables, or NULL if nlinvars == 0 */
73  SCIP_Real* lincoefs, /**< linear coefficients, or NULL if nlinvars == 0 */
74  SCIP_EXPR* expr, /**< expression, or NULL */
75  SCIP_Real lhs, /**< left hand side */
76  SCIP_Real rhs, /**< right hand side */
77  SCIP_EXPRCURV curvature /**< curvature of the nonlinear row */
78  );
79 
80 /** create a nonlinear row that is a copy of a given row
81  *
82  * the new row is already captured
83  */
85  SCIP_NLROW** nlrow, /**< buffer to store pointer to nonlinear row */
86  BMS_BLKMEM* blkmem, /**< block memory */
87  SCIP_SET* set, /**< global SCIP settings */
88  SCIP_STAT* stat, /**< problem statistics data */
89  SCIP_NLROW* sourcenlrow /**< nonlinear row to copy */
90  );
91 
92 /** create a new nonlinear row from a linear row
93  *
94  * the new row is already captured
95  */
97  SCIP_NLROW** nlrow, /**< buffer to store pointer to nonlinear row */
98  BMS_BLKMEM* blkmem, /**< block memory */
99  SCIP_SET* set, /**< global SCIP settings */
100  SCIP_STAT* stat, /**< problem statistics data */
101  SCIP_ROW* row /**< the linear row to copy */
102  );
103 
104 /** output nonlinear row to file stream */
106  SCIP_NLROW* nlrow, /**< NLP row */
107  BMS_BLKMEM* blkmem, /**< block memory */
108  SCIP_SET* set, /**< global SCIP settings */
109  SCIP_STAT* stat, /**< problem statistics data */
110  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
111  FILE* file /**< output file (or NULL for standard output) */
112  );
113 
114 /** increases usage counter of nonlinear row */
115 void SCIPnlrowCapture(
116  SCIP_NLROW* nlrow /**< nonlinear row to capture */
117  );
118 
119 /** decreases usage counter of nonlinear row */
121  SCIP_NLROW** nlrow, /**< nonlinear row to free */
122  BMS_BLKMEM* blkmem, /**< block memory */
123  SCIP_SET* set, /**< global SCIP settings */
124  SCIP_STAT* stat /**< problem statistics data */
125  );
126 
127 /** ensures, that linear coefficient array of nonlinear row can store at least num entries */
129  SCIP_NLROW* nlrow, /**< NLP row */
130  BMS_BLKMEM* blkmem, /**< block memory */
131  SCIP_SET* set, /**< global SCIP settings */
132  int num /**< minimum number of entries to store */
133  );
134 
135 /** adds a previously non existing linear coefficient to a nonlinear row */
137  SCIP_NLROW* nlrow, /**< NLP nonlinear row */
138  BMS_BLKMEM* blkmem, /**< block memory */
139  SCIP_SET* set, /**< global SCIP settings */
140  SCIP_STAT* stat, /**< problem statistics data */
141  SCIP_NLP* nlp, /**< current NLP data */
142  SCIP_VAR* var, /**< variable */
143  SCIP_Real val /**< value of coefficient */
144  );
145 
146 /** deletes linear coefficient from nonlinear row */
148  SCIP_NLROW* nlrow, /**< nonlinear row to be changed */
149  SCIP_SET* set, /**< global SCIP settings */
150  SCIP_STAT* stat, /**< problem statistics data */
151  SCIP_NLP* nlp, /**< current NLP data */
152  SCIP_VAR* var /**< coefficient to be deleted */
153  );
154 
155 /** changes or adds a linear coefficient to a nonlinear row */
157  SCIP_NLROW* nlrow, /**< nonlinear row */
158  BMS_BLKMEM* blkmem, /**< block memory */
159  SCIP_SET* set, /**< global SCIP settings */
160  SCIP_STAT* stat, /**< problem statistics data */
161  SCIP_NLP* nlp, /**< current NLP data */
162  SCIP_VAR* var, /**< variable */
163  SCIP_Real coef /**< new value of coefficient */
164  );
165 
166 /** replaces or deletes an expression in a nonlinear row */
168  SCIP_NLROW* nlrow, /**< nonlinear row */
169  BMS_BLKMEM* blkmem, /**< block memory */
170  SCIP_SET* set, /**< global SCIP settings */
171  SCIP_STAT* stat, /**< problem statistics data */
172  SCIP_NLP* nlp, /**< current NLP data */
173  SCIP_EXPR* expr /**< new expression, or NULL to delete current one */
174  );
175 
176 /** changes constant of nonlinear row */
178  SCIP_NLROW* nlrow, /**< nonlinear row */
179  SCIP_SET* set, /**< global SCIP settings */
180  SCIP_STAT* stat, /**< problem statistics data */
181  SCIP_NLP* nlp, /**< current NLP data */
182  SCIP_Real constant /**< new constant */
183  );
184 
185 /** changes left hand side of nonlinear row */
187  SCIP_NLROW* nlrow, /**< nonlinear row */
188  SCIP_SET* set, /**< global SCIP settings */
189  SCIP_STAT* stat, /**< problem statistics data */
190  SCIP_NLP* nlp, /**< current NLP data */
191  SCIP_Real lhs /**< new left hand side */
192  );
193 
194 /** changes right hand side of nonlinear row */
196  SCIP_NLROW* nlrow, /**< nonlinear row */
197  SCIP_SET* set, /**< global SCIP settings */
198  SCIP_STAT* stat, /**< problem statistics data */
199  SCIP_NLP* nlp, /**< current NLP data */
200  SCIP_Real rhs /**< new right hand side */
201  );
202 
203 /** sets the curvature of a nonlinear row */
205  SCIP_NLP* nlp, /**< NLP */
206  SCIP_SET* set, /**< global SCIP settings */
207  SCIP_NLROW* nlrow, /**< NLP row */
208  SCIP_EXPRCURV curvature /**< curvature of NLP row */
209  );
210 
211 /** removes (or substitutes) all fixed, negated, aggregated, multi-aggregated variables from the linear and nonlinear part of a nonlinear row and simplifies its expression */
213  SCIP_NLROW* nlrow, /**< nonlinear row */
214  BMS_BLKMEM* blkmem, /**< block memory */
215  SCIP_SET* set, /**< global SCIP settings */
216  SCIP_STAT* stat, /**< problem statistics data */
217  SCIP_NLP* nlp /**< current NLP data */
218  );
219 
220 /** recalculates the current activity of a nonlinear row in the current NLP solution */
222  SCIP_NLROW* nlrow, /**< nonlinear row */
223  BMS_BLKMEM* blkmem, /**< block memory */
224  SCIP_SET* set, /**< global SCIP settings */
225  SCIP_STAT* stat, /**< problem statistics data */
226  SCIP_PRIMAL* primal, /**< primal data */
227  SCIP_TREE* tree, /**< branch and bound tree */
228  SCIP_NLP* nlp /**< current NLP data */
229  );
230 
231 /** gives the activity of a nonlinear row in the current NLP solution */
233  SCIP_NLROW* nlrow, /**< nonlinear row */
234  BMS_BLKMEM* blkmem, /**< block memory */
235  SCIP_SET* set, /**< global SCIP settings */
236  SCIP_STAT* stat, /**< problem statistics data */
237  SCIP_PRIMAL* primal, /**< primal data */
238  SCIP_TREE* tree, /**< branch and bound tree */
239  SCIP_NLP* nlp, /**< current NLP data */
240  SCIP_Real* activity /**< buffer to store activity value */
241  );
242 
243 /** gives the feasibility of a nonlinear row in the current NLP solution: negative value means infeasibility */
245  SCIP_NLROW* nlrow, /**< nonlinear row */
246  BMS_BLKMEM* blkmem, /**< block memory */
247  SCIP_SET* set, /**< global SCIP settings */
248  SCIP_STAT* stat, /**< problem statistics data */
249  SCIP_PRIMAL* primal, /**< primal data */
250  SCIP_TREE* tree, /**< branch and bound tree */
251  SCIP_NLP* nlp, /**< current NLP data */
252  SCIP_Real* feasibility /**< buffer to store feasibility value */
253  );
254 
255 /** calculates the current pseudo activity of a nonlinear row */
257  SCIP_NLROW* nlrow, /**< nonlinear row */
258  BMS_BLKMEM* blkmem, /**< block memory */
259  SCIP_SET* set, /**< global SCIP settings */
260  SCIP_STAT* stat, /**< problem statistics data */
261  SCIP_PROB* prob, /**< SCIP problem */
262  SCIP_PRIMAL* primal, /**< primal data */
263  SCIP_TREE* tree, /**< branch and bound tree */
264  SCIP_LP* lp /**< SCIP LP */
265  );
266 
267 /** returns the pseudo activity of a nonlinear row in the current pseudo solution */
269  SCIP_NLROW* nlrow, /**< nonlinear row */
270  BMS_BLKMEM* blkmem, /**< block memory */
271  SCIP_SET* set, /**< global SCIP settings */
272  SCIP_STAT* stat, /**< problem statistics data */
273  SCIP_PROB* prob, /**< SCIP problem */
274  SCIP_PRIMAL* primal, /**< primal data */
275  SCIP_TREE* tree, /**< branch and bound tree */
276  SCIP_LP* lp, /**< SCIP LP */
277  SCIP_Real* pseudoactivity /**< buffer to store pseudo activity value */
278  );
279 
280 /** returns the pseudo feasibility of a nonlinear row in the current pseudo solution: negative value means infeasibility */
282  SCIP_NLROW* nlrow, /**< nonlinear row */
283  BMS_BLKMEM* blkmem, /**< block memory */
284  SCIP_SET* set, /**< global SCIP settings */
285  SCIP_STAT* stat, /**< problem statistics data */
286  SCIP_PROB* prob, /**< SCIP problem */
287  SCIP_PRIMAL* primal, /**< primal data */
288  SCIP_TREE* tree, /**< branch and bound tree */
289  SCIP_LP* lp, /**< SCIP LP */
290  SCIP_Real* pseudofeasibility /**< buffer to store pseudo feasibility value */
291  );
292 
293 /** returns the activity of a nonlinear row for a given solution */
295  SCIP_NLROW* nlrow, /**< nonlinear row */
296  BMS_BLKMEM* blkmem, /**< block memory */
297  SCIP_SET* set, /**< global SCIP settings */
298  SCIP_STAT* stat, /**< problem statistics data */
299  SCIP_SOL* sol, /**< primal CIP solution */
300  SCIP_Real* activity /**< buffer to store activity value */
301  );
302 
303 /** returns the feasibility of a nonlinear row for the given solution */
305  SCIP_NLROW* nlrow, /**< nonlinear row */
306  BMS_BLKMEM* blkmem, /**< block memory */
307  SCIP_SET* set, /**< global SCIP settings */
308  SCIP_STAT* stat, /**< problem statistics data */
309  SCIP_SOL* sol, /**< primal CIP solution */
310  SCIP_Real* feasibility /**< buffer to store feasibility value */
311  );
312 
313 /** returns the minimal activity of a nonlinear row w.r.t. the variables' bounds */
315  SCIP_NLROW* nlrow, /**< nonlinear row */
316  BMS_BLKMEM* blkmem, /**< block memory */
317  SCIP_SET* set, /**< global SCIP settings */
318  SCIP_STAT* stat, /**< problem statistics data */
319  SCIP_Real* minactivity, /**< buffer to store minimal activity, or NULL */
320  SCIP_Real* maxactivity /**< buffer to store maximal activity, or NULL */
321  );
322 
323 /** returns whether the nonlinear row is redundant w.r.t. the variables' bounds */
325  SCIP_NLROW* nlrow, /**< nonlinear row */
326  BMS_BLKMEM* blkmem, /**< block memory */
327  SCIP_SET* set, /**< global SCIP settings */
328  SCIP_STAT* stat, /**< problem statistics data */
329  SCIP_Bool* isredundant /**< buffer to store whether row is redundant */
330  );
331 
332 /**@} */
333 
334 /**@name NLP methods */
335 /**@{ */
336 
337 /** includes event handler that is used by NLP */
339  SCIP_SET* set, /**< global SCIP settings */
340  BMS_BLKMEM* blkmem /**< block memory */
341  );
342 
343 /** construct a new empty NLP */
345  SCIP_NLP** nlp, /**< NLP handler, call by reference */
346  BMS_BLKMEM* blkmem, /**< block memory */
347  SCIP_SET* set, /**< global SCIP settings */
348  SCIP_STAT* stat, /**< problem statistics */
349  const char* name, /**< problem name */
350  int nvars_estimate /**< an estimate on the number of variables that may be added to the NLP later */
351  );
352 
353 /** frees NLP data object */
355  SCIP_NLP** nlp, /**< pointer to NLP data object */
356  BMS_BLKMEM* blkmem, /**< block memory */
357  SCIP_SET* set, /**< global SCIP settings */
358  SCIP_STAT* stat, /**< problem statistics */
359  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
360  SCIP_LP* lp /**< SCIP LP, needed for releasing variables */
361  );
362 
363 /** resets the NLP to the empty NLP by removing all variables and rows from NLP,
364  * releasing all rows, and flushing the changes to the NLP solver
365  */
367  SCIP_NLP* nlp, /**< NLP data */
368  BMS_BLKMEM* blkmem, /**< block memory */
369  SCIP_SET* set, /**< global SCIP settings */
370  SCIP_STAT* stat, /**< problem statistics data */
371  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
372  SCIP_LP* lp /**< SCIP LP, needed for releasing variables */
373  );
374 
375 /** currently a dummy function that always returns TRUE */
377  SCIP_NLP* nlp /**< NLP data */
378  );
379 
380 /** ensures, that variables array of NLP can store at least num entries */
382  SCIP_NLP* nlp, /**< NLP data */
383  BMS_BLKMEM* blkmem, /**< block memory */
384  SCIP_SET* set, /**< global SCIP settings */
385  int num /**< minimum number of entries to store */
386  );
387 
388 /** adds a variable to the NLP and captures the variable */
390  SCIP_NLP* nlp, /**< NLP data */
391  BMS_BLKMEM* blkmem, /**< block memory */
392  SCIP_SET* set, /**< global SCIP settings */
393  SCIP_VAR* var /**< variable */
394  );
395 
396 /** adds a set of variables to the NLP and captures the variables */
398  SCIP_NLP* nlp, /**< NLP data */
399  BMS_BLKMEM* blkmem, /**< block memory */
400  SCIP_SET* set, /**< global SCIP settings */
401  int nvars, /**< number of variables to add */
402  SCIP_VAR** vars /**< variables to add */
403  );
404 
405 /** deletes a variable from the NLP and releases the variable */
407  SCIP_NLP* nlp, /**< NLP data */
408  BMS_BLKMEM* blkmem, /**< block memory */
409  SCIP_SET* set, /**< global SCIP settings */
410  SCIP_STAT* stat, /**< problem statistics data */
411  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
412  SCIP_LP* lp, /**< SCIP LP, needed to release variable */
413  SCIP_VAR* var /**< variable */
414  );
415 
416 /** ensures, that nonlinear rows array of NLP can store at least num entries */
418  SCIP_NLP* nlp, /**< NLP data */
419  BMS_BLKMEM* blkmem, /**< block memory */
420  SCIP_SET* set, /**< global SCIP settings */
421  int num /**< minimum number of entries to store */
422  );
423 
424 /** adds a nonlinear row to the NLP and captures it
425  *
426  * all variables of the row need to be present in the NLP
427  */
429  SCIP_NLP* nlp, /**< NLP data */
430  BMS_BLKMEM* blkmem, /**< block memory */
431  SCIP_SET* set, /**< global SCIP settings */
432  SCIP_STAT* stat, /**< problem statistics data */
433  SCIP_NLROW* nlrow /**< nonlinear row */
434  );
435 
436 /** adds nonlinear rows to the NLP and captures them
437  *
438  * all variables of the row need to be present in the NLP
439  */
441  SCIP_NLP* nlp, /**< NLP data */
442  BMS_BLKMEM* blkmem, /**< block memory */
443  SCIP_SET* set, /**< global SCIP settings */
444  SCIP_STAT* stat, /**< problem statistics data */
445  int nnlrows, /**< number of rows to add */
446  SCIP_NLROW** nlrows /**< rows to add */
447  );
448 
449 /** deletes a nonlinear row from the NLP
450  *
451  * does nothing if nonlinear row is not in NLP
452  */
454  SCIP_NLP* nlp, /**< NLP data */
455  BMS_BLKMEM* blkmem, /**< block memory */
456  SCIP_SET* set, /**< global SCIP settings */
457  SCIP_STAT* stat, /**< problem statistics data */
458  SCIP_NLROW* nlrow /**< nonlinear row */
459  );
460 
461 /** applies all cached changes to the NLP solver */
463  SCIP_NLP* nlp, /**< current NLP data */
464  BMS_BLKMEM* blkmem, /**< block memory */
465  SCIP_SET* set, /**< global SCIP settings */
466  SCIP_STAT* stat /**< problem statistics */
467  );
468 
469 /** solves the NLP or diving NLP */
471  SCIP_NLP* nlp, /**< NLP data */
472  BMS_BLKMEM* blkmem, /**< block memory buffers */
473  SCIP_SET* set, /**< global SCIP settings */
474  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
475  SCIP_STAT* stat, /**< problem statistics */
476  SCIP_PRIMAL* primal, /**< primal data */
477  SCIP_TREE* tree, /**< branch and bound tree */
478  SCIP_NLPPARAM* nlpparam /**< NLP solve parameters */
479  );
480 
481 /** gets objective value of current NLP */
483  SCIP_NLP* nlp /**< current NLP data */
484  );
485 
486 /** gives current pseudo objective value */
488  SCIP_NLP* nlp, /**< current NLP data */
489  BMS_BLKMEM* blkmem, /**< block memory */
490  SCIP_SET* set, /**< global SCIP settings */
491  SCIP_STAT* stat, /**< problem statistics data */
492  SCIP_PROB* prob, /**< SCIP problem */
493  SCIP_PRIMAL* primal, /**< primal data */
494  SCIP_TREE* tree, /**< branch and bound tree */
495  SCIP_LP* lp, /**< SCIP LP */
496  SCIP_Real* pseudoobjval /**< buffer to store pseudo objective value */
497  );
498 
499 /** gets fractional variables of last NLP solution along with solution values and fractionalities
500  */
502  SCIP_NLP* nlp, /**< NLP data structure */
503  BMS_BLKMEM* blkmem, /**< block memory */
504  SCIP_SET* set, /**< global SCIP settings */
505  SCIP_STAT* stat, /**< problem statistics */
506  SCIP_VAR*** fracvars, /**< pointer to store the array of NLP fractional variables, or NULL */
507  SCIP_Real** fracvarssol, /**< pointer to store the array of NLP fractional variables solution values, or NULL */
508  SCIP_Real** fracvarsfrac, /**< pointer to store the array of NLP fractional variables fractionalities, or NULL */
509  int* nfracvars, /**< pointer to store the number of NLP fractional variables , or NULL */
510  int* npriofracvars /**< pointer to store the number of NLP fractional variables with maximal branching priority, or NULL */
511  );
512 
513 /** removes all redundant nonlinear rows */
515  SCIP_NLP* nlp, /**< current NLP data */
516  BMS_BLKMEM* blkmem, /**< block memory buffers */
517  SCIP_SET* set, /**< global SCIP settings */
518  SCIP_STAT* stat /**< problem statistics */
519  );
520 
521 /** set initial guess (approximate primal solution) for next solve
522  *
523  * array initguess must be NULL or have length at least SCIPnlpGetNVars()
524  */
526  SCIP_SET* set, /**< global SCIP settings */
527  SCIP_NLP* nlp, /**< current NLP data */
528  BMS_BLKMEM* blkmem, /**< block memory buffers */
529  SCIP_Real* initguess /**< new initial guess, or NULL to clear previous one */
530  );
531 
532 /** writes NLP to a file */
534  SCIP_NLP* nlp, /**< current NLP data */
535  BMS_BLKMEM* blkmem, /**< block memory buffers */
536  SCIP_SET* set, /**< global SCIP settings */
537  SCIP_STAT* stat, /**< problem statistics */
538  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
539  const char* fname /**< file name */
540  );
541 
542 /*
543  * NLP diving methods
544  */
545 
546 /** signals start of diving */
548  SCIP_NLP* nlp, /**< current NLP data */
549  BMS_BLKMEM* blkmem, /**< block memory buffers */
550  SCIP_SET* set, /**< global SCIP settings */
551  SCIP_STAT* stat /**< problem statistics */
552  );
553 
554 /** resets the bound and objective changes made during diving and disables diving mode */
556  SCIP_NLP* nlp, /**< current NLP data */
557  BMS_BLKMEM* blkmem, /**< block memory buffers */
558  SCIP_SET* set, /**< global SCIP settings */
559  SCIP_STAT* stat /**< problem statistics data */
560  );
561 
562 /** changes coefficient of variable in diving NLP */
564  SCIP_NLP* nlp, /**< current NLP data */
565  BMS_BLKMEM* blkmem, /**< block memory */
566  SCIP_SET* set, /**< global SCIP settings */
567  SCIP_STAT* stat, /**< problem statistics data */
568  SCIP_VAR* var, /**< variable which coefficient to change */
569  SCIP_Real coef /**< new linear coefficient of variable in objective */
570  );
571 
572 /** changes bounds of variable in diving NLP */
574  SCIP_SET* set, /**< global SCIP settings */
575  SCIP_NLP* nlp, /**< current NLP data */
576  SCIP_VAR* var, /**< variable which bounds to change */
577  SCIP_Real lb, /**< new lower bound of variable */
578  SCIP_Real ub /**< new upper bound of variable */
579  );
580 
581 /** changes bounds of a set of variables in diving NLP */
583  SCIP_NLP* nlp, /**< current NLP data */
584  SCIP_SET* set, /**< global SCIP settings */
585  int nvars, /**< number of variables which bounds to change */
586  SCIP_VAR** vars, /**< variables which bounds to change */
587  SCIP_Real* lbs, /**< new lower bounds of variables */
588  SCIP_Real* ubs /**< new upper bounds of variables */
589  );
590 
591 /** returns whether the objective function has been changed during diving */
593  SCIP_NLP* nlp /**< current NLP data */
594  );
595 
596 /** gets array with variables of the NLP */
598  SCIP_NLP* nlp /**< current NLP data */
599  );
600 
601 /** gets current number of variables in NLP */
602 int SCIPnlpGetNVars(
603  SCIP_NLP* nlp /**< current NLP data */
604  );
605 
606 /** computes for each variables the number of NLP rows in which the variable appears in a nonlinear var */
608  SCIP_NLP* nlp, /**< current NLP data */
609  BMS_BLKMEM* blkmem, /**< block memory buffers */
610  SCIP_SET* set, /**< global SCIP settings */
611  SCIP_STAT* stat, /**< problem statistics */
612  int* nlcount /**< an array of length at least SCIPnlpGetNVars() to store nonlinearity counts of variables */
613  );
614 
615 /** indicates whether there exists a row that contains a continuous variable in a nonlinear term
616  *
617  * @note The method may have to touch every row and nonlinear term to compute its result.
618  */
620  SCIP_NLP* nlp, /**< current NLP data */
621  BMS_BLKMEM* blkmem, /**< block memory buffers */
622  SCIP_SET* set, /**< global SCIP settings */
623  SCIP_STAT* stat, /**< problem statistics */
624  SCIP_Bool* result /**< buffer to store whether continuous variable present in an expression of any row */
625  );
626 
627 /** gives dual solution values associated with lower bounds of NLP variables */
629  SCIP_NLP* nlp /**< current NLP data */
630  );
631 
632 /** gives dual solution values associated with upper bounds of NLP variables */
634  SCIP_NLP* nlp /**< current NLP data */
635  );
636 
637 /** gets array with nonlinear rows of the NLP */
639  SCIP_NLP* nlp /**< current NLP data */
640  );
641 
642 /** gets current number of nonlinear rows in NLP */
644  SCIP_NLP* nlp /**< current NLP data */
645  );
646 
647 /** gets statistics on convexity of nonlinear rows in NLP */
649  SCIP_NLP* nlp, /**< current NLP data */
650  int* nlinear, /**< buffer to store number of linear rows in NLP, or NULL */
651  int* nconvexineq, /**< buffer to store number of convex inequalities in NLP, or NULL */
652  int* nnonconvexineq, /**< buffer to store number of nonconvex inequalities in NLP, or NULL */
653  int* nnonlineareq /**< buffer to store number of nonlinear equalities or ranged rows in NLP, or NULL */
654  );
655 
656 /** gets the NLP solver interface */
658  SCIP_NLP* nlp /**< current NLP data */
659  );
660 
661 /** gets the NLP problem in the solver interface */
663  SCIP_NLP* nlp /**< current NLP data */
664  );
665 
666 /** indicates whether NLP is currently in diving mode */
668  SCIP_NLP* nlp /**< current NLP data */
669  );
670 
671 /** gets solution status of current NLP */
673  SCIP_NLP* nlp /**< current NLP data */
674  );
675 
676 /** gets termination status of last NLP solve */
678  SCIP_NLP* nlp /**< current NLP data */
679  );
680 
681 /** gives statistics (number of iterations, solving time, ...) of last NLP solve */
683  SCIP_SET* set, /**< global SCIP settings */
684  SCIP_NLP* nlp, /**< pointer to NLP datastructure */
685  SCIP_NLPSTATISTICS* statistics /**< pointer to store statistics */
686  );
687 
688 /** indicates whether a solution for the current NLP is available
689  *
690  * The solution may be optimal, feasible, or infeasible.
691  * Thus, returns whether the NLP solution status is at most \ref SCIP_NLPSOLSTAT_LOCINFEASIBLE.
692  */
694  SCIP_NLP* nlp /**< current NLP data */
695  );
696 
697 /**@} */
698 
699 #ifdef __cplusplus
700 }
701 #endif
702 
703 #endif /* __SCIP_NLP_H__ */
enum SCIP_NlpTermStat SCIP_NLPTERMSTAT
Definition: type_nlpi.h:194
int SCIPnlpGetNVars(SCIP_NLP *nlp)
Definition: nlp.c:4305
SCIP_RETCODE SCIPnlrowDelLinearCoef(SCIP_NLROW *nlrow, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp, SCIP_VAR *var)
Definition: nlp.c:1272
SCIP_RETCODE SCIPnlpHasContinuousNonlinearity(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_Bool *result)
Definition: nlp.c:4369
SCIP_RETCODE SCIPnlpStartDive(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: nlp.c:4561
type definitions for miscellaneous datastructures
SCIP_RETCODE SCIPnlrowEnsureLinearSize(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, int num)
Definition: nlp.c:1199
SCIP_RETCODE SCIPnlrowIsRedundant(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_Bool *isredundant)
Definition: nlp.c:1815
SCIP_RETCODE SCIPnlpFlush(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: nlp.c:4015
SCIP_NLPTERMSTAT SCIPnlpGetTermstat(SCIP_NLP *nlp)
Definition: nlp.c:4516
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:1609
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
int SCIPnlpGetNNlRows(SCIP_NLP *nlp)
Definition: nlp.c:4442
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 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:1586
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 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_NLPI * SCIPnlpGetNLPI(SCIP_NLP *nlp)
Definition: nlp.c:4476
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
SCIP_RETCODE SCIPnlpEnsureVarsSize(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, int num)
Definition: nlp.c:3775
type definitions for global SCIP settings
SCIP_Bool SCIPnlpIsDiving(SCIP_NLP *nlp)
Definition: nlp.c:4496
SCIP_RETCODE SCIPnlpAddVar(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_VAR *var)
Definition: nlp.c:3809
SCIP_RETCODE SCIPnlpGetPseudoObjval(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LP *lp, SCIP_Real *pseudoobjval)
Definition: nlp.c:4090
SCIP_Real SCIPnlpGetObjval(SCIP_NLP *nlp)
Definition: nlp.c:4080
SCIP_RETCODE SCIPnlpEndDive(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: nlp.c:4592
SCIP_RETCODE SCIPnlpChgVarObjDive(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var, SCIP_Real coef)
Definition: nlp.c:4654
SCIP_RETCODE SCIPnlpReset(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp)
Definition: nlp.c:3724
SCIP_RETCODE SCIPnlpDelNlRow(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLROW *nlrow)
Definition: nlp.c:3983
SCIP_RETCODE SCIPnlpAddVars(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, int nvars, SCIP_VAR **vars)
Definition: nlp.c:3835
SCIP_Real * SCIPnlpGetVarsLbDualsol(SCIP_NLP *nlp)
Definition: nlp.c:4412
SCIP_RETCODE SCIPnlrowChgLhs(SCIP_NLROW *nlrow, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp, SCIP_Real lhs)
Definition: nlp.c:1418
SCIP_NLPIPROBLEM * SCIPnlpGetNLPIProblem(SCIP_NLP *nlp)
Definition: nlp.c:4486
SCIP_RETCODE SCIPnlrowChgRhs(SCIP_NLROW *nlrow, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp, SCIP_Real rhs)
Definition: nlp.c:1444
type definitions for problem statistics
type definitions for LP management
SCIP_RETCODE SCIPnlrowChgConstant(SCIP_NLROW *nlrow, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp, SCIP_Real constant)
Definition: nlp.c:1398
SCIP_RETCODE SCIPnlrowGetActivityBounds(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_Real *minactivity, SCIP_Real *maxactivity)
Definition: nlp.c:1783
SCIP_RETCODE SCIPnlrowCreateCopy(SCIP_NLROW **nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLROW *sourcenlrow)
Definition: nlp.c:994
void SCIPnlrowCapture(SCIP_NLROW *nlrow)
Definition: nlp.c:1142
SCIP_RETCODE SCIPnlpFree(SCIP_NLP **nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp)
Definition: nlp.c:3664
enum SCIP_NlpSolStat SCIP_NLPSOLSTAT
Definition: type_nlpi.h:168
SCIP_RETCODE SCIPnlpChgVarBoundsDive(SCIP_SET *set, SCIP_NLP *nlp, SCIP_VAR *var, SCIP_Real lb, SCIP_Real ub)
Definition: nlp.c:4711
void SCIPnlrowSetCurvature(SCIP_NLP *nlp, SCIP_SET *set, SCIP_NLROW *nlrow, SCIP_EXPRCURV curvature)
Definition: nlp.c:1470
SCIP_RETCODE SCIPnlpWrite(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_MESSAGEHDLR *messagehdlr, const char *fname)
Definition: nlp.c:4240
SCIP_RETCODE SCIPnlpInclude(SCIP_SET *set, BMS_BLKMEM *blkmem)
Definition: nlp.c:3514
SCIP_RETCODE SCIPnlpRemoveRedundantNlRows(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: nlp.c:4158
SCIP_RETCODE SCIPnlpCreate(SCIP_NLP **nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, const char *name, int nvars_estimate)
Definition: nlp.c:3540
type definitions for problem variables
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 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:1656
type definitions for managing events
public methods for NLP management
SCIP_Bool SCIPnlpIsDivingObjChanged(SCIP_NLP *nlp)
Definition: nlp.c:4784
#define SCIP_Bool
Definition: def.h:91
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_EXPRCURV
Definition: type_expr.h:60
SCIP_Real * SCIPnlpGetVarsUbDualsol(SCIP_NLP *nlp)
Definition: nlp.c:4422
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:1687
SCIP_NLROW ** SCIPnlpGetNlRows(SCIP_NLP *nlp)
Definition: nlp.c:4432
void SCIPnlpGetNlRowsStat(SCIP_NLP *nlp, int *nlinear, int *nconvexineq, int *nnonconvexineq, int *nnonlineareq)
Definition: nlp.c:4452
SCIP_RETCODE SCIPnlrowCreateFromRow(SCIP_NLROW **nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_ROW *row)
Definition: nlp.c:1029
type definitions for storing primal CIP solutions
type definitions for storing and manipulating the main problem
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:4053
SCIP_RETCODE SCIPnlpSetInitialGuess(SCIP_SET *set, SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_Real *initguess)
Definition: nlp.c:4204
SCIP_RETCODE SCIPnlpEnsureNlRowsSize(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, int num)
Definition: nlp.c:3897
SCIP_RETCODE SCIPnlpDelVar(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp, SCIP_VAR *var)
Definition: nlp.c:3860
SCIP_RETCODE SCIPnlpChgVarsBoundsDive(SCIP_NLP *nlp, SCIP_SET *set, int nvars, SCIP_VAR **vars, SCIP_Real *lbs, SCIP_Real *ubs)
Definition: nlp.c:4740
#define SCIP_Real
Definition: def.h:173
SCIP_Bool SCIPnlpHasSolution(SCIP_NLP *nlp)
Definition: nlp.c:4547
SCIP_NLPSOLSTAT SCIPnlpGetSolstat(SCIP_NLP *nlp)
Definition: nlp.c:4506
SCIP_RETCODE SCIPnlrowRelease(SCIP_NLROW **nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: nlp.c:1154
SCIP_RETCODE SCIPnlrowGetSolActivity(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_SOL *sol, SCIP_Real *activity)
Definition: nlp.c:1712
SCIP_RETCODE SCIPnlpGetStatistics(SCIP_SET *set, SCIP_NLP *nlp, SCIP_NLPSTATISTICS *statistics)
Definition: nlp.c:4526
type definitions for collecting primal CIP solutions and primal informations
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:437
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:4124
SCIP_RETCODE SCIPnlrowGetSolFeasibility(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_SOL *sol, SCIP_Real *feasibility)
Definition: nlp.c:1761
SCIP_Bool SCIPnlpHasCurrentNodeNLP(SCIP_NLP *nlp)
Definition: nlp.c:3766
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 SCIPnlpGetVarsNonlinearity(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, int *nlcount)
Definition: nlp.c:4315
SCIP_RETCODE SCIPnlpAddNlRows(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, int nnlrows, SCIP_NLROW **nlrows)
Definition: nlp.c:3953
SCIP_RETCODE SCIPnlpAddNlRow(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLROW *nlrow)
Definition: nlp.c:3927
SCIP_RETCODE SCIPnlrowSimplify(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp)
Definition: nlp.c:1489
SCIP_VAR ** SCIPnlpGetVars(SCIP_NLP *nlp)
Definition: nlp.c:4295
memory allocation routines