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   pub_nlp.h
26   	 * @ingroup PUBLICCOREAPI
27   	 * @brief  public 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_PUB_NLP_H__
35   	#define __SCIP_PUB_NLP_H__
36   	
37   	#include <stdio.h>
38   	
39   	#include "scip/def.h"
40   	#include "scip/type_message.h"
41   	#include "blockmemshell/memory.h"
42   	#include "scip/type_set.h"
43   	#include "scip/type_stat.h"
44   	#include "scip/type_nlp.h"
45   	#include "scip/type_var.h"
46   	#include "scip/type_sol.h"
47   	#include "scip/type_expr.h"
48   	#include "scip/type_nlpi.h"
49   	
50   	#ifdef NDEBUG
51   	#include "scip/struct_nlp.h"
52   	#endif
53   	
54   	#ifdef __cplusplus
55   	extern "C" {
56   	#endif
57   	
58   	/**@addtogroup PublicNLRowMethods
59   	 *
60   	 * @{
61   	 */
62   	
63   	/** gets constant */
64   	SCIP_EXPORT
65   	SCIP_Real SCIPnlrowGetConstant(
66   	   SCIP_NLROW*           nlrow               /**< NLP row */
67   	   );
68   	
69   	/** gets number of variables of linear part */
70   	SCIP_EXPORT
71   	int SCIPnlrowGetNLinearVars(
72   	   SCIP_NLROW*           nlrow               /**< NLP row */
73   	   );
74   	
75   	/** gets array with variables of linear part */
76   	SCIP_EXPORT
77   	SCIP_VAR** SCIPnlrowGetLinearVars(
78   	   SCIP_NLROW*           nlrow               /**< NLP row */
79   	   );
80   	
81   	/** gets array with coefficients in linear part */
82   	SCIP_EXPORT
83   	SCIP_Real* SCIPnlrowGetLinearCoefs(
84   	   SCIP_NLROW*           nlrow               /**< NLP row */
85   	   );
86   	
87   	/** gets expression */
88   	SCIP_EXPORT
89   	SCIP_EXPR* SCIPnlrowGetExpr(
90   	   SCIP_NLROW*           nlrow               /**< NLP row */
91   	   );
92   	
93   	/** returns the left hand side of a nonlinear row */
94   	SCIP_EXPORT
95   	SCIP_Real SCIPnlrowGetLhs(
96   	   SCIP_NLROW*           nlrow               /**< NLP row */
97   	   );
98   	
99   	/** returns the right hand side of a nonlinear row */
100  	SCIP_EXPORT
101  	SCIP_Real SCIPnlrowGetRhs(
102  	   SCIP_NLROW*           nlrow               /**< NLP row */
103  	   );
104  	
105  	/** returns the curvature of a nonlinear row */
106  	SCIP_EXPORT
107  	SCIP_EXPRCURV SCIPnlrowGetCurvature(
108  	   SCIP_NLROW*           nlrow               /**< NLP row */
109  	   );
110  	
111  	/** returns the name of a nonlinear row */
112  	SCIP_EXPORT
113  	const char* SCIPnlrowGetName(
114  	   SCIP_NLROW*           nlrow               /**< NLP row */
115  	   );
116  	
117  	/** gets position of a nonlinear row in current NLP, or -1 if not in NLP */
118  	SCIP_EXPORT
119  	int SCIPnlrowGetNLPPos(
120  	   SCIP_NLROW*           nlrow               /**< NLP row */
121  	   );
122  	
123  	/** returns TRUE iff row is member of current NLP */
124  	SCIP_EXPORT
125  	SCIP_Bool SCIPnlrowIsInNLP(
126  	   SCIP_NLROW*           nlrow               /**< NLP row */
127  	   );
128  	
129  	/** gets the dual NLP solution of a nlrow
130  	 *
131  	 * for a ranged constraint, the dual value is positive if the right hand side is active and negative if the left hand side is active
132  	 */
133  	SCIP_EXPORT
134  	SCIP_Real SCIPnlrowGetDualsol(
135  	   SCIP_NLROW*           nlrow               /**< NLP row */
136  	   );
137  	
138  	#ifdef NDEBUG
139  	/* If NDEBUG is defined, the function calls are overwritten by defines to reduce the number of function calls and
140  	 * speed up the algorithms.
141  	 */
142  	#define SCIPnlrowGetConstant(nlrow)    (nlrow)->constant
143  	#define SCIPnlrowGetNLinearVars(nlrow) (nlrow)->nlinvars
144  	#define SCIPnlrowGetLinearVars(nlrow)  (nlrow)->linvars
145  	#define SCIPnlrowGetLinearCoefs(nlrow) (nlrow)->lincoefs
146  	#define SCIPnlrowGetExpr(nlrow)        (nlrow)->expr
147  	#define SCIPnlrowGetLhs(nlrow)         (nlrow)->lhs
148  	#define SCIPnlrowGetRhs(nlrow)         (nlrow)->rhs
149  	#define SCIPnlrowGetCurvature(nlrow)   (nlrow)->curvature
150  	#define SCIPnlrowGetName(nlrow)        (nlrow)->name
151  	#define SCIPnlrowGetNLPPos(nlrow)      (nlrow)->nlpindex
152  	#define SCIPnlrowIsInNLP(nlrow)        ((nlrow)->nlpindex != -1)
153  	#define SCIPnlrowGetDualsol(nlrow)     ((nlrow)->nlpiindex >= 0 ? (nlrow)->dualsol : 0.0)
154  	#endif
155  	
156  	/**@} */
157  	
158  	#ifdef __cplusplus
159  	}
160  	#endif
161  	
162  	#endif /* __SCIP_PUB_NLP_H__ */
163