gurobi.GRBException:未找到Gurobi许可证

时间:2017-07-05 16:15:39

标签: java eclipse gurobi

我最近在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)
....

1 个答案:

答案 0 :(得分:0)

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

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