Detailed Description
AMPL .nl file reader and writer.
For documentation on ampl::mp, see https://ampl.github.io and https://www.zverovich.net/2014/09/19/reading-nl-files.html. For documentation on .nl files, see https://ampl.com/REFS/hooking2.pdf.
TODO:
- writing of logical constraints (and, or, xor)
- writing of SOS constraints (into suffixes)
Definition in file reader_nl.cpp.
#include <string>#include <sstream>#include <vector>#include <map>#include <cstdlib>#include <unistd.h>#include "scip/reader_nl.h"#include "scip/cons_linear.h"#include "scip/cons_setppc.h"#include "scip/cons_logicor.h"#include "scip/cons_knapsack.h"#include "scip/cons_varbound.h"#include "scip/cons_nonlinear.h"#include "scip/cons_sos1.h"#include "scip/cons_sos2.h"#include "scip/cons_and.h"#include "scip/cons_or.h"#include "scip/cons_xor.h"#include "scip/expr_var.h"#include "scip/expr_value.h"#include "scip/expr_sum.h"#include "scip/expr_product.h"#include "scip/expr_pow.h"#include "scip/expr_log.h"#include "scip/expr_exp.h"#include "scip/expr_trig.h"#include "scip/expr_abs.h"#include "mp/nl-reader.h"#include "mp/nl-writer2.hpp"#include "mp/nl-opcodes.h"Go to the source code of this file.
Data Structures | |
| class | AMPLProblemHandler |
| implementation of AMPL/MPs NLHandler that constructs a SCIP problem while a .nl file is read More... | |
| class | AMPLProblemHandler::NumericArgHandler |
| class | AMPLProblemHandler::LinearExprHandler |
| class | AMPLProblemHandler::SuffixHandler< T > |
| class | AMPLProblemHandler::LinearPartHandler |
| class | SCIPNLFeeder |
Macros | |
| #define | READER_NAME "nlreader" |
| #define | READER_DESC "AMPL .nl file reader" |
| #define | READER_EXTENSION "nl" |
| #define | SCIP_CALL_THROW(x) |
| #define | PATHSEP "/" |
Typedefs | |
| typedef struct SCIP_ProbNlData | SCIP_PROBNLDATA |
Functions | |
| static | SCIP_DECL_PROBDELORIG (probdataDelOrigNl) |
| static | SCIP_DECL_READERCOPY (readerCopyNl) |
| static | SCIP_DECL_READERREAD (readerReadNl) |
| static | SCIP_DECL_READERWRITE (readerWriteNl) |
| SCIP_RETCODE | SCIPincludeReaderNl (SCIP *scip) |
| SCIP_RETCODE | SCIPwriteSolutionNl (SCIP *scip) |
Macro Definition Documentation
◆ READER_NAME
| #define READER_NAME "nlreader" |
Definition at line 95 of file reader_nl.cpp.
◆ READER_DESC
| #define READER_DESC "AMPL .nl file reader" |
Definition at line 96 of file reader_nl.cpp.
◆ READER_EXTENSION
| #define READER_EXTENSION "nl" |
Definition at line 97 of file reader_nl.cpp.
◆ SCIP_CALL_THROW
| #define SCIP_CALL_THROW | ( | x | ) |
Definition at line 101 of file reader_nl.cpp.
◆ PATHSEP
| #define PATHSEP "/" |
Definition at line 2974 of file reader_nl.cpp.
Typedef Documentation
◆ SCIP_PROBNLDATA
| typedef struct SCIP_ProbNlData SCIP_PROBNLDATA |
Definition at line 131 of file reader_nl.cpp.
Function Documentation
◆ SCIP_DECL_PROBDELORIG()
|
static |
frees user data of original problem (called when the original problem is freed)
Definition at line 2863 of file reader_nl.cpp.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPfreeBlockMemoryArrayNull, SCIPfreeMemory, SCIPreleaseCons(), and SCIPreleaseVar().
◆ SCIP_DECL_READERCOPY()
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 2897 of file reader_nl.cpp.
References NULL, SCIP_CALL, SCIP_OKAY, and SCIPincludeReaderNl().
◆ SCIP_DECL_READERREAD()
|
static |
problem reading method of reader
Definition at line 2908 of file reader_nl.cpp.
References AMPLProblemHandler::cleanup(), NULL, SCIP_CALL, SCIP_DIDNOTRUN, SCIP_ERROR, SCIP_NOFILE, SCIP_NOMEMORY, SCIP_OKAY, SCIP_READERROR, SCIP_SUCCESS, and SCIPerrorMessage.
◆ SCIP_DECL_READERWRITE()
|
static |
problem writing method of reader
Definition at line 2979 of file reader_nl.cpp.
References NULL, PATHSEP, READER_NAME, SCIP_Bool, SCIP_CALL, SCIP_DIDNOTRUN, SCIP_ERROR, SCIP_FILECREATEERROR, SCIP_NOFILE, SCIP_NOMEMORY, SCIP_OKAY, SCIP_SUCCESS, SCIP_WRITEERROR, SCIPallocBufferArray, SCIPdebugMsg, SCIPerrorMessage, SCIPfreeBufferArray, SCIPfreeBufferArrayNull, SCIPgetBoolParam(), SCIPsnprintf(), and SCIPstrcasecmp().
◆ SCIPincludeReaderNl()
| SCIP_RETCODE SCIPincludeReaderNl | ( | SCIP * | scip | ) |
includes the AMPL .nl file reader in SCIP
- Parameters
-
scip SCIP data structure
Definition at line 3223 of file reader_nl.cpp.
References FALSE, NULL, READER_DESC, READER_EXTENSION, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPaddBoolParam(), SCIPincludeExternalCodeInformation(), SCIPincludeReaderBasic(), SCIPsetReaderCopy(), SCIPsetReaderRead(), and SCIPsetReaderWrite().
Referenced by SCIP_DECL_READERCOPY(), and SCIPincludeDefaultPlugins().
◆ SCIPwriteSolutionNl()
| SCIP_RETCODE SCIPwriteSolutionNl | ( | SCIP * | scip | ) |
writes AMPL solution file
problem must have been read with .nl reader
- Parameters
-
scip SCIP data structure
Definition at line 3255 of file reader_nl.cpp.
References NULL, SCIP_CALL, SCIP_ERROR, SCIP_INVALID, SCIP_OBJSENSE_MINIMIZE, SCIP_OKAY, SCIP_Real, SCIP_STAGE_SOLVED, SCIP_STATUS_BESTSOLLIMIT, SCIP_STATUS_DUALLIMIT, SCIP_STATUS_GAPLIMIT, SCIP_STATUS_INFEASIBLE, SCIP_STATUS_INFORUNBD, SCIP_STATUS_MEMLIMIT, SCIP_STATUS_NODELIMIT, SCIP_STATUS_OPTIMAL, SCIP_STATUS_PRIMALLIMIT, SCIP_STATUS_RESTARTLIMIT, SCIP_STATUS_SOLLIMIT, SCIP_STATUS_STALLNODELIMIT, SCIP_STATUS_TERMINATE, SCIP_STATUS_TIMELIMIT, SCIP_STATUS_TOTALNODELIMIT, SCIP_STATUS_UNBOUNDED, SCIP_STATUS_UNKNOWN, SCIP_STATUS_USERINTERRUPT, SCIP_WRITEERROR, SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPdebug, SCIPerrorMessage, SCIPgetBestSol(), SCIPgetDualsolLinear(), SCIPgetObjsense(), SCIPgetProbData(), SCIPgetSolVal(), SCIPgetStage(), SCIPgetStatus(), SCIPgetTransformedCons(), SCIPhasPerformedPresolve(), SCIPinfoMessage(), SCIPprintSol(), SCIPprintStatus(), and TRUE.
Referenced by fromAmpl().