7.4.4. 异常返回码

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

enum MdoResult

Result status.

Values:

enumerator MDO_OKAY

Nothing wrong.

enumerator MDO_ERROR

Unspecified internal error.

enumerator MDO_NOMEMORY

Insufficient memory.

enumerator MDO_INVALID_LICENSE

License is not valid.

enumerator MDO_IO_ERROR

(I/O) General IO error.

enumerator MDO_FILE_READ_ERROR

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

enumerator MDO_FILE_WRITE_ERROR

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

enumerator MDO_DIRECTORY_ERROR

(I/O) Invalid directory.

enumerator MDO_FORMAT_ERROR

(I/O) Failed to parse the file.

enumerator MDO_REMOTE_INVALID_TOKEN

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

enumerator MDO_REMOTE_CONNECTION_ERROR

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

enumerator MDO_MODEL_INPUT_ERROR

Failed to input/load a model.

enumerator MDO_MODEL_EMPTY

Model is empty.

enumerator MDO_MODEL_INVALID_ROW_IDX

Row index is not valid.

enumerator MDO_MODEL_INVALID_COL_IDX

Column index is not valid.

enumerator MDO_MODEL_INVALID_ROW_NAME

Row name is not valid.

enumerator MDO_MODEL_INVALID_COL_NAME

Column name is not valid.

enumerator MDO_MODEL_INVALID_STR_ATTR

A string attribute was not recognized.

enumerator MDO_MODEL_INVALID_INT_ATTR

An integer attribute was not recognized.

enumerator MDO_MODEL_INVALID_REAL_ATTR

A real attribute was not recognized.

enumerator MDO_NO_SOLN

Solution is not available.

enumerator MDO_NO_RAY

Unbounded ray is not available.

enumerator MDO_NO_STATISTICS

Solver statistics is not available.

enumerator MDO_INVALID_BASIS_STATUS

Unrecognized basis status.

enumerator MDO_PARAM_SET_ERROR

Failed to change a parameter value.

enumerator MDO_PARAM_GET_ERROR

Failed to retrieve a parameter value.

enumerator MDO_ABORT_ITERATION_LIMIT

Iteration limit was reached in optimization.

enumerator MDO_ABORT_TIME_LIMIT

Time limit was reached in optimization.

enumerator MDO_ABORT_CTRL_C

Control-C command was captured in optimization.

enumerator MDO_SIMPLEX_NUMERIC

Numerical difficulties in Simplex algorithm.

enumerator MDO_INTERIOR_NUMERIC

Numerical difficulties in Interior-point algorithm.

enumerator MDO_HOME_ENV_NOT_FOUND

(-11) MINDOPT_HOME not exists.

enumerator MDO_LIB_FOLDER_NOT_FOUND

(-12) MINDOPT bin folder not exists.

7.4.4.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))