/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* This file is part of the program and library */ /* SCIP --- Solving Constraint Integer Programs */ /* */ /* Copyright 2002-2022 Zuse Institute Berlin */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ /* You may obtain a copy of the License at */ /* */ /* http://www.apache.org/licenses/LICENSE-2.0 */ /* */ /* Unless required by applicable law or agreed to in writing, software */ /* distributed under the License is distributed on an "AS IS" BASIS, */ /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ /* See the License for the specific language governing permissions and */ /* limitations under the License. */ /* */ /* You should have received a copy of the Apache-2.0 license */ /* along with SCIP; see the file LICENSE. If not visit scipopt.org. */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /**@file scip_nlp.h * @ingroup PUBLICCOREAPI * @brief public methods for nonlinear relaxation * @author Thorsten Gellermann * @author Stefan Vigerske */ /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ #ifndef __SCIP_SCIP_NLP_H__ #define __SCIP_SCIP_NLP_H__ #include "scip/def.h" #include "scip/type_lp.h" #include "scip/type_nlp.h" #include "scip/type_nlpi.h" #include "scip/type_retcode.h" #include "scip/type_scip.h" #include "scip/type_sol.h" #include "scip/type_var.h" #include "scip/type_expr.h" #include "scip/pub_nlp.h" #ifdef __cplusplus extern "C" { #endif /**@addtogroup PublicNLPMethods * * @{ */ /** returns whether the NLP relaxation has been enabled * * If the NLP relaxation is enabled, then SCIP will construct the NLP relaxation when the solving process is about to begin. * To check whether an NLP is existing, use SCIPisNLPConstructed(). * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITPRESOLVE * - \ref SCIP_STAGE_PRESOLVING * - \ref SCIP_STAGE_EXITPRESOLVE * - \ref SCIP_STAGE_PRESOLVED * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING * * @see SCIPenableNLP */ SCIP_EXPORT SCIP_Bool SCIPisNLPEnabled( SCIP* scip /**< SCIP data structure */ ); /** notifies SCIP that the NLP relaxation should be initialized in INITSOLVE * * This method is typically called by a constraint handler that handles constraints that have a nonlinear representation as nonlinear rows, e.g., cons_nonlinear. * * The function should be called before the branch-and-bound process is initialized, e.g., when presolve is exiting. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITPRESOLVE * - \ref SCIP_STAGE_PRESOLVING * - \ref SCIP_STAGE_EXITPRESOLVE * - \ref SCIP_STAGE_PRESOLVED */ SCIP_EXPORT void SCIPenableNLP( SCIP* scip /**< SCIP data structure */ ); /** returns, whether an NLP has been constructed * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_Bool SCIPisNLPConstructed( SCIP* scip /**< SCIP data structure */ ); /** checks whether the NLP has a continuous variable in a nonlinear term * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPhasNLPContinuousNonlinearity( SCIP* scip, /**< SCIP data structure */ SCIP_Bool* result /**< buffer to store result */ ); /** gets current NLP variables along with the current number of NLP variables * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPgetNLPVarsData( SCIP* scip, /**< SCIP data structure */ SCIP_VAR*** vars, /**< pointer to store the array of NLP variables, or NULL */ int* nvars /**< pointer to store the number of NLP variables, or NULL */ ); /** gets array with variables of the NLP * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_VAR** SCIPgetNLPVars( SCIP* scip /**< SCIP data structure */ ); /** gets current number of variables in NLP * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT int SCIPgetNNLPVars( SCIP* scip /**< SCIP data structure */ ); /** computes for each variables the number of NLP rows in which the variable appears in the nonlinear part * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPgetNLPVarsNonlinearity( SCIP* scip, /**< SCIP data structure */ int* nlcount /**< an array of length at least SCIPnlpGetNVars() to store nonlinearity counts of variables */ ); /** returns dual solution values associated with lower bounds of NLP variables * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_Real* SCIPgetNLPVarsLbDualsol( SCIP* scip /**< SCIP data structure */ ); /** returns dual solution values associated with upper bounds of NLP variables * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_Real* SCIPgetNLPVarsUbDualsol( SCIP* scip /**< SCIP data structure */ ); /** gets current NLP nonlinear rows along with the current number of NLP nonlinear rows * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPgetNLPNlRowsData( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW*** nlrows, /**< pointer to store the array of NLP nonlinear rows, or NULL */ int* nnlrows /**< pointer to store the number of NLP nonlinear rows, or NULL */ ); /** gets array with nonlinear rows of the NLP * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_NLROW** SCIPgetNLPNlRows( SCIP* scip /**< SCIP data structure */ ); /** gets current number of nonlinear rows in NLP * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT int SCIPgetNNLPNlRows( SCIP* scip /**< SCIP data structure */ ); /** adds a nonlinear row to the NLP. This row is captured by the NLP. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPaddNlRow( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow /**< nonlinear row to add to NLP */ ); /** removes a nonlinear row from the NLP * * This row is released in the NLP. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING * - \ref SCIP_STAGE_SOLVED * - \ref SCIP_STAGE_EXITSOLVE */ SCIP_EXPORT SCIP_RETCODE SCIPdelNlRow( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow /**< nonlinear row to add to NLP */ ); /** makes sure that the NLP of the current node is flushed * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPflushNLP( SCIP* scip /**< SCIP data structure */ ); /** sets or clears initial primal guess for NLP solution (start point for NLP solver) * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPsetNLPInitialGuess( SCIP* scip, /**< SCIP data structure */ SCIP_Real* initialguess /**< values of initial guess (corresponding to variables from SCIPgetNLPVarsData), or NULL to use no start point */ ); /** sets initial primal guess for NLP solution (start point for NLP solver) * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPsetNLPInitialGuessSol( SCIP* scip, /**< SCIP data structure */ SCIP_SOL* sol /**< solution which values should be taken as initial guess, or NULL for LP solution */ ); /** solves the current NLP (or diving NLP if in diving mode) with given parameters * * Typical use is * * SCIP_NLPPARAM nlparam = { SCIP_NLPPARAM_DEFAULT(scip); } * nlpparam.iterlimit = 42; * SCIP_CALL( SCIPsolveNLPParam(scip, nlpparam) ); * * or, in one line: * * SCIP_CALL( SCIPsolveNLPParam(scip, (SCIP_NLPPARAM){ SCIP_NLPPARAM_DEFAULT(scip), .iterlimit = 42 }) ); * * To get the latter, also \ref SCIPsolveNLP can be used. * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPsolveNLPParam( SCIP* scip, /**< SCIP data structure */ SCIP_NLPPARAM param /**< NLP solve parameters */ ); /** solves the current NLP (or diving NLP if in diving mode) with non-default parameters given as optional arguments * * Typical use is * * SCIP_CALL( SCIPsolveNLP(scip) ); * * to solve with default parameters. * Additionally, one or several values of SCIP_NLPPARAM can be set: * * SCIP_CALL( SCIPsolveNLP(scip, .iterlimit = 42, .verblevel = 1) ); //lint !e666 * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ /* the scip argument has been made part of the variadic arguments, since ISO C99 requires at least one argument for the "..." part and we want to allow leaving all parameters at default * for the same reason, we have the .caller argument, so that macro SCIP_VARARGS_REST will have at least one arg to return */ #if !defined(_MSC_VER) || _MSC_VER >= 1800 #define SCIPsolveNLP(...) \ SCIPsolveNLPParam(SCIP_VARARGS_FIRST((__VA_ARGS__, ignored)), \ (SCIP_NLPPARAM){ SCIP_NLPPARAM_DEFAULT_INITS(SCIP_VARARGS_FIRST((__VA_ARGS__, ignored))), SCIP_VARARGS_REST(__VA_ARGS__, .caller = __FILE__) }) #else /* very old MSVC doesn't support C99's designated initializers, so have a version of SCIPsolveNLP() that just ignores given parameters * (compilation of scip_nlp.c will print a warning) */ #define SCIPsolveNLP(...) \ SCIPsolveNLPParam(SCIP_VARARGS_FIRST((__VA_ARGS__, ignored)), SCIP_NLPPARAM_DEFAULT_STATIC) #endif /** gets solution status of current NLP * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_NLPSOLSTAT SCIPgetNLPSolstat( SCIP* scip /**< SCIP data structure */ ); /** gets termination status of last NLP solve * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_NLPTERMSTAT SCIPgetNLPTermstat( SCIP* scip /**< SCIP data structure */ ); /** gives statistics (number of iterations, solving time, ...) of last NLP solve * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPgetNLPStatistics( SCIP* scip, /**< SCIP data structure */ SCIP_NLPSTATISTICS* statistics /**< pointer to store statistics */ ); /** gets objective value of current NLP * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_Real SCIPgetNLPObjval( SCIP* scip /**< SCIP data structure */ ); /** indicates whether a solution for the current NLP is available * * The solution may be optimal, feasible, or infeasible. * Thus, returns whether the NLP solution status is at most \ref SCIP_NLPSOLSTAT_LOCINFEASIBLE. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_Bool SCIPhasNLPSolution( SCIP* scip /**< SCIP data structure */ ); /** gets fractional variables of last NLP solution along with solution values and fractionalities * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPgetNLPFracVars( SCIP* scip, /**< SCIP data structure */ SCIP_VAR*** fracvars, /**< pointer to store the array of NLP fractional variables, or NULL */ SCIP_Real** fracvarssol, /**< pointer to store the array of NLP fractional variables solution values, or NULL */ SCIP_Real** fracvarsfrac, /**< pointer to store the array of NLP fractional variables fractionalities, or NULL */ int* nfracvars, /**< pointer to store the number of NLP fractional variables , or NULL */ int* npriofracvars /**< pointer to store the number of NLP fractional variables with maximal branching priority, or NULL */ ); /** writes current NLP to a file * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPwriteNLP( SCIP* scip, /**< SCIP data structure */ const char* filename /**< file name */ ); /** gets the NLP interface and problem used by the SCIP NLP * * @warning With the NLPI and its problem, all methods defined in \ref scip_nlpi.h and \ref pub_nlpi.h can be used. * It needs to be ensured that the full internal state of the NLPI does not change or is recovered completely * after the end of the method that uses the NLPI. In particular, if the NLP or its solution is manipulated * (e.g. by calling one of the SCIPaddNlpi...() or the SCIPsolveNlpi() method), one has to check in advance * whether the NLP is currently solved. If this is the case, one has to make sure that the internal solution * status is recovered completely again. Additionally one has to resolve the NLP with * SCIPsolveNlpi() in order to reinstall the internal solution status. * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPgetNLPI( SCIP* scip, /**< SCIP data structure */ SCIP_NLPI** nlpi, /**< pointer to store the NLP solver interface */ SCIP_NLPIPROBLEM** nlpiproblem /**< pointer to store the NLP solver interface problem */ ); /**@} */ /**@addtogroup PublicNLPDiveMethods * * @{ */ /** initiates NLP diving * * Makes functions SCIPchgVarObjDiveNLP(), SCIPchgVarBoundsDiveNLP() and SCIPchgVarsBoundsDiveNLP() available. * Further, SCIPsolveNLP() can be used to solve the diving NLP. * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPstartDiveNLP( SCIP* scip /**< SCIP data structure */ ); /** ends NLP diving * * Resets changes made by SCIPchgVarObjDiveNLP(), SCIPchgVarBoundsDiveNLP(), and SCIPchgVarsBoundsDiveNLP(). * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPendDiveNLP( SCIP* scip /**< SCIP data structure */ ); /** changes linear objective coefficient of a variable in diving NLP * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPchgVarObjDiveNLP( SCIP* scip, /**< SCIP data structure */ SCIP_VAR* var, /**< variable which coefficient to change */ SCIP_Real coef /**< new value for coefficient */ ); /** changes bounds of a variable in diving NLP * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPchgVarBoundsDiveNLP( SCIP* scip, /**< SCIP data structure */ SCIP_VAR* var, /**< variable which bounds to change */ SCIP_Real lb, /**< new lower bound */ SCIP_Real ub /**< new upper bound */ ); /** changes bounds of a set of variables in diving NLP * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPchgVarsBoundsDiveNLP( SCIP* scip, /**< SCIP data structure */ int nvars, /**< number of variables which bounds to changes */ SCIP_VAR** vars, /**< variables which bounds to change */ SCIP_Real* lbs, /**< new lower bounds */ SCIP_Real* ubs /**< new upper bounds */ ); /**@} */ /**@addtogroup PublicNLRowMethods * * @{ */ /** creates and captures a nonlinear row * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_PRESOLVED * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPcreateNlRow( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW** nlrow, /**< buffer to store pointer to nonlinear row */ const char* name, /**< name of nonlinear row */ SCIP_Real constant, /**< constant */ int nlinvars, /**< number of linear variables */ SCIP_VAR** linvars, /**< linear variables, or NULL if nlinvars == 0 */ SCIP_Real* lincoefs, /**< linear coefficients, or NULL if nlinvars == 0 */ SCIP_EXPR* expr, /**< nonlinear expression, or NULL */ SCIP_Real lhs, /**< left hand side */ SCIP_Real rhs, /**< right hand side */ SCIP_EXPRCURV curvature /**< curvature of the nonlinear row */ ); /** creates and captures a nonlinear row without any coefficients * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_PRESOLVED * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPcreateEmptyNlRow( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW** nlrow, /**< pointer to nonlinear row */ const char* name, /**< name of nonlinear row */ SCIP_Real lhs, /**< left hand side */ SCIP_Real rhs /**< right hand side */ ); /** creates and captures a nonlinear row from a linear row * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_PRESOLVED * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPcreateNlRowFromRow( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW** nlrow, /**< pointer to nonlinear row */ SCIP_ROW* row /**< the linear row to copy */ ); /** increases usage counter of a nonlinear row * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_PRESOLVED * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPcaptureNlRow( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow /**< nonlinear row to capture */ ); /** decreases usage counter of a nonlinear row, and frees memory if necessary * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_PRESOLVED * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING * - \ref SCIP_STAGE_EXITSOLVE */ SCIP_EXPORT SCIP_RETCODE SCIPreleaseNlRow( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW** nlrow /**< pointer to nonlinear row */ ); /** changes left hand side of a nonlinear row * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_PRESOLVED * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPchgNlRowLhs( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP nonlinear row */ SCIP_Real lhs /**< new left hand side */ ); /** changes right hand side of a nonlinear row * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_PRESOLVED * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPchgNlRowRhs( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP nonlinear row */ SCIP_Real rhs /**< new right hand side */ ); /** changes constant of a nonlinear row * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_PRESOLVED * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPchgNlRowConstant( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP row */ SCIP_Real constant /**< new value for constant */ ); /** adds variable with a linear coefficient to a nonlinear row * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_PRESOLVED * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPaddLinearCoefToNlRow( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP row */ SCIP_VAR* var, /**< problem variable */ SCIP_Real val /**< value of coefficient in linear part of row */ ); /** adds variables with linear coefficients to a row * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_PRESOLVED * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPaddLinearCoefsToNlRow( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP row */ int nvars, /**< number of variables to add to the row */ SCIP_VAR** vars, /**< problem variables to add */ SCIP_Real* vals /**< values of coefficients in linear part of row */ ); /** changes linear coefficient of a variables in a nonlinear row * * Setting the coefficient to 0.0 means that it is removed from the row. * The variable does not need to exists before. * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_PRESOLVED * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPchgNlRowLinearCoef( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP row */ SCIP_VAR* var, /**< variable */ SCIP_Real coef /**< new value of coefficient */ ); /** sets or deletes expression in a nonlinear row * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_PRESOLVED * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPsetNlRowExpr( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP row */ SCIP_EXPR* expr /**< expression, or NULL */ ); /** recalculates the activity of a nonlinear row in the last NLP solution * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_PRESOLVED * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPrecalcNlRowNLPActivity( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow /**< NLP nonlinear row */ ); /** returns the activity of a nonlinear row in the last NLP solution * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPgetNlRowNLPActivity( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP nonlinear row */ SCIP_Real* activity /**< pointer to store activity value */ ); /** gives the feasibility of a nonlinear row in the last NLP solution: negative value means infeasibility * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPgetNlRowNLPFeasibility( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP nonlinear row */ SCIP_Real* feasibility /**< pointer to store feasibility value */ ); /** recalculates the activity of a nonlinear row for the current pseudo solution * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPrecalcNlRowPseudoActivity( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow /**< NLP nonlinear row */ ); /** gives the activity of a nonlinear row for the current pseudo solution * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPgetNlRowPseudoActivity( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP nonlinear row */ SCIP_Real* pseudoactivity /**< pointer to store pseudo activity value */ ); /** gives the feasibility of a nonlinear row for the current pseudo solution: negative value means infeasibility * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPgetNlRowPseudoFeasibility( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP nonlinear row */ SCIP_Real* pseudofeasibility /**< pointer to store pseudo feasibility value */ ); /** recalculates the activity of a nonlinear row in the last NLP or pseudo solution * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPrecalcNlRowActivity( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow /**< NLP nonlinear row */ ); /** gives the activity of a nonlinear row in the last NLP or pseudo solution * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPgetNlRowActivity( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP nonlinear row */ SCIP_Real* activity /**< pointer to store activity value */ ); /** gives the feasibility of a nonlinear row in the last NLP or pseudo solution * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPgetNlRowFeasibility( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP nonlinear row */ SCIP_Real* feasibility /**< pointer to store feasibility value */ ); /** gives the activity of a nonlinear row for the given primal solution or NLP solution or pseudo solution * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPgetNlRowSolActivity( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP nonlinear row */ SCIP_SOL* sol, /**< primal CIP solution, or NULL for NLP solution of pseudo solution */ SCIP_Real* activity /**< pointer to store activity value */ ); /** gives the feasibility of a nonlinear row for the given primal solution * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPgetNlRowSolFeasibility( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP nonlinear row */ SCIP_SOL* sol, /**< primal CIP solution */ SCIP_Real* feasibility /**< pointer to store feasibility value */ ); /** gives the minimal and maximal activity of a nonlinear row w.r.t. the variable's bounds * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_PRESOLVED * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPgetNlRowActivityBounds( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP row */ SCIP_Real* minactivity, /**< buffer to store minimal activity, or NULL */ SCIP_Real* maxactivity /**< buffer to store maximal activity, or NULL */ ); /** prints a nonlinear row to file stream * * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. * * @pre This method can be called if SCIP is in one of the following stages: * - \ref SCIP_STAGE_PRESOLVED * - \ref SCIP_STAGE_INITSOLVE * - \ref SCIP_STAGE_SOLVING */ SCIP_EXPORT SCIP_RETCODE SCIPprintNlRow( SCIP* scip, /**< SCIP data structure */ SCIP_NLROW* nlrow, /**< NLP row */ FILE* file /**< output file (or NULL for standard output) */ ); /**@} */ #ifdef __cplusplus } #endif #endif