Gurobi is not reading license settings from GurobiConfiguration

98 views
Skip to first unread message

23h...@gmail.com

unread,
Feb 19, 2020, 2:33:51 PM2/19/20
to OPTANO Modeling
I got a license for Gurobi cloud but when I pass the values of access ID, cloud key, and cloud pool through GurobiConfiguration, Gurobi doesn't recognize them. It instead uses whatever values exist in c:\gurobi\gurobi.lic  if that file exists, otherwise none. Could you figure out whether the issue is on your end?

Specifically, my code looks something like:

var gurobiConfig = new GurobiSolverConfiguration { TimeLimit = 300, CloudAccessID = "foo", CloudPool = "bar", CloudSecretKey = "baz" };
using (var solver = new GurobiSolver(gurobiConfig))
{
    var solution = solver.Solve(_model);
}

Of these, only TimeLimit is actually respected.

My gurobi.lic file looks like:

CLOUDACCESSID=foo
CLOUDKEY=bar
CLOUDPOOL=baz


Thanks,
Jessica.

OPTANO Team

unread,
Feb 19, 2020, 2:42:35 PM2/19/20
to OPTANO Modeling
Hi,

I'll have a look at this issue.

As a quick qorkaround, you might want to place a new gurobi.lic file into the application folder.
I shall be taken primarily (instead of the gurobi.lic in gurobi's installation folder.)

When adding the gurobi nuget package, it should add such a file to your project.

Best,
jp

OPTANO Team

unread,
Feb 19, 2020, 3:06:05 PM2/19/20
to OPTANO Modeling
Hi,

I think the issue is related to the initialization of the GrbEnv(). Probably Gurobi looks for a license immediately on startup, finds it in the c:\gurobi\gurobi.lic file and then rejects the cloud credentials. I get a corresponding message on my system
"Gurobi.GRBException: Mixing different types of licence parameters is not allowed"

We will adapt the instantiation of GrbEnv and discuss whether to introduce a parameter that allows users to choose which license information should be taken from the GurobiSolver configuration (Cloud, ISV, File, etc.)

I will get back to you as soon as possible!
Greetings,
jp


Jessica Wong

unread,
Feb 19, 2020, 4:27:05 PM2/19/20
to OPTANO Modeling
That's not quite what I'm seeing, however. If I remove the license file completely, it still doesn't read the license fields in the GurobiConfiguration. It behaves the same as if they are unspecified, i.e. to use the limited license.

OPTANO Team

unread,
Feb 19, 2020, 4:38:37 PM2/19/20
to OPTANO Modeling
does gurobi read the license file in your local application folder at first?

Jessica Wong

unread,
Feb 19, 2020, 5:11:54 PM2/19/20
to OPTANO Modeling
So it did read the file once I put it there (there was no placeholder file). However I don't see any error about mixing licenses when supplying it both ways.

Jessica Wong

unread,
Feb 19, 2020, 5:32:19 PM2/19/20
to OPTANO Modeling
Another data point that might be useful:
When I use the config option LimitedLicenseUsage = OPTANO.Modeling.Optimization.Solver.Gurobi.LimitedLicenseUsage.Always :
When there is no license file available, I get an error (good). But when there is a license file available it uses the license.

OPTANO Team

unread,
Feb 20, 2020, 3:26:57 AM2/20/20
to OPTANO Modeling
Hi,

what Gurobi Version do you use?
The Gurobi 9 limited license is valid until End of year 2020.

Actually, When using Always,it Gurobi should never read its license from a file and never show an license error (at least, if the model is small enough).
No matter, if a license file is available.

We have put this ticket on the today's board. Probably it will be fixed in the next 24hrs.

Best,
jp

OPTANO Team

unread,
Feb 21, 2020, 9:27:08 AM2/21/20
to OPTANO Modeling
Hi,

we have fixed the issue and published a new Version to nuget (3.3.0).

The license check of gurobi is

Fix: License information parameters from GurobiSolverConfiguration were applied after the GRBEnv was already started. This causes an error.
  • Additionally, some license parameters were not used, when initializing the GRBEnv.
    This has now been resolved for GurobiSolver 8.0 and later.
  • Note: If you provide information for more than 1 license type (e.g. CloudServer + ComputeServer), the first complete license information will be used. License types are checked in the following order:
  1. Check if LimitedLicenseUsage.Always
  2. ISV License
  3. Compute Server License
  4. Cloud Server License
  5. gurobi.lic file
  6. Check if LimitedLicenseUsage.Fallback
  • else: Abort with error

Best,
jp

jya...@gmail.com

unread,
Aug 24, 2020, 12:28:22 PM8/24/20
to OPTANO Modeling
I'm seeing new errors where Optano is trying to find a Gurobi license file when I'm trying to use the limited license. This is true even when I set the value LimitedLicenseUsage.Always in my Gurobi configuration. Could you see what might have changed? Perhaps the Gurobi limited license is no longer working? I wasn't checking for a while so I don't know when this broke. 

Jessica.

OPTANO Team

unread,
Aug 24, 2020, 12:47:03 PM8/24/20
to OPTANO Modeling
Hi,

could you provide a few more details:
* What version of gurobi would you like to use?
* What version of modeling do you use?

In general the Limited Keys time out and we keep on delivering new ones with new modeling versions - as long as Gurobi provides them. An update of modeling might just fix the issue, if your gurobi version is rather up to date.

Best,
jp

jya...@gmail.com

unread,
Aug 24, 2020, 1:43:41 PM8/24/20
to OPTANO Modeling
Using Optano 3.4.0.489 and Gurobi 9.0.2.24  

OPTANO Team

unread,
Aug 25, 2020, 3:04:21 AM8/25/20
to OPTANO Modeling
Hi,

I am not able to reproduce the issue.
I have create a blank dotnet project and added the package by using
> dotnet add package OPTANO.Modeling.Gurobi

which adds
* OPTANO.Modeling.Gurobi 9.0.2.24
* OPTANO.Modeling 3.3.0.473


The program.cs is just

using OPTANO.Modeling.Optimization.Solver.Gurobi;
using OPTANO.Modeling.Optimization.Solver.Gurobi900;
using System;

namespace isv_check
{
    class Program
    {
        static void Main(string[] args)
        {
            var solverConfig = new GurobiSolverConfiguration {LimitedLicenseUsage = LimitedLicenseUsage.Always};
            var solver = new GurobiSolver(solverConfig);
            Console.WriteLine(solver.ToString());
        }
    }
}


The output the is:

Using size-limited Gurobi license for Optano Modeling
Please visit https://www.gurobi.com/partners/optano to obtain an unlimited license.

OPTANO.Modeling.Optimization.Solver.Gurobi900.GurobiSolver



That just works!?

Would you kindly check the console output. Is the problem to large for the trial license?

Best,
jp

Reply all
Reply to author
Forward
0 new messages