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-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 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 /** removes (or substitutes) all fixed, negated, aggregated, multi-aggregated variables from the linear and nonlinear part of a nonlinear row and simplifies its expression */
205  SCIP_NLROW* nlrow, /**< nonlinear row */
206  BMS_BLKMEM* blkmem, /**< block memory */
207  SCIP_SET* set, /**< global SCIP settings */
208  SCIP_STAT* stat, /**< problem statistics data */
209  SCIP_NLP* nlp /**< current NLP data */
210  );
211 
212 /** recalculates the current activity of a nonlinear row in the current NLP solution */
214  SCIP_NLROW* nlrow, /**< nonlinear row */
215  BMS_BLKMEM* blkmem, /**< block memory */
216  SCIP_SET* set, /**< global SCIP settings */
217  SCIP_STAT* stat, /**< problem statistics data */
218  SCIP_PRIMAL* primal, /**< primal data */
219  SCIP_TREE* tree, /**< branch and bound tree */
220  SCIP_NLP* nlp /**< current NLP data */
221  );
222 
223 /** gives the activity of a nonlinear row in the current NLP solution */
225  SCIP_NLROW* nlrow, /**< nonlinear row */
226  BMS_BLKMEM* blkmem, /**< block memory */
227  SCIP_SET* set, /**< global SCIP settings */
228  SCIP_STAT* stat, /**< problem statistics data */
229  SCIP_PRIMAL* primal, /**< primal data */
230  SCIP_TREE* tree, /**< branch and bound tree */
231  SCIP_NLP* nlp, /**< current NLP data */
232  SCIP_Real* activity /**< buffer to store activity value */
233  );
234 
235 /** gives the feasibility of a nonlinear row in the current NLP solution: negative value means infeasibility */
237  SCIP_NLROW* nlrow, /**< nonlinear row */
238  BMS_BLKMEM* blkmem, /**< block memory */
239  SCIP_SET* set, /**< global SCIP settings */
240  SCIP_STAT* stat, /**< problem statistics data */
241  SCIP_PRIMAL* primal, /**< primal data */
242  SCIP_TREE* tree, /**< branch and bound tree */
243  SCIP_NLP* nlp, /**< current NLP data */
244  SCIP_Real* feasibility /**< buffer to store feasibility value */
245  );
246 
247 /** calculates the current pseudo activity of a nonlinear row */
249  SCIP_NLROW* nlrow, /**< nonlinear row */
250  BMS_BLKMEM* blkmem, /**< block memory */
251  SCIP_SET* set, /**< global SCIP settings */
252  SCIP_STAT* stat, /**< problem statistics data */
253  SCIP_PROB* prob, /**< SCIP problem */
254  SCIP_PRIMAL* primal, /**< primal data */
255  SCIP_TREE* tree, /**< branch and bound tree */
256  SCIP_LP* lp /**< SCIP LP */
257  );
258 
259 /** returns the pseudo activity of a nonlinear row in the current pseudo solution */
261  SCIP_NLROW* nlrow, /**< nonlinear row */
262  BMS_BLKMEM* blkmem, /**< block memory */
263  SCIP_SET* set, /**< global SCIP settings */
264  SCIP_STAT* stat, /**< problem statistics data */
265  SCIP_PROB* prob, /**< SCIP problem */
266  SCIP_PRIMAL* primal, /**< primal data */
267  SCIP_TREE* tree, /**< branch and bound tree */
268  SCIP_LP* lp, /**< SCIP LP */
269  SCIP_Real* pseudoactivity /**< buffer to store pseudo activity value */
270  );
271 
272 /** returns the pseudo feasibility of a nonlinear row in the current pseudo solution: negative value means infeasibility */
274  SCIP_NLROW* nlrow, /**< nonlinear row */
275  BMS_BLKMEM* blkmem, /**< block memory */
276  SCIP_SET* set, /**< global SCIP settings */
277  SCIP_STAT* stat, /**< problem statistics data */
278  SCIP_PROB* prob, /**< SCIP problem */
279  SCIP_PRIMAL* primal, /**< primal data */
280  SCIP_TREE* tree, /**< branch and bound tree */
281  SCIP_LP* lp, /**< SCIP LP */
282  SCIP_Real* pseudofeasibility /**< buffer to store pseudo feasibility value */
283  );
284 
285 /** returns the activity of a nonlinear row for a given solution */
287  SCIP_NLROW* nlrow, /**< nonlinear row */
288  BMS_BLKMEM* blkmem, /**< block memory */
289  SCIP_SET* set, /**< global SCIP settings */
290  SCIP_STAT* stat, /**< problem statistics data */
291  SCIP_SOL* sol, /**< primal CIP solution */
292  SCIP_Real* activity /**< buffer to store activity value */
293  );
294 
295 /** returns the feasibility of a nonlinear row for the given solution */
297  SCIP_NLROW* nlrow, /**< nonlinear row */
298  BMS_BLKMEM* blkmem, /**< block memory */
299  SCIP_SET* set, /**< global SCIP settings */
300  SCIP_STAT* stat, /**< problem statistics data */
301  SCIP_SOL* sol, /**< primal CIP solution */
302  SCIP_Real* feasibility /**< buffer to store feasibility value */
303  );
304 
305 /** returns the minimal activity of a nonlinear row w.r.t. the variables' bounds */
307  SCIP_NLROW* nlrow, /**< nonlinear row */
308  BMS_BLKMEM* blkmem, /**< block memory */
309  SCIP_SET* set, /**< global SCIP settings */
310  SCIP_STAT* stat, /**< problem statistics data */
311  SCIP_Real* minactivity, /**< buffer to store minimal activity, or NULL */
312  SCIP_Real* maxactivity /**< buffer to store maximal activity, or NULL */
313  );
314 
315 /** returns whether the nonlinear row is redundant w.r.t. the variables' bounds */
317  SCIP_NLROW* nlrow, /**< nonlinear row */
318  BMS_BLKMEM* blkmem, /**< block memory */
319  SCIP_SET* set, /**< global SCIP settings */
320  SCIP_STAT* stat, /**< problem statistics data */
321  SCIP_Bool* isredundant /**< buffer to store whether row is redundant */
322  );
323 
324 /**@} */
325 
326 /**@name NLP methods */
327 /**@{ */
328 
329 /** includes event handler that is used by NLP */
331  SCIP_SET* set, /**< global SCIP settings */
332  BMS_BLKMEM* blkmem /**< block memory */
333  );
334 
335 /** construct a new empty NLP */
337  SCIP_NLP** nlp, /**< NLP handler, call by reference */
338  BMS_BLKMEM* blkmem, /**< block memory */
339  SCIP_SET* set, /**< global SCIP settings */
340  SCIP_STAT* stat, /**< problem statistics */
341  const char* name, /**< problem name */
342  int nvars_estimate /**< an estimate on the number of variables that may be added to the NLP later */
343  );
344 
345 /** frees NLP data object */
347  SCIP_NLP** nlp, /**< pointer to NLP data object */
348  BMS_BLKMEM* blkmem, /**< block memory */
349  SCIP_SET* set, /**< global SCIP settings */
350  SCIP_STAT* stat, /**< problem statistics */
351  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
352  SCIP_LP* lp /**< SCIP LP, needed for releasing variables */
353  );
354 
355 /** resets the NLP to the empty NLP by removing all variables and rows from NLP,
356  * releasing all rows, and flushing the changes to the NLP solver
357  */
359  SCIP_NLP* nlp, /**< NLP data */
360  BMS_BLKMEM* blkmem, /**< block memory */
361  SCIP_SET* set, /**< global SCIP settings */
362  SCIP_STAT* stat, /**< problem statistics data */
363  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
364  SCIP_LP* lp /**< SCIP LP, needed for releasing variables */
365  );
366 
367 /** currently a dummy function that always returns TRUE */
369  SCIP_NLP* nlp /**< NLP data */
370  );
371 
372 /** ensures, that variables array of NLP can store at least num entries */
374  SCIP_NLP* nlp, /**< NLP data */
375  BMS_BLKMEM* blkmem, /**< block memory */
376  SCIP_SET* set, /**< global SCIP settings */
377  int num /**< minimum number of entries to store */
378  );
379 
380 /** adds a variable to the NLP and captures the variable */
382  SCIP_NLP* nlp, /**< NLP data */
383  BMS_BLKMEM* blkmem, /**< block memory */
384  SCIP_SET* set, /**< global SCIP settings */
385  SCIP_VAR* var /**< variable */
386  );
387 
388 /** adds a set of variables to the NLP and captures the variables */
390  SCIP_NLP* nlp, /**< NLP data */
391  BMS_BLKMEM* blkmem, /**< block memory */
392  SCIP_SET* set, /**< global SCIP settings */
393  int nvars, /**< number of variables to add */
394  SCIP_VAR** vars /**< variables to add */
395  );
396 
397 /** deletes a variable from the NLP and releases the variable */
399  SCIP_NLP* nlp, /**< NLP data */
400  BMS_BLKMEM* blkmem, /**< block memory */
401  SCIP_SET* set, /**< global SCIP settings */
402  SCIP_STAT* stat, /**< problem statistics data */
403  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
404  SCIP_LP* lp, /**< SCIP LP, needed to release variable */
405  SCIP_VAR* var /**< variable */
406  );
407 
408 /** ensures, that nonlinear rows array of NLP can store at least num entries */
410  SCIP_NLP* nlp, /**< NLP data */
411  BMS_BLKMEM* blkmem, /**< block memory */
412  SCIP_SET* set, /**< global SCIP settings */
413  int num /**< minimum number of entries to store */
414  );
415 
416 /** adds a nonlinear row to the NLP and captures it
417  *
418  * all variables of the row need to be present in the NLP
419  */
421  SCIP_NLP* nlp, /**< NLP data */
422  BMS_BLKMEM* blkmem, /**< block memory */
423  SCIP_SET* set, /**< global SCIP settings */
424  SCIP_STAT* stat, /**< problem statistics data */
425  SCIP_NLROW* nlrow /**< nonlinear row */
426  );
427 
428 /** adds nonlinear rows to the NLP and captures them
429  *
430  * all variables of the row need to be present in the NLP
431  */
433  SCIP_NLP* nlp, /**< NLP data */
434  BMS_BLKMEM* blkmem, /**< block memory */
435  SCIP_SET* set, /**< global SCIP settings */
436  SCIP_STAT* stat, /**< problem statistics data */
437  int nnlrows, /**< number of rows to add */
438  SCIP_NLROW** nlrows /**< rows to add */
439  );
440 
441 /** deletes a nonlinear row from the NLP
442  *
443  * does nothing if nonlinear row is not in NLP
444  */
446  SCIP_NLP* nlp, /**< NLP data */
447  BMS_BLKMEM* blkmem, /**< block memory */
448  SCIP_SET* set, /**< global SCIP settings */
449  SCIP_STAT* stat, /**< problem statistics data */
450  SCIP_NLROW* nlrow /**< nonlinear row */
451  );
452 
453 /** applies all cached changes to the NLP solver */
455  SCIP_NLP* nlp, /**< current NLP data */
456  BMS_BLKMEM* blkmem, /**< block memory */
457  SCIP_SET* set, /**< global SCIP settings */
458  SCIP_STAT* stat /**< problem statistics */
459  );
460 
461 /** solves the NLP or diving NLP */
463  SCIP_NLP* nlp, /**< NLP data */
464  BMS_BLKMEM* blkmem, /**< block memory buffers */
465  SCIP_SET* set, /**< global SCIP settings */
466  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
467  SCIP_STAT* stat, /**< problem statistics */
468  SCIP_PRIMAL* primal, /**< primal data */
469  SCIP_TREE* tree, /**< branch and bound tree */
470  SCIP_NLPPARAM* nlpparam /**< NLP solve parameters */
471  );
472 
473 /** gets objective value of current NLP */
475  SCIP_NLP* nlp /**< current NLP data */
476  );
477 
478 /** gives current pseudo objective value */
480  SCIP_NLP* nlp, /**< current NLP data */
481  BMS_BLKMEM* blkmem, /**< block memory */
482  SCIP_SET* set, /**< global SCIP settings */
483  SCIP_STAT* stat, /**< problem statistics data */
484  SCIP_PROB* prob, /**< SCIP problem */
485  SCIP_PRIMAL* primal, /**< primal data */
486  SCIP_TREE* tree, /**< branch and bound tree */
487  SCIP_LP* lp, /**< SCIP LP */
488  SCIP_Real* pseudoobjval /**< buffer to store pseudo objective value */
489  );
490 
491 /** gets fractional variables of last NLP solution along with solution values and fractionalities
492  */
494  SCIP_NLP* nlp, /**< NLP data structure */
495  BMS_BLKMEM* blkmem, /**< block memory */
496  SCIP_SET* set, /**< global SCIP settings */
497  SCIP_STAT* stat, /**< problem statistics */
498  SCIP_VAR*** fracvars, /**< pointer to store the array of NLP fractional variables, or NULL */
499  SCIP_Real** fracvarssol, /**< pointer to store the array of NLP fractional variables solution values, or NULL */
500  SCIP_Real** fracvarsfrac, /**< pointer to store the array of NLP fractional variables fractionalities, or NULL */
501  int* nfracvars, /**< pointer to store the number of NLP fractional variables , or NULL */
502  int* npriofracvars /**< pointer to store the number of NLP fractional variables with maximal branching priority, or NULL */
503  );
504 
505 /** removes all redundant nonlinear rows */
507  SCIP_NLP* nlp, /**< current NLP data */
508  BMS_BLKMEM* blkmem, /**< block memory buffers */
509  SCIP_SET* set, /**< global SCIP settings */
510  SCIP_STAT* stat /**< problem statistics */
511  );
512 
513 /** set initial guess (approximate primal solution) for next solve
514  *
515  * array initguess must be NULL or have length at least SCIPnlpGetNVars()
516  */
518  SCIP_SET* set, /**< global SCIP settings */
519  SCIP_NLP* nlp, /**< current NLP data */
520  BMS_BLKMEM* blkmem, /**< block memory buffers */
521  SCIP_Real* initguess /**< new initial guess, or NULL to clear previous one */
522  );
523 
524 /** writes NLP to a file */
526  SCIP_NLP* nlp, /**< current NLP data */
527  BMS_BLKMEM* blkmem, /**< block memory buffers */
528  SCIP_SET* set, /**< global SCIP settings */
529  SCIP_STAT* stat, /**< problem statistics */
530  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
531  const char* fname /**< file name */
532  );
533 
534 /*
535  * NLP diving methods
536  */
537 
538 /** signals start of diving */
540  SCIP_NLP* nlp, /**< current NLP data */
541  BMS_BLKMEM* blkmem, /**< block memory buffers */
542  SCIP_SET* set, /**< global SCIP settings */
543  SCIP_STAT* stat /**< problem statistics */
544  );
545 
546 /** resets the bound and objective changes made during diving and disables diving mode */
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 data */
552  );
553 
554 /** changes coefficient of variable in diving NLP */
556  SCIP_NLP* nlp, /**< current NLP data */
557  BMS_BLKMEM* blkmem, /**< block memory */
558  SCIP_SET* set, /**< global SCIP settings */
559  SCIP_STAT* stat, /**< problem statistics data */
560  SCIP_VAR* var, /**< variable which coefficient to change */
561  SCIP_Real coef /**< new linear coefficient of variable in objective */
562  );
563 
564 /** changes bounds of variable in diving NLP */
566  SCIP_SET* set, /**< global SCIP settings */
567  SCIP_NLP* nlp, /**< current NLP data */
568  SCIP_VAR* var, /**< variable which bounds to change */
569  SCIP_Real lb, /**< new lower bound of variable */
570  SCIP_Real ub /**< new upper bound of variable */
571  );
572 
573 /** changes bounds of a set of variables in diving NLP */
575  SCIP_NLP* nlp, /**< current NLP data */
576  SCIP_SET* set, /**< global SCIP settings */
577  int nvars, /**< number of variables which bounds to change */
578  SCIP_VAR** vars, /**< variables which bounds to change */
579  SCIP_Real* lbs, /**< new lower bounds of variables */
580  SCIP_Real* ubs /**< new upper bounds of variables */
581  );
582 
583 /** returns whether the objective function has been changed during diving */
585  SCIP_NLP* nlp /**< current NLP data */
586  );
587 
588 /** gets array with variables of the NLP */
590  SCIP_NLP* nlp /**< current NLP data */
591  );
592 
593 /** gets current number of variables in NLP */
594 int SCIPnlpGetNVars(
595  SCIP_NLP* nlp /**< current NLP data */
596  );
597 
598 /** computes for each variables the number of NLP rows in which the variable appears in a nonlinear var */
600  SCIP_NLP* nlp, /**< current NLP data */
601  BMS_BLKMEM* blkmem, /**< block memory buffers */
602  SCIP_SET* set, /**< global SCIP settings */
603  SCIP_STAT* stat, /**< problem statistics */
604  int* nlcount /**< an array of length at least SCIPnlpGetNVars() to store nonlinearity counts of variables */
605  );
606 
607 /** indicates whether there exists a row that contains a continuous variable in a nonlinear term
608  *
609  * @note The method may have to touch every row and nonlinear term to compute its result.
610  */
612  SCIP_NLP* nlp, /**< current NLP data */
613  BMS_BLKMEM* blkmem, /**< block memory buffers */
614  SCIP_SET* set, /**< global SCIP settings */
615  SCIP_STAT* stat, /**< problem statistics */
616  SCIP_Bool* result /**< buffer to store whether continuous variable present in an expression of any row */
617  );
618 
619 /** gives dual solution values associated with lower bounds of NLP variables */
621  SCIP_NLP* nlp /**< current NLP data */
622  );
623 
624 /** gives dual solution values associated with upper bounds of NLP variables */
626  SCIP_NLP* nlp /**< current NLP data */
627  );
628 
629 /** gets array with nonlinear rows of the NLP */
631  SCIP_NLP* nlp /**< current NLP data */
632  );
633 
634 /** gets current number of nonlinear rows in NLP */
636  SCIP_NLP* nlp /**< current NLP data */
637  );
638 
639 /** gets the NLP solver interface */
641  SCIP_NLP* nlp /**< current NLP data */
642  );
643 
644 /** gets the NLP problem in the solver interface */
646  SCIP_NLP* nlp /**< current NLP data */
647  );
648 
649 /** indicates whether NLP is currently in diving mode */
651  SCIP_NLP* nlp /**< current NLP data */
652  );
653 
654 /** gets solution status of current NLP */
656  SCIP_NLP* nlp /**< current NLP data */
657  );
658 
659 /** gets termination status of last NLP solve */
661  SCIP_NLP* nlp /**< current NLP data */
662  );
663 
664 /** gives statistics (number of iterations, solving time, ...) of last NLP solve */
666  SCIP_SET* set, /**< global SCIP settings */
667  SCIP_NLP* nlp, /**< pointer to NLP datastructure */
668  SCIP_NLPSTATISTICS* statistics /**< pointer to store statistics */
669  );
670 
671 /** indicates whether a solution for the current NLP is available
672  *
673  * The solution may be optimal, feasible, or infeasible.
674  * Thus, returns whether the NLP solution status is at most \ref SCIP_NLPSOLSTAT_LOCINFEASIBLE.
675  */
677  SCIP_NLP* nlp /**< current NLP data */
678  );
679 
680 /**@} */
681 
682 #ifdef __cplusplus
683 }
684 #endif
685 
686 #endif /* __SCIP_NLP_H__ */
enum SCIP_NlpTermStat SCIP_NLPTERMSTAT
Definition: type_nlpi.h:194
int SCIPnlpGetNVars(SCIP_NLP *nlp)
Definition: nlp.c:4212
SCIP_RETCODE SCIPnlrowDelLinearCoef(SCIP_NLROW *nlrow, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp, SCIP_VAR *var)
Definition: nlp.c:1216
SCIP_RETCODE SCIPnlpHasContinuousNonlinearity(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_Bool *result)
Definition: nlp.c:4276
SCIP_RETCODE SCIPnlpStartDive(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: nlp.c:4444
type definitions for miscellaneous datastructures
SCIP_RETCODE SCIPnlrowEnsureLinearSize(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, int num)
Definition: nlp.c:1143
SCIP_RETCODE SCIPnlrowIsRedundant(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_Bool *isredundant)
Definition: nlp.c:1720
SCIP_RETCODE SCIPnlpFlush(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: nlp.c:3922
SCIP_NLPTERMSTAT SCIPnlpGetTermstat(SCIP_NLP *nlp)
Definition: nlp.c:4399
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 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
int SCIPnlpGetNNlRows(SCIP_NLP *nlp)
Definition: nlp.c:4349
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 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 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 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_NLPI * SCIPnlpGetNLPI(SCIP_NLP *nlp)
Definition: nlp.c:4359
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:3682
type definitions for global SCIP settings
SCIP_Bool SCIPnlpIsDiving(SCIP_NLP *nlp)
Definition: nlp.c:4379
SCIP_RETCODE SCIPnlpAddVar(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_VAR *var)
Definition: nlp.c:3716
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:3997
SCIP_Real SCIPnlpGetObjval(SCIP_NLP *nlp)
Definition: nlp.c:3987
SCIP_RETCODE SCIPnlpEndDive(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: nlp.c:4475
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_RETCODE SCIPnlpReset(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp)
Definition: nlp.c:3631
SCIP_RETCODE SCIPnlpDelNlRow(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLROW *nlrow)
Definition: nlp.c:3890
SCIP_RETCODE SCIPnlpAddVars(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, int nvars, SCIP_VAR **vars)
Definition: nlp.c:3742
SCIP_Real * SCIPnlpGetVarsLbDualsol(SCIP_NLP *nlp)
Definition: nlp.c:4319
SCIP_RETCODE SCIPnlrowChgLhs(SCIP_NLROW *nlrow, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp, SCIP_Real lhs)
Definition: nlp.c:1354
SCIP_NLPIPROBLEM * SCIPnlpGetNLPIProblem(SCIP_NLP *nlp)
Definition: nlp.c:4369
SCIP_RETCODE SCIPnlrowChgRhs(SCIP_NLROW *nlrow, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp, SCIP_Real rhs)
Definition: nlp.c:1374
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:1334
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 SCIPnlrowCreateCopy(SCIP_NLROW **nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLROW *sourcenlrow)
Definition: nlp.c:941
void SCIPnlrowCapture(SCIP_NLROW *nlrow)
Definition: nlp.c:1086
SCIP_RETCODE SCIPnlpFree(SCIP_NLP **nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp)
Definition: nlp.c:3571
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:4594
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 SCIPnlpInclude(SCIP_SET *set, BMS_BLKMEM *blkmem)
Definition: nlp.c:3425
SCIP_RETCODE SCIPnlpRemoveRedundantNlRows(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: nlp.c:4065
SCIP_RETCODE SCIPnlpCreate(SCIP_NLP **nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, const char *name, int nvars_estimate)
Definition: nlp.c:3451
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:1249
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
type definitions for managing events
public methods for NLP management
SCIP_Bool SCIPnlpIsDivingObjChanged(SCIP_NLP *nlp)
Definition: nlp.c:4667
#define SCIP_Bool
Definition: def.h:93
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_EXPRCURV
Definition: type_expr.h:57
SCIP_Real * SCIPnlpGetVarsUbDualsol(SCIP_NLP *nlp)
Definition: nlp.c:4329
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_NLROW ** SCIPnlpGetNlRows(SCIP_NLP *nlp)
Definition: nlp.c:4339
SCIP_RETCODE SCIPnlrowCreateFromRow(SCIP_NLROW **nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_ROW *row)
Definition: nlp.c:976
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:3960
SCIP_RETCODE SCIPnlpSetInitialGuess(SCIP_SET *set, SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_Real *initguess)
Definition: nlp.c:4111
SCIP_RETCODE SCIPnlpEnsureNlRowsSize(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, int num)
Definition: nlp.c:3804
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:3767
SCIP_RETCODE SCIPnlpChgVarsBoundsDive(SCIP_NLP *nlp, SCIP_SET *set, int nvars, SCIP_VAR **vars, SCIP_Real *lbs, SCIP_Real *ubs)
Definition: nlp.c:4623
#define SCIP_Real
Definition: def.h:186
SCIP_Bool SCIPnlpHasSolution(SCIP_NLP *nlp)
Definition: nlp.c:4430
SCIP_NLPSOLSTAT SCIPnlpGetSolstat(SCIP_NLP *nlp)
Definition: nlp.c:4389
SCIP_RETCODE SCIPnlrowRelease(SCIP_NLROW **nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: nlp.c:1098
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 SCIPnlpGetStatistics(SCIP_SET *set, SCIP_NLP *nlp, SCIP_NLPSTATISTICS *statistics)
Definition: nlp.c:4409
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:439
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 SCIPnlrowGetSolFeasibility(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_SOL *sol, SCIP_Real *feasibility)
Definition: nlp.c:1666
SCIP_Bool SCIPnlpHasCurrentNodeNLP(SCIP_NLP *nlp)
Definition: nlp.c:3673
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 SCIPnlpGetVarsNonlinearity(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, int *nlcount)
Definition: nlp.c:4222
SCIP_RETCODE SCIPnlpAddNlRows(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, int nnlrows, SCIP_NLROW **nlrows)
Definition: nlp.c:3860
SCIP_RETCODE SCIPnlpAddNlRow(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLROW *nlrow)
Definition: nlp.c:3834
SCIP_RETCODE SCIPnlrowSimplify(SCIP_NLROW *nlrow, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_NLP *nlp)
Definition: nlp.c:1394
SCIP_VAR ** SCIPnlpGetVars(SCIP_NLP *nlp)
Definition: nlp.c:4202
memory allocation routines