diff --git a/Volume_1/Book_about_Quadratization.tex b/Volume_1/Book_about_Quadratization.tex index 02b9b4b..5879b3a 100644 --- a/Volume_1/Book_about_Quadratization.tex +++ b/Volume_1/Book_about_Quadratization.tex @@ -842,7 +842,7 @@ \subsection{NTR-ABCG (Anthony, Boros, Crama, Gruber, 2014)} \label{subsec:Negat \examplesec \begin{align} -H_{{\rm 6-local}} & =-2b_{1}b_{2}b_{3}b_{4}b_{5}b_{6} + b_5b_6, +H_{{\rm 6-local}} & =-2b_{1}b_{2}b_{3}b_{4}b_{5}b_{6} + b_5b_6 = 2\sum_{i}^{5}b_{i}-2\sum_{i}^{5}b_{i}b_{6}-2\sum_{i}^6b_{i}b_{a}+10b_{6}b_{a} + b_{5}b_{6}. \end{align} has a unique minimum energy of -1 when all $b_i=1$. diff --git a/everything_else/reproducing.m b/everything_else/reproducing.m index b2b0fd0..67dce6c 100644 --- a/everything_else/reproducing.m +++ b/everything_else/reproducing.m @@ -53,7 +53,36 @@ RHS=min(reshape((6 - 1 - b1 - b2 - b3 - b4 - b5 - b6).*ba,2,[])); isequal(LHS,RHS); -%% Pg. 11, NTR-ABCG Eq. 30-32 +%% Pg. 11, NTR-ABCG +b = dec2bin(2^7-1:-1:0)-'0'; % included for clarity; repeated from previous cell +b1=b(:,1);b2=b(:,2);b3=b(:,3);b4=b(:,4);b5=b(:,5);b6=b(:,6);ba = b(:,7); + +% Summary section + +LHS=min(reshape(-b1.*b2.*b3.*b4.*b5.*b6,2,[])); +RHS=min(reshape(b1+b2+b3+b4+b5-(b1+b2+b3+b4+b5).*b6-(b1+b2+b3+b4+b5+b6).*ba+(6-1).*b6.*ba,2,[])); +isequal(LHS, RHS); % Gives 1. Confirmed by Nike on 2022 September 8 + +% Example section + +LHS=min(reshape(-2.*b1.*b2.*b3.*b4.*b5.*b6+b5.*b6,2,[])); +RHSa=min(reshape(2.*(b1+b2+b3+b4+b5-(b1+b2+b3+b4+b5).*b6-(b1+b2+b3+b4+b5+b6).*ba+(6-1).*b6.*ba) + b5.*b6,2,[])); % Quadratized using Eq. in summary section % Gives 1. Confirmed by Nike on 2022 September 8 +RHSb=min(reshape(2.*((6-1)*b6.*ba-((b1+b2+b3+b4+b5+b6).*(ba+b6-1)))+b5.*b6, 2, [])); % Quadratized using first "Alternative" Eq. % Gives 1. Confirmed by Nike on 2022 September 8 +RHSc=min(reshape(2.*((6-2)*b6.*ba-(b1.*(ba+b6-1)+b2.*(ba+b6-1)+b3.*(ba+b6-1)+b4.*(ba+b6-1)+b5.*(ba+b6-1)))+b6.*b5, 2, [] )); % Quadratized using second "Alternative" Eq. % Gives 1. Confirmed by Nike on 2022 September 8 +isequal(LHS, RHSa, RHSb, RHSc); + +% Alternatives section (alternative #1): + +LHS=min(reshape(-b1.*b2.*b3.*b4.*b5.*b6,2,[])); +RHS=min(reshape((6-1)*b6.*ba-((b1+b2+b3+b4+b5+b6).*(ba+b6-1)), 2, [])); +isequal(LHS,RHS); % Gives 1. Confirmed by Nike on 2022 September 8 + +% Alternatives section (alternative #2): + +LHS=min(reshape(-b1.*b2.*b3.*b4.*b5.*b6,2,[])); +RHS=min(reshape((6-2)*b6.*ba-((b1+b2+b3+b4+b5).*(ba+b6-1)), 2, [] )); +isequal(LHS,RHS); % Gives 1. Confirmed by Nike on 2022 September 8 + %% Pg. 12, NTR-ABCG-2 Eq. 34 needs a quadratized version of the equation to be added b = dec2bin(2^7-1:-1:0)-'0'; b1=b(:,1);b2=b(:,2);b3=b(:,3);b4=b(:,4);b5=b(:,5);b6=b(:,6);ba=b(:,7);