% How to run Algorithm BB to solve an instance of problem (QBL):
% minimize    0.5*x'*Q0*x-b0'*x
% subject to  0.5*x'*x-b2'*x+0.5*c2<=0,
%                               A*x<=b.
% ----------------------------------------------------------
% The input should contain A,b,Q0,b0,b2,c2, where
% Q0 is a symmetric matrix in S^n,
% b0,b2 in R^n,
% c2 in R,
% A in R^{mxn},
% b in R^m.
% ----------------------------------------------------------
% n is the dimension, i.e., the variable x is in R^n,
% m is the number of linear constraints of the form ai'*x<=bi.
% ----------------------------------------------------------
% Optional input - determining the two input parameters N and gap:
% N - number of nodes allowed to develop (the algorithm will stop after
%     evaluating N-1 nodes if N is even, or N if odd). default: inf.
% gap - the difference allowed between U (upper bound on the optimal value)
%       and Lb (lower bound) in the final output solution. default: 0.
% The algorithm will stop when the best solution so far reaches 
% a value U with U-Lb<gap, or when N nodes are evaluated. 
% Otherwise it will stop when no open nodes remain.
% ----------------------------------------------------------
% To run Algorithm BB without an ordering heuristics (nH):
% 1. Load the input into the workspace
% 2. Run the command 
%       >> [U,cur_sol,nn,Lb,status]=BB_QBL(A,b,Q0,b0,b2,c2,N,gap)
% Omitting the last two inputs will determine default values N=inf, gap=0.
%       >> [U,cur_sol,nn,Lb,status]=BB_QBL(A,b,Q0,b0,b2,c2)
%       >> [U,cur_sol,nn,Lb,status]=BB_QBL(A,b,Q0,b0,b2,c2,[],gap)
%       >> [U,cur_sol,nn,Lb,status]=BB_QBL(A,b,Q0,b0,b2,c2,N)
% ----------------------------------------------------------
% To run Algorithm BB with an ordering heuristics (H):
% 1. Load the input into the workspace
% 2. Run the command 
%       >> [U,cur_sol,nn,Lb,status]=BB_QBL_Heur(A,b,Q0,b0,b2,c2,N,gap)
% Omitting the last two inputs will determine default values N=inf, gap=0.
%       >> [U,cur_sol,nn,Lb,status]=BB_QBL_Heur(A,b,Q0,b0,b2,c2,N,gap)
%       >> [U,cur_sol,nn,Lb,status]=BB_QBL_Heur(A,b,Q0,b0,b2,c2,[],gap)
%       >> [U,cur_sol,nn,Lb,status]=BB_QBL_Heur(A,b,Q0,b0,b2,c2,N)
% ----------------------------------------------------------
% Output:
% U - optimal value (or the best found upper bound if not fully solved)
% cur_sol - optimal solution (or best solution found so far)
% nn - number of nodes evaluated
% Lb - the best lower bound found (min of L values on the deepest layer of
% nodes opened so far).
% status -  
% '0'   == 'solved to optimum'
% 'inf' == 'infeasible' 
% '1'   == 'solved up to the given gap'
% '2'   == 'solved up to a larger gap (due to reaching N developed nodes)'
% '3'   == 'did not find a feasible solution till reached N nodes'. 
% ----------------------------------------------------------
