我最近在eclipse中使用gurobi(java),我确定我已经成功获得了许可证,当我使用gurobi解决诸如此类的LP问题时,一切都很好:

public LP(int n, int[]s, int[][]b) throws GRBException
{
    ...
    env = new GRBEnv("LPRelaxation.log");
    model = new GRBModel(env);
}

然后,我在程序中添加了QP部件,并发生了错误:
public QP() throws GRBException
{
    env = new GRBEnv("LPRelaxation.log");
    model = new GRBModel(env);
}

错误:
Exception in thread "main" gurobi.GRBException: No Gurobi license found (user asus, host OWEN-ASUS, hostid fccf6a77)
at gurobi.GRBEnv.<init>(GRBEnv.java:20)
at methods.QP.<init>(QP.java:16)
....

最佳答案

使用许可证密钥文件的路径设置环境变量GRB_LICENSE_FILE

参考:
https://www.gurobi.com/documentation/8.1/quickstart_mac/testing_your_license.html

10-06 03:14