•  Gurobi Staff

This looks like a bug. Thanks for reporting! I will investigate and check what is going on.

Tobias

•  Gurobi Staff

This is actually not a bug. It is due to the large (actually, infinite) domains of your variables and the consequences that this has for the piece-wise linear approximation that we use for the log constraint.

If you use general function constraints (like log, exp, sin, cos, tan) then you should really try to specify the domain of the argument variable (x) as precisely as possible. If you know that your argument variables will only be, e.g., inside [0,100], then you should specify those bounds when you create the variables.

The reason is that the function constraints are converted into a piece-wise linear approximation. You can specify exactly how this approximation should be done, using the "FuncPieceError", "FuncPieceLength", "FuncPieceRatio", and "FuncPieces" attributes. If you don't, Gurobi tries to do something reasonable as a tradeoff between approximation error and resulting model size. In your case with the infinite domain, we arbitrarily restrict the domains of the argument variables to [0,1000000]. Then, we limit the total number of pieces for the PWL approximation in the model. This yields a piece length of 8888 for your y = ln(x) functions. Consequently, in particular the first piece of each function is a very very rough approximation. Because y >= 0, we can infer x >= 1, so that the first piece is the secant in [1,8889], which is y_0 = ln(8889) * (x-1)/8888.

Thus, you get y_0(11) = 0.01 even though ln(11) = 2.39.

If you keep presolve enabled, then Gurobi finds much tighter bounds and is thus able to produce a much better approximation with the same number of pieces.

But you should really restrict the domains of the argument variables.

Regards,

Tobias

•   Thanks Tobias. I have used lb and ub for all my variables. Now 'exp' and 'log' are working as expected. However, the solutions take some time to compute as shown below. Do you think anything is unusal in the execution log below?

I don't know the meaning of the following: Nodes | Current Node | Objective Bounds | Work Do you think I can increase the speed by specifying  "FuncPieceError", "FuncPieceLength", "FuncPieceRatio", and "FuncPieces" attributes as well?

Thanks.

•  Gurobi Staff

The log file looks okay. It seems pretty difficult to find a feasible solution for your model.

What you see in the table is the output of the branch-and-bound tree search. The algorithm successively divides your problem into smaller sub-problems until a sub-problem is small or easy enough so that Gurobi can find an optimal solution to that sub-problem or prove that no feasible solution can exist in this sub-problem. This branch-and-bound process generates a search tree, with the "Expl" column telling you how many nodes of this search tree have already been processed, and the "Unexpl" telling you how many open nodes still exist in the tree.

The "Func*" attributes are about the tradeoff between precision and performance. The more pieces are used to approximate a non-linear function, the more accurate will the approximation be, but also the more difficult it will be to solve the resulting model.