Model 1: the simplest quadratic model
| Model 1 |
|---|
| \[\begin{aligned}\max\>&{\color{darkred}z}\\ & {\color{darkred}z} \le \sum_c \left({\color{darkred}x}_{i,c}-{\color{darkred}x}_{j,c}\right)^2 && \forall i\lt j \\ & {\color{darkred}x}_{i,c} \in [{\color{darkblue}L},{\color{darkblue}U}] \\ & c \in \{x,y\} \\ & i,j \in \{1,\dots,n\} \end{aligned}\] |
Instead of working with the distance, we use the squared distance. That saves us a square root. The square root may cause problems: it is not differentiable at 0. So it is better to use a quadratic model.
MODEL STATISTICSBLOCKS OF EQUATIONS 1 SINGLE EQUATIONS 45BLOCKS OF VARIABLES 2 SINGLE VARIABLES 21NON ZERO ELEMENTS 225 NON LINEAR N-Z 180CODE LENGTH 451 CONSTANT POOL 16
Model 2: less nonlinear, but not better
| Model 2 |
|---|
| \[\begin{aligned}\max\>&{\color{darkred}z}\\ & {\color{darkred}d}_{i,j,c} ={\color{darkred}x}_{i,c}-{\color{darkred}x}_{j,c} && \forall i\lt j, c \\ & {\color{darkred}z} \le \sum_c {\color{darkred}d}_{i,j,c}^2 && \forall i\lt j \\ & {\color{darkred}x}_{i,c} \in [{\color{darkblue}L},{\color{darkblue}U}] \\ & c \in \{x,y\} \\ & i,j \in \{1,\dots,n\} \end{aligned}\] |
MODEL STATISTICSBLOCKS OF EQUATIONS 2 SINGLE EQUATIONS 135BLOCKS OF VARIABLES 3 SINGLE VARIABLES 111NON ZERO ELEMENTS 405 NON LINEAR N-Z 90CODE LENGTH 361 CONSTANT POOL 16
Model 3: adding a symmetry breaker
| Model 3 |
|---|
| \[\begin{aligned}\max\>&{\color{darkred}z}\\ & {\color{darkred}z} \le \sum_c \left({\color{darkred}x}_{i,c}-{\color{darkred}x}_{j,c}\right)^2 && \forall i\lt j \\ &{\color{darkred}x}_{i,x} \le{\color{darkred}x}_{i+1,x} && \forall i\lt n\\ & {\color{darkred}x}_{i,c} \in [{\color{darkblue}L},{\color{darkblue}U}] \\ & c \in \{x,y\} \\ & i,j \in \{1,\dots,n\} \end{aligned}\] |
Model 4: refining the symmetry breaker
| Model 4 |
|---|
| \[\begin{aligned}\max\>&{\color{darkred}z}\\ & {\color{darkred}z} \le \sum_c \left({\color{darkred}x}_{i,c}-{\color{darkred}x}_{j,c}\right)^2 && \forall i\lt j \\ &{\color{darkred}x}_{i,x}+0.123{\color{darkred}x}_{i,y} \le{\color{darkred}x}_{i+1,x}+0.123 {\color{darkred}x}_{i+1,y} && \forall i\lt n\\ & {\color{darkred}x}_{i,c} \in [{\color{darkblue}L},{\color{darkblue}U}] \\ & c \in \{x,y\} \\ & i,j \in \{1,\dots,n\} \end{aligned}\] |
Model 5: Manhattan distance
| Model 5 |
|---|
| \[\begin{aligned}\max\>&{\color{darkred}z}\\ & {\color{darkred}z} \le \sum_c \left|{\color{darkred}x}_{i,c}-{\color{darkred}x}_{j,c}\right| && \forall i\lt j \\ & {\color{darkred}x}_{i,c} \in [{\color{darkblue}L},{\color{darkblue}U}] \\ & c \in \{x,y\} \\ & i,j \in \{1,\dots,n\} \end{aligned}\] |
Model 6: Manhattan distance + symmetry breaker
| Model 6 |
|---|
| \[\begin{aligned}\max\>&{\color{darkred}z}\\ & {\color{darkred}z} \le \sum_c \left|{\color{darkred}x}_{i,c}-{\color{darkred}x}_{j,c}\right| && \forall i\lt j\\ &{\color{darkred}x}_{i,x}+0.123{\color{darkred}x}_{i,y} \le{\color{darkred}x}_{i+1,x}+0.123 {\color{darkred}x}_{i+1,y} && \forall i\lt n\\ & {\color{darkred}x}_{i,c} \in [{\color{darkblue}L},{\color{darkblue}U}] \\ & c \in \{x,y\} \\ & i,j \in \{1,\dots,n\} \end{aligned}\] |
Model 7: Manhattan distance + binary variables
| Model 7 |
|---|
| \[\begin{aligned}\max\>&{\color{darkred}z}\\ & {\color{darkred}z} \le \sum_c \left( {\color{darkred}d}_{i,j,c}^+ +{\color{darkred}d}_{i,j,c}^- \right) && \forall i\lt j \\ &{\color{darkred}d}_{i,j,c}^+ -{\color{darkred}d}_{i,j,c}^- = {\color{darkred}x}_{i,c}-{\color{darkred}x}_{j,c} && \forall i \lt j \\& {\color{darkred}d}_{i,j,c}^+ \le {\color{darkblue}M} {\color{darkred}\delta}_{i,j,c} && \forall i \lt j, c \\ & {\color{darkred}d}_{i,j,c}^- \le {\color{darkblue}M} (1-{\color{darkred}\delta}_{i,j,c}) && \forall i \lt j, c \\ &{\color{darkred}x}_{i,x}+0.123{\color{darkred}x}_{i,y} \le{\color{darkred}x}_{i+1,x}+0.123 {\color{darkred}x}_{i+1,y} && \forall i\lt n\\ & {\color{darkred}x}_{i,c} \in [{\color{darkblue}L},{\color{darkblue}U}] \\ & {\color{darkred}d}_{i,j,c}^+,{\color{darkred}d}_{i,j,c}^- \ge 0 \\ & {\color{darkred}\delta}_{i,j,c} \in\{0,1\} \\& {\color{darkblue}M} = 2({\color{darkblue}U}-{\color{darkblue}L}) \\ & c \in \{x,y\} \\ & i,j \in \{1,\dots,n\} \end{aligned}\] |
Conclusion
Model
GAMS Models
$ontext
Hostile Brothers Problem
Model 1, 10 points 1000 seconds: Elapsed time (sec): 999, estimated tree completion: 0.00015 Node BestSoln BestBound Sols Active Depth Gap GInf Time 2483289 1774.764542 4812.031822 11 2420538 24 63.12% 25 999
Model 2, 10 points 1000 seconds: Elapsed time (sec): 962, estimated tree completion: 0.01635 Node BestSoln BestBound Sols Active Depth Gap GInf Time 4902062 1774.764542 5413.400780 11 3749096 48 67.22% 9 998
Model 3, 10 points 1000 seconds: Elapsed time (sec): 984, estimated tree completion: 0.25586 Node BestSoln BestBound Sols Active Depth Gap GInf Time 3113456 1774.764542 2782.885513 10 1379914 34 36.23% 13 999
Model 4, 10 points 1000 seconds: Elapsed time (sec): 988, estimated tree completion: 0.55634 Node BestSoln BestBound Sols Active Depth Gap GInf Time 2462808 1774.764542 2484.977151 10 886081 32 28.58% 12 999
Model 5, 10 points 1000 seconds: Elapsed time (sec): 999, estimated tree completion: 0.35231 Node BestSoln BestBound Sols Active Depth Gap GInf Time 26588858 57.142857 75.000000 17 9164865 31 23.81% 18 999
Model 6, 10 points 1000 seconds: Elapsed time (sec): 1, estimated tree completion: 0.98114 Node BestSoln BestBound Sols Active Depth Gap GInf Time 59659 57.142857 58.713838 18 42 27 2.68% 9 2 *** Search completed ***
Model 7, 10 points 1000 seconds: Elapsed time (sec): 2, estimated tree completion: 0.89402 Node BestSoln BestBound Sols Active Depth Gap GInf Time 28397 57.142857 72.001382 16 57 20 20.64% 32 3 *** Search completed ***
$offtext
* solver option qcp=xpress, dnlp=xpress, mip=xpress;
* time limit option reslim=1000;
sets i /point1*point10/ c /x,y/ pm /'+','-'/ ; alias (i,j);
set lt(i,j) 'upper triangular part'; lt(i,j) = ord(i) < ord(j);
scalars L /0/ U /100/ ;
variables z 'objective value' x(i,c) 'location of point i in dimension c' d(i,j,c) 'distance between points i and j in dimension c' d2(i,j,c,pm) 'split variables for linearizing manhattan distance' ;
x.lo(i,c) = L; x.up(i,c) = U;
positive variable d2;
binary variable delta(i,j,c);
equation sqdistance 'squared distance' edelta 'definition of d' sqdistance2 'squared distance (alternative, using d)' order 'ordering of points by x-coordinate' order2 'ordering of points by x- and y-coordinate (alternative)' l1distance 'manhattan distance' l1distance2 'manhattan distance (linearized)' split1 'variable splitting constraint 1' split2 'variable splitting constraint 2' split3 'variable splitting constraint 3' ;
sqdistance(lt(i,j)).. z =l= sum(c, sqr(x(i,c) - x(j,c)));
edelta(lt(i,j),c).. d(i,j,c) =e= x(i,c) - x(j,c); sqdistance2(lt(i,j)).. z =l= sum(c, sqr(d(i,j,c)));
order(i+1).. x(i,'x') =l= x(i+1,'x');
order2(i+1).. x(i,'x')+0.123*x(i,'y') =l= x(i+1,'x')+0.123*x(i+1,'y');
* manhattan distance l1distance(lt(i,j)).. z =l= sum(c, abs(x(i,c) - x(j,c)));
* needed for xpress solver z.up = 1e6;
scalar M 'big-M'; M = 2*(U-L); * manhattan distance manually linearized split1(lt(i,j),c).. d2(i,j,c,'+') - d2(i,j,c,'-') =e= x(i,c) - x(j,c); split2(lt(i,j),c).. d2(i,j,c,'+') =l= M*delta(i,j,c); split3(lt(i,j),c).. d2(i,j,c,'-') =l= M*(1-delta(i,j,c)); l1distance2(lt(i,j)).. z =l= sum((c,pm), d2(i,j,c,pm));
model brothers1 /sqdistance/; model brothers2 /edelta, sqdistance2/; model brothers3 /sqdistance, order/; model brothers4 /sqdistance, order2/; model brothers5 /l1distance/; model brothers6 /l1distance, order2/; model brothers7 /l1distance2, split1,split2,split3, order2/;
solve brothers1 maximizing z using qcp; solve brothers2 maximizing z using qcp; solve brothers3 maximizing z using qcp; solve brothers4 maximizing z using qcp; solve brothers5 maximizing z using dnlp; solve brothers6 maximizing z using dnlp; solve brothers7 maximizing z using mip; |
References
- Cornuejols, Gerard; Karamanov, Miroslav; Li, Yanjun (2006). Early Estimates of the Size of Branch-and-Bound Trees. Carnegie Mellon University. Journal contribution. https://doi.org/10.1184/R1/6705221.v1
- [2605.04850] Out-of-the-Box Global Optimization for Packing Problems: New Models and Improved Solutions
No comments:
Post a Comment