8.5.2. 异常返回码

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

运行的结果码,或者说错误码,Error Code。

结果码

结果状态

中文说明

英文说明

0

MDO_OKAY

没有异常

Nothing wrong.

-1

MDO_ERROR

未指明的内部错误

Unspecified internal error.

-2

MDO_NOMEMORY

内存不足

Insufficient memory.

-3

MDO_INVALID_ARGUMENT

参数无效

Arguments is not valid.

-10

MDO_INVALID_LICENSE

许可证无效

License is not valid.

-11

MDO_HOME_ENV_NOT_FOUND

环境变量 MINDOPT_HOME 未找到

MINDOPT_HOME not exists.

-12

MDO_DLL_ERROR

MindOpt的动态库加载失败

Failed to load a dynamic library.

-1000

MDO_IO_ERROR

IO 通信错误

(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

远程计算服务中输入的 token ID 无效

(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.

-2006

MDO_MODEL_INVALID_SYM_MAT_IDX

对称矩阵的索引无效

Index of the symmetric matrix is not valid.

-2007

MDO_MODEL_INVALID_SYM_MAT_ROW_IDX

对称矩阵的行索引无效

Row index of a symmetric matrix is not valid.

-2008

MDO_MODEL_INVALID_SYM_MAT_COL_IDX

对称矩阵的列索引无效

Column index of a symmetric matrix 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.

-2013

MDO_MODEL_INVALID_REAL_ATTR_SYM_MAT

对称矩阵的实数性属性无法识别

A real attribute for symmetric matirx was not recognized.

-2014

MDO_MODEL_INVALID_CHAR_ATTR

模型的字符属性无法识别

A char attribute was not recognized.

-2019

MDO_MODEL_INVALID_ATTR_NAME

模型的属性名称无法识别

A name for 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

无法识别的 basis 状态值

Unrecognized basis status.

-3004

MDO_IIS_NO_SOLN

当前模型的 IIS 不可用

No IIS available for the current model.

-3005

MDO_IIS_FEASIBLE

可解模型的 IIS 不可用

IIS is not available on a feasible model.

-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

求解中遇到Ctrl+C命令中断求解过程

Control-C command was captured in optimization.

-9003

MDO_ABORT_NODE_LIMIT

求解节点数已达到she限制

Node limit was reached in optimization.

-9004

MDO_ABORT_STALLING_NODE_LIMIT

连续未能发现更优解的节点数超过限制

Stalling node limit was reached in optimization.

-9011

MDO_ABORT_INVALID_METHOD

您选择的优化算法当前不支持

Selected optimization method is not supported.

-9012

MDO_ABORT_SOLVER_NOT_AVAILABLE

求解器不支持求解输入的问题

Optimization solver is not available for the input model.

-10000~-19999

MDO_SIMPLEX_NUMERIC

单纯形法的数值错误

Numerical difficulties in Simplex algorithm.

-20000~-29999

MDO_INTERIOR_NUMERIC

内点法的数值错误

Numerical difficulties in Interior-point algorithm.

-30000

MDO_IIS_NUMERIC

计算IIS时发生数值错误

Numerical difficulties occurred while computing IIS.

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