Hi, @mewilhel, this issue follows the previous one #3, but I think it is more appropriate to open two issues.
I am new to McCormick relaxation and learn the basics from the paper [1], especially the affine relaxation with the subgradient. I also read your paper on EAGO [2]. I played with the notebook demonstrating customized routines in EAGO, since I have a similar parameter identification problem, i.e., a nonlinear least-squares problem with only box constraints. I have however some unexpected findings and would like to consult you for more details. The following discussion is constrained to box constrained problems only. The modified notebook can be found here.
1. Affine relaxation in lower_problem!
In lower_problem! of your original notebook, the lower bounding is underestimated by the natural interval extension. However, it is often stated in the literature (e.g., [1, 2]) that the natural interval extension is not as tight as McCormick relaxation. I thus examined the simplest single-point affine relaxation in lower_problem! (thanks for the excellent McCormick.jl package). Additionally, I also check which one is a tighter underestimation. The code is pasted below (hope nothing wrong).
import EAGO.lower_problem!
function lower_problem!(t::IntervalExt, x::EAGO.Optimizer)
# retrieve bounds at current node
n = x._current_node
lower = n.lower_variable_bounds
upper = n.upper_variable_bounds
# McCormick relaxation
box = Interval.(lower, upper)
xmid = mid.(box)
xMC = [MC{4, NS}(xmid[i], box[i], i) for i =1:4]
fMC = obj_func(xMC)
# affine relaxation at `xmid`
s = fMC.cv_grad
xopt = similar(lower) # store minimum solution to the affine relaxation
@inbounds for (i, ele) in enumerate(s)
xopt[i] = ele > 0 ? lower[i] : upper[i]
end
fopt = fMC.cv + s ⋅ (xopt .- xmid)
# report lower bounding results
x._lower_objective_value = fopt
x._lower_solution = xopt
x._lower_feasibility = true
x._cut_add_flag = false
# can we get a tigher lower bound than natural interval extension?
itv_nat = fMC.Intv
if fopt > lo(itv_nat)
@show (lo(itv_nat), fopt, n.depth, n.id)
end
return
end
The above obj_func is just obj_func(x) = sin(x[1])*x[2]^2 - cos(x[3])/x[4] for simplicity.
- It is surprising that
fopt > lo(itv_nat) never becomes true, which means the natural interval extension is always tighter for lower bounding. However, in Section 3.6 of [2], it says
For nonlinear expressions, an affine relaxation is generated via an affine approximation of the expression at the midpoint
of the domain using subgradient information.
Since I am new to this field, does it often happen that the affine approximate is even worse than natural extension? If so, we may combine the two and fetch the smaller one (I am not sure whether EAGO has already done it).
In addition, is it worth attempting multi-point affine relaxation in contrast to the single midpoint as done above? For constrained problems, multi-point affine relaxation leads to a larger LP problem; for non-constrained problems as we discuss here, the minimum value of the relaxation is min max g_i(x) where g_i is an affine function. There exists faster algorithm than LP to solve this minimization.
- Though there happens to be always
fopt <= lo(itv_nat), it actually took less iterations than the original method using natural interval extension (557 vs. 734), which seems strange to me. A tighter lower bounding is expected to reduce rather than increase the number of iterations in branch and bound, right? Is it due to the branching mechanism in EAGO? (since the domain reduction techniques have been disabled and the upper bounding method is the same)
2. Inspection of the obtained global optimal solutions
In #3, I noticed that there is discrimination between the reported result and the actual one. This issue still exists here:
The optimal value is: -1.498837828202948, the solution found is [-1.573774954304099, 0.9998533502221107, -0.006667515262961388, 2.003519594669342].
Verify obj value @ xsol: -1.4988128398246658
The above observations may, unfortunately, imply that EAGO has numerical issues somewhere, which asks for improvement.
3. Finally, as stated in [1], the McCormick based relaxation is particularly suitable for a parameter identification problem (like the example in Section 5.1 of [1]), where the number of variables is small but the number of factors can be large due to multiple data points. For such an unconstrained NLP, do you have suggestions on the lower_problem! based on your experience? I have not tested the multi-point affine relaxation yet.
[1] Mitsos, Alexander, Benoît Chachuat, and Paul I. Barton. "McCormick-based relaxations of algorithms." SIAM Journal on Optimization 20.2 (2009): 573-601.
[2] Wilhelm, M. E., and M. D. Stuber. "EAGO. jl: easy advanced global optimization in Julia." Optimization Methods and Software (2020): 1-26.
Hi, @mewilhel, this issue follows the previous one #3, but I think it is more appropriate to open two issues.
I am new to McCormick relaxation and learn the basics from the paper [1], especially the affine relaxation with the subgradient. I also read your paper on EAGO [2]. I played with the notebook demonstrating customized routines in EAGO, since I have a similar parameter identification problem, i.e., a nonlinear least-squares problem with only box constraints. I have however some unexpected findings and would like to consult you for more details. The following discussion is constrained to box constrained problems only. The modified notebook can be found here.
1. Affine relaxation in
lower_problem!In
lower_problem!of your original notebook, the lower bounding is underestimated by the natural interval extension. However, it is often stated in the literature (e.g., [1, 2]) that the natural interval extension is not as tight as McCormick relaxation. I thus examined the simplest single-point affine relaxation inlower_problem!(thanks for the excellent McCormick.jl package). Additionally, I also check which one is a tighter underestimation. The code is pasted below (hope nothing wrong).The above
obj_funcis justobj_func(x) = sin(x[1])*x[2]^2 - cos(x[3])/x[4]for simplicity.fopt > lo(itv_nat)never becomes true, which means the natural interval extension is always tighter for lower bounding. However, in Section 3.6 of [2], it saysSince I am new to this field, does it often happen that the affine approximate is even worse than natural extension? If so, we may combine the two and fetch the smaller one (I am not sure whether EAGO has already done it).
In addition, is it worth attempting multi-point affine relaxation in contrast to the single midpoint as done above? For constrained problems, multi-point affine relaxation leads to a larger LP problem; for non-constrained problems as we discuss here, the minimum value of the relaxation is
min max g_i(x)whereg_iis an affine function. There exists faster algorithm than LP to solve this minimization.fopt <= lo(itv_nat), it actually took less iterations than the original method using natural interval extension (557 vs. 734), which seems strange to me. A tighter lower bounding is expected to reduce rather than increase the number of iterations in branch and bound, right? Is it due to the branching mechanism in EAGO? (since the domain reduction techniques have been disabled and the upper bounding method is the same)2. Inspection of the obtained global optimal solutions
In #3, I noticed that there is discrimination between the reported result and the actual one. This issue still exists here:
The above observations may, unfortunately, imply that EAGO has numerical issues somewhere, which asks for improvement.
3. Finally, as stated in [1], the McCormick based relaxation is particularly suitable for a parameter identification problem (like the example in Section 5.1 of [1]), where the number of variables is small but the number of factors can be large due to multiple data points. For such an unconstrained NLP, do you have suggestions on the
lower_problem!based on your experience? I have not tested the multi-point affine relaxation yet.[1] Mitsos, Alexander, Benoît Chachuat, and Paul I. Barton. "McCormick-based relaxations of algorithms." SIAM Journal on Optimization 20.2 (2009): 573-601.
[2] Wilhelm, M. E., and M. D. Stuber. "EAGO. jl: easy advanced global optimization in Julia." Optimization Methods and Software (2020): 1-26.