Setting a a given precision (of decimal places) for a variable
AnsweredHi!
I have a positive variable (Iq) in my model that need to have a precision of 8 decimal places. So, I though than doing 100*I >=0 could help (since the constraint tolerance is 1e-6), but the results doesn't change (sometimes I get Iq=-1.5e-7 for example). After some tests I realized that the constraint 100*I>=0 is discarded by the presolve phase, but in constrant other scaled constraints (e.g.100*(Iq-V)>=0 ) are preserved. Actually, I think that doing 100*I >=0 is not a good practice, so I changed Iq by Iq2/100 in the model and that works well. Finally, I would like to ask when the presolve phase can affect the custom scaling of the model, and if there are better ways to model decimal precision of variables.
Thanks
-
Hi,
Gurobi has a parameter named ScaleFlag that automatically scales the model. Automatic scaling implicitly changes feasibility tolerance values.
- The internal substitution of \(x\) with \(0.1x^{\prime}\) implicitly multiplies the feasibility tolerance for bounds of \(x^{\prime}\) by 10.
- The internal substitution of \(x\) with \(10x^{\prime}\) implicitly divides the feasibility tolerance for bounds of \(x^{\prime}\) by 0.1.
By setting the ScaleFlag parameter to 0, you can turn the automatic scaling off.
- If the smallest meaningful value in your model is in the order of 1e-8, the rule of thumb is to set the feasibility tolerance to a value which is at least one order of magnitude smaller, i.e., 1e-9.
- Another idea is for the user to substitute \(x\) by \(0.001x^{\prime}\) where the default feasibility tolerance of 1e-6 for variable \(x^{\prime}\) means a feasibility tolerance of 1e-9 for variable \(x\).
Best regards,
Maliheh
1
Please sign in to leave a comment.
Comments
1 comment