7.4.2. 异常返回码

7.4.2.1. C/C++ 中的异常返回码

Result code, result code, 和状态信息

Result code

Result status

Description

0

MDO_OKAY

Nothing wrong.

-1

MDO_ERROR

Unspecified internal error.

-2

MDO_NOMEMORY

Insufficient memory.

-10

MDO_INVALID_LICENSE

License is not valid.

-11

MDO_HOME_ENV_NOT_FOUND

MINDOPT_HOME not exists.

-12

MDO_LIB_FOLDER_NOT_FOUND

MINDOPT bin folder not exists..

-1000

MDO_IO_ERROR

(I/O) General IO error.

-1001

MDO_FILE_READ_ERROR

(I/O) Failed to read data from file.

-1002

MDO_FILE_WRITE_ERROR

(I/O) Failed to write data to file.

-1003

MDO_DIRECTORY_ERROR

(I/O) Invalid directory.

-1100

MDO_FORMAT_ERROR

(I/O) Failed to parse the file.

-1101

MDO_VERSION_ERROR

(I/O) Failed to load model/parameter from file due to incompatiable version error.

-1200

MDO_REMOTE_INVALID_TOKEN

(I/O) The input token ID for the remote computing is not valid.

-1201

MDO_REMOTE_CONNECTION_ERROR

(I/O) Failed to connect to the remote computing server.

-2000

MDO_MODEL_INPUT_ERROR

Failed to input/load a model.

-2001

MDO_MODEL_EMPTY

Model is empty.

-2002

MDO_MODEL_INVALID_ROW_IDX

Row index is not valid.

-2003

MDO_MODEL_INVALID_COL_IDX

Column index is not valid.

-2004

MDO_MODEL_INVALID_ROW_NAME

Row name is not valid.

-2005

MDO_MODEL_INVALID_COL_NAME

Column name is not valid.

-2010

MDO_MODEL_INVALID_STR_ATTR

A string attribute was not recognized.

-2011

MDO_MODEL_INVALID_INT_ATTR

An integer attribute was not recognized.

-2012

MDO_MODEL_INVALID_REAL_ATTR

A real attribute was not recognized.

-3000

MDO_NO_SOLN

Solution is not available.

-3001

MDO_NO_RAY

Unbounded ray is not available.

-3002

MDO_NO_STATISTICS

Solver statistics is not available.

-3003

MDO_INVALID_BASIS_STATUS

Unrecognized basis status.

-4000

MDO_PARAM_SET_ERROR

Failed to change a parameter value.

-4001

MDO_PARAM_GET_ERROR

Failed to retrieve a parameter value.

-9000

MDO_ABORT_ITERATION_LIMIT

Iteration limit was reached in optimization.

-9001

MDO_ABORT_TIME_LIMIT

Time limit was reached in optimization.

-9002

MDO_ABORT_CTRL_C

Control-C command was captured in optimization.

-9003

MDO_ABORT_INVALID_METHOD

Selected optimization method is not supported.

-10000~-19999

MDO_SIMPLEX_NUMERIC

Numerical difficulties in Simplex algorithm.

-20000~-29999

MDO_INTERIOR_NUMERIC

Numerical difficulties in Interior-point algorithm.

7.4.2.2. Python

MindOpt Python SDK 中的异常返回码及其说明可以通过以下方式获得:

model = MdoModel()
try:

    # Input and solve the problem.
    ...
    model.solve_prob()

except MdoError as e:
    print("Received Mindopt exception.")
    print(" - Code          : {}".format(e.code))
    print(" - Reason        : {}".format(e.message))