调试日志Dec. 25, 2023——MATLAB+Yalmip/GUROBI求解错误,求解结果NaN

在MATLAB环境使用Yalmip/GUROBI求解MIP问题,设置求解器参数:

ops = sdpsettings('verbose',2,'solver','gurobi');

优化求解:

result = optimize(C,F_es,ops);
if result.problem == 0
    disp('求解成功!')
else
    disp('其他求解错误!')
end

得到“其他求解错误”,需要获得result.problem结果,可以参考yalmip官方提供yalmiperror报错细则:yalmiperror - YALMIP

result.problem

2023年12月25日,报错结果为9,即未知错误(若出现其他错误,可以找到对应文档进行debug)

在sdpsettings中添加debug(调试未知错误 - YALMIP

ops = sdpsettings('verbose',2,'solver','gurobi','debug',1);

错误代码:10009,查看GUROBI Error Codes(Error Codes - Gurobi Optimization

明确是License到期导致的求解错误,重新向GUROBI官方获得License(上一个只有6个月的期限:2023年6月-2023年12月),反正注意环境配置就行,重新求解模型,求解成功。

猜你喜欢

转载自blog.csdn.net/HISJJ/article/details/135205136
25