This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

A Two-Phase Method for Solving Continuous Rank-One Quadratic Knapsack Problems

Sayyed Ehsan Monabbati [email protected] Department of Mathematics, Faculty of Mathematical Sciences, Alzahra University, Tehran, Iran
Abstract

In this paper, we propose a two-phase algorithm for solving continuous rank-one quadratic knapsack problems (R1QKP). In particular, we study the solution structure of the problem without the knapsack constraint. We propose an O(nlogn)O(n\log n) algorithm in this case. We then use the solution structure to propose an O(n2logn)O(n^{2}\log n) algorithm that finds an interval containing the optimal value of the Lagrangian dual of R1QKP. In the second phase, we solve the restricted Lagrangian dual problem using a traditional single-variable optimization method. We perform a computational test on random instances and compare our algorithm with the general solver CPLEX.

keywords:
Quadratic Knapsack Problem , Line-Sweep Algorithm
journal:
\DeclareNewFootnote

B[alph]

1 Introduction

The quadratic knapsack problem (QKP) deals with minimizing a quadratic function over one allocation constraint together with simple bounds on decision variables. Formally, this problem can be written as to

minimize\displaystyle\operatorname{minimize}\quad 12xQxcx,\displaystyle\frac{1}{2}x^{\top}Qx-c^{\top}x, (1a)
subjectto\displaystyle\operatorname{subject\;to}\quad ax=b,\displaystyle a^{\top}x=b, (1b)
0xu,\displaystyle 0\leq x\leq u, (1c)

where QQ is a symmetric n×nn\times n matrix, a,c,l,una,c,l,u\in\mathbb{R}^{n} and bb\in\mathbb{R}. QKP as a quadratic optimization problem is polynomially solvable when QQ is positive definite matrix [12]. When QQ is diagonal with strictly positive diagonal entries QKP can be viewed as a strictly convex separable optimization problem that has many applications (e.g. resource allocation [14, 13, 2] and multicommodity network flows [9]). The solution methods for solving this type of QKPs usually rely on the fact that the optimal solution of the Lagrangian dual subproblems can be explicitly obtained in terms of the Lagrange multiplier λ\lambda of (1b). Therefore the problem reduces to find a value for λ\lambda such that the solution of the corresponding Lagrangian subproblem is satisfied in equality constraint (1b). The resulting equation is solved by different methods. Helgason et. al [9] propose an O(nlogn)O(n\log n) algorithm for solving the equation based on searching breakpoints of the Lagrangian dual problem. Brucker [3] finds an O(n)O(n) bisection algorithm based on the properties of the Lagrangian dual function. Dai and Fletcher [5] propose a two-phase method; A bracketing phase that determines an interval containing the solution followed by the secant phase that approximates the solution within the promising interval. This method is modified by Comminetti et. al [4] with ignoring the bracketing phase and using a semi-smooth Newton method instead of the secant method. Liu and Yong-Jin [11] consider a special case of the strictly convex form of the problem. They find the solution structure of the subproblems and use it in a modified secant algorithm.

Robinson et. al [15] use the geometric interpretation of the problem and propose an algorithm that works in the primal space rather than the dual space. This algorithm iteratively fixes variables and terminates after at most nn iterations.

In a more general case, when QQ is positive semidefinite in (1), Dussault et. al [7] propose an iterative algorithm in which a QKP with diagonal QQ should be solved in each iteration. Paradalos et. al [12] suggest a potential reduction algorithm to solve this class of QKP. di Serafino et. al [6] propose a two-phase gradient projection that has acceptable numerical performance in comparison with similar gradient-based methods.

QKPs with positive definite QQ are also solved by a gradient projection method [5], and an augmented-Lagrangian approach [8].

In this paper, we suppose QQ is a rank one symmetric matrix, that is Q=qqQ=qq^{\top} for some qnq\in\mathbb{R}^{n}. Moreover, we assume that 0<u0<u. Without loss of generality we assume that qi0q_{i}\neq 0 for each ii. By the following change of variables

xiqixi,ciciqi,aiaiqi,limin{0,qiui},uimax{0,qiui},\displaystyle x_{i}\leftarrow q_{i}x_{i},\quad c_{i}\leftarrow\frac{c_{i}}{q_{i}},\quad a_{i}\leftarrow\frac{a_{i}}{q_{i}},\quad l_{i}\leftarrow\min\{0,q_{i}u_{i}\},\quad u_{i}\leftarrow\max\{0,q_{i}u_{i}\},

problem (1) is reduced to

minimize\displaystyle\operatorname{minimize}\quad 12(𝟏x)2cx,\displaystyle\frac{1}{2}({\boldsymbol{1}}^{\top}x)^{2}-c^{\top}x, (2a)
subjectto\displaystyle\operatorname{subject\;to}\quad ax=b,\displaystyle a^{\top}x=b, (2b)
0xu.\displaystyle 0\leq x\leq u. (2c)

Sharkey et. al [16] study a class of nonseparable nonlinear knapsack problems in which one has to

minimize\displaystyle\operatorname{minimize} g(sx)cx,\displaystyle g(s^{\top}x)-c^{\top}x, (3)
subjectto\displaystyle\operatorname{subject\;to} ax=b,\displaystyle a^{\top}x=b,
lxu,\displaystyle l\leq x\leq u,

where g:g:\mathbb{R}\to\mathbb{R} is an arbitrary real-valued function, and sns\in\mathbb{R}^{n} is given. They introduce an algorithm for solving (3) that runs in O(n2max{logn,ϕ})O(n^{2}\max\{\log n,\phi\}), where ϕ\phi is the time required to solve a single-variable optimization problem min{g(S)αS:LSU}\min\{g(S)-\alpha S\;:\;L\leq S\leq U\} for given α,L,U\alpha,L,U\in\mathbb{R}. With g(t)=t2g(t)=t^{2} and ss equals to the all-one vector, problem (2) is a special case of problem (3). That is, there exists an O(n2max{logn,1})=O(n2logn)O(n^{2}\max\{\log n,1\})=O(n^{2}\log n) algorithm for solving problem (2).

In this paper, we propose a two-phase algorithm for problem (2). In section 2 we study the solution structure of the bounded version of the problem in which the equality constraint (2b) is omitted. We show that the bounded version could be solved in O(nlogn)O(n\log n) time. In section 3, in phase I, we use the solution structure of the bounded version to find an interval that may contain the optimal value of the Lagrangian dual function. This is done in O(n2logn)O(n^{2}\log n) time in the worst case. Then, we perform phase II, in which we explore the interval by a single-variable optimization method to find the optimal Lagrangian multiplier with desired precision. In section 4, we perform a computational test. In particular, we compare the algorithm with the general quadratic programming solver CPLEX.

2 Solution structure of the bounded version

In this section we consider the following bounded version of the problem

minimize\displaystyle\operatorname{minimize}\quad f(x)=12(𝟏x)2cx,\displaystyle f(x)=\frac{1}{2}({\boldsymbol{1}}^{\top}x)^{2}-c^{\top}x, (4a)
subjectto\displaystyle\operatorname{subject\;to}\quad 0xu.\displaystyle 0\leq x\leq u. (4b)

We propose a characterization of the solution in the primal space. Note that most of algorithms for such problems use the so-called KKT conditions to study the solution structure. Without loss of generality, we assume that c1c2cn0c_{1}\geq c_{2}\geq\cdots\geq c_{n}\geq 0, and li=0l_{i}=0, i=1,,ni=1,\cdots,n. Given two vectors a,bna,b\in\mathbb{R}^{n}, we denote the set {x:axb}\{x\;:\;a\leq x\leq b\} by [a,b][a,b]. Finally, given vector unu\in\mathbb{R}^{n} we define Uk=i=1kuiU_{k}=\sum_{i=1}^{k}u_{i} for k=1,,nk=1,\cdots,n, and U0=0U_{0}=0.

We begin with preliminary lemmas.

Lemma 2.1.

For k=1,,nk=1,\cdots,n define x(k)x^{(k)} as

xi(k)={ui,i=1,,k,0,i=k+1,,n,\displaystyle x_{i}^{(k)}=\begin{cases}u_{i},&i=1,\dots,k,\\ 0,&i=k+1,\dots,n,\end{cases}

and x(0)x^{(0)} as the all-zero vector, and, define GkG_{k} as

Gk=12(Uk+Uk1)ck=Uk1+12ukck.G_{k}=\frac{1}{2}\left(U_{k}+U_{k-1}\right)-c_{k}=U_{k-1}+\frac{1}{2}u_{k}-c_{k}.

Then the following assertions hold

  1. 1.

    If n¯\bar{n} is the smallest index in {1,,n}\{1,\cdots,n\} such that Gn¯0G_{\bar{n}}\geq 0 then mini=1,,nf(x(i))=f(x(n¯1))\min_{i=1,\cdots,n}f(x^{(i)})=f(x^{(\bar{n}-1)}).

  2. 2.

    If Gk<0G_{k}<0 for all k=1,,n1k=1,\cdots,n-1 then mini=1,,nf(x(i))=f(x(n))\min_{i=1,\cdots,n}f(x^{(i)})=f(x^{(n)}).

Proof.

(1) For 1kn11\leq k\leq n-1 we have

GkGk+1\displaystyle G_{k}-G_{k+1} =12(Uk+Uk1)ck12(Uk+1+Uk)+ck+1\displaystyle=\frac{1}{2}\left(U_{k}+U_{k-1}\right)-c_{k}-\frac{1}{2}\left(U_{k+1}+U_{k}\right)+c_{k+1}
=12(uk+uk+1)+(ck+1ck)\displaystyle=-\frac{1}{2}\left(u_{k}+u_{k+1}\right)+(c_{k+1}-c_{k})
<0\displaystyle<0\cdot

Thus

G1<G2<<Gn¯1<0Gn¯<Gn¯+1<<Gn.G_{1}<G_{2}<\cdots<G_{\bar{n}-1}<0\leq G_{\bar{n}}<G_{\bar{n}+1}<\cdots<G_{n}.

On the other hand, for 1kn11\leq k\leq n-1 we have

f(x(k+1))f(x(k))\displaystyle f(x^{(k+1)})-f(x^{(k)}) =12Uk+12i=1k+1uici12Uk2+i=1kuici\displaystyle=\frac{1}{2}U_{k+1}^{2}-\sum_{i=1}^{k+1}u_{i}c_{i}-\frac{1}{2}U_{k}^{2}+\sum_{i=1}^{k}u_{i}c_{i} (5)
=12Uk+12uk+1ck+112Uk2\displaystyle=\frac{1}{2}U_{k+1}^{2}-u_{k+1}c_{k+1}-\frac{1}{2}U_{k}^{2}
=12(Uk+12Uk2)uk+1ck+1\displaystyle=\frac{1}{2}(U_{k+1}^{2}-U_{k}^{2})-u_{k+1}c_{k+1}
=12(Uk+1Uk)(Uk+1+Uk)uk+1ck+1\displaystyle=\frac{1}{2}(U_{k+1}-U_{k})(U_{k+1}+U_{k})-u_{k+1}c_{k+1}
=uk+1(12(Uk+1+Uk)ck+1)\displaystyle=u_{k+1}\left(\frac{1}{2}(U_{k+1}+U_{k})-c_{k+1}\right)
=uk+1Gk+1.\displaystyle=u_{k+1}G_{k+1}.

Now let m>n¯1m>\bar{n}-1. Then

f(x(m))f(x(n¯1))\displaystyle f(x^{(m)})-f(x^{(\bar{n}-1)}) =f(x(m))f(x(m1))+f(x(m1))++f(x(n¯))f(x(n¯1))\displaystyle=f(x^{(m)})-f(x^{(m-1)})+f(x^{(m-1)})+\cdots+f(x^{(\bar{n})})-f(x^{(\bar{n}-1)})
=umGm++un¯Gn¯>Gn¯(um++un¯+1)\displaystyle=u_{m}G_{m}+\cdots+u_{\bar{n}}G_{\bar{n}}>G_{\bar{n}}(u_{m}+\cdots+u_{\bar{n}+1})
>0.\displaystyle>0.

Similarly, if m<n¯1m<\bar{n}-1, then we have f(x(m))f(x(n¯1))>0f(x^{(m)})-f(x^{(\bar{n}-1)})>0.

(2) The second part can be easily proved considering (5). ∎

We need the following result about two-dimensional version of problem (4).

Lemma 2.2.

Consider the following optimization problem

minimize\displaystyle\operatorname{minimize} f(x1,x2)=12(x1+x2)2c1x1c2x2,\displaystyle f(x_{1},x_{2})=\frac{1}{2}(x_{1}+x_{2})^{2}-c_{1}x_{1}-c_{2}x_{2}, (6)
subjectto\displaystyle\operatorname{subject\;to} 0x1u1,\displaystyle 0\leq x_{1}\leq u_{1},
0x2u2,\displaystyle 0\leq x_{2}\leq u_{2},

where c1c20c_{1}\geq c_{2}\geq 0 and u1u_{1} and u2u_{2} are real constants. Define set I=I1I2I=I_{1}\cup I_{2} where I1={(u1,x2): 0x2u2}I_{1}=\{(u_{1},x_{2})\;:\;0\leq x_{2}\leq u_{2}\} and I2={(x1,0): 0x1u1}I_{2}=\{(x_{1},0)\;:\;0\leq x_{1}\leq u_{1}\}. Then, problem (6) has no optimal solution outside of II.

Proof.

If c1=c2c_{1}=c_{2}, then f(x1,x2)=12(x1+x2)2c1(x1+x2)=12z2c1z=g(z)f(x_{1},x_{2})=\frac{1}{2}(x_{1}+x_{2})^{2}-c_{1}(x_{1}+x_{2})=\frac{1}{2}z^{2}-c_{1}z=g(z) where z=x1+x2z=x_{1}+x_{2}. It is easy to see that x=(x1,x2)x^{\ast}=(x_{1}^{\ast},x_{2}^{\ast}) with x1=min{c1,u1}x_{1}^{\ast}=\min\{c_{1},u_{1}\} and x2=min{c1x1,u2}x_{2}^{\ast}=\min\{c_{1}-x_{1}^{\ast},u_{2}\} is the optimal solution of the problem, and we have xIx^{\ast}\in I. Assume that c1c2c_{1}\neq c_{2}. The feasible region of (6) is equal to I1I2I3I4I_{1}\cup I_{2}\cup I_{3}\cup I_{4} where I3={(x1,x2): 0<x1<u1,0<x2<u2}I_{3}=\{(x_{1},x_{2})\;:\;0<x_{1}<u_{1},0<x_{2}<u_{2}\} and I4={(0,x2): 0<x2<u2}{(x1,u2): 0<x1<u1}I_{4}=\{(0,x_{2})\;:\;0<x_{2}<u_{2}\}\cup\{(x_{1},u_{2})\;:\;0<x_{1}<u_{1}\}. We show that there is no optimal solution in I3I_{3} and I4I_{4}. Indeed, we write the KKT optimality conditions as follows

x1+x2c1+α1α2=0,\displaystyle x_{1}+x_{2}-c_{1}+\alpha_{1}-\alpha_{2}=0, (7)
x1+x2c2+β1β2=0,\displaystyle x_{1}+x_{2}-c_{2}+\beta_{1}-\beta_{2}=0, (8)
α1(x1u1)=0,α2x1=0,\displaystyle\alpha_{1}(x_{1}-u_{1})=0,\quad\alpha_{2}x_{1}=0, (9)
β1(x2u2)=0,β2x2=0,\displaystyle\beta_{1}(x_{2}-u_{2})=0,\quad\beta_{2}x_{2}=0, (10)
0x1u1,\displaystyle 0\leq x_{1}\leq u_{1}, (11)
0x2u2,\displaystyle 0\leq x_{2}\leq u_{2}, (12)
α1,α2,β1,β20,\displaystyle\alpha_{1},\alpha_{2},\beta_{1},\beta_{2}\geq 0, (13)

where αi\alpha_{i} and βi\beta_{i}, i=1,2i=1,2 are KKT multipliers corresponding to the bound constraints. If (x1,x2)I3(x_{1},x_{2})\in I_{3} then from (9) and (10) we have α1=α2=β1=β2=0\alpha_{1}=\alpha_{2}=\beta_{1}=\beta_{2}=0. Substituting these values in (7) and (8) implies that c1=c2c_{1}=c_{2} which contradicts our assumption. On the other hand, if (x1,x2)I4(x_{1},x_{2})\in I_{4} and x1=0x_{1}=0, then we have α1=0\alpha_{1}=0. Now, (7) implies that x2=c1+α2<0x_{2}=c_{1}+\alpha_{2}<0. Thus β2=0\beta_{2}=0. From (8) we have x2=c2β1x_{2}=c_{2}-\beta_{1}. Therefore, c2=c1+α2+β1c1c_{2}=c_{1}+\alpha_{2}+\beta_{1}\geq c_{1}. This contradicts our assumption on cic_{i}s. That is, problem (6) has no optimal solution with x1=0x_{1}=0. By similar argument one can conclude that (6) has no solution with x2=u2x_{2}=u_{2}. This completes the proof. ∎

Theorem 2.3.

Suppose x(k)x^{(k)} and GkG_{k}, k=1,,nk=1,\cdots,n and n¯\bar{n} are defined as in Lemma 2.1. Then the following assertions hold

  1. 1.

    If n¯>1\bar{n}>1, then define δ1,δ2\delta_{1},\delta_{2} as δ1=min{cn¯1Un¯2,un¯1}\delta_{1}=\min\left\{c_{\bar{n}-1}-U_{\bar{n}-2},u_{\bar{n}-1}\right\} and δ2=max{cn¯Un¯1,0}\delta_{2}=\max\left\{c_{\bar{n}}-U_{\bar{n}-1},0\right\}. Also, define x¯\bar{x}, x~\tilde{x} as

    x¯=x(n¯2)+δ1en¯1,x~=x(n¯1)+δ2en¯,\bar{x}=x^{(\bar{n}-2)}+\delta_{1}e_{\bar{n}-1},\quad\tilde{x}=x^{(\bar{n}-1)}+\delta_{2}e_{\bar{n}},

    where eie_{i} is the iith column of the identity matrix of dimension nn. Then min{f(x¯),f(x~)}\min\{f(\bar{x}),f(\tilde{x})\} is the optimal value of the following optimization problem

    minimize\displaystyle\operatorname{minimize} f(x),\displaystyle f(x), (14)
    subjectto\displaystyle\operatorname{subject\;to} x(n¯2)xx(n¯).\displaystyle x^{(\bar{n}-2)}\leq x\leq x^{(\bar{n})}.
  2. 2.

    If n¯=1\bar{n}=1, then define δ=min{c1,u1}\delta=\min\{c_{1},u_{1}\}. Also define x~=δe1\tilde{x}=\delta e_{1}. Then f(x~)f(\tilde{x}) is the optimal value of the following optimization problem

    minimize\displaystyle\operatorname{minimize} f(x),\displaystyle f(x),
    subjectto\displaystyle\operatorname{subject\;to} x(0)xx(1).\displaystyle x^{(0)}\leq x\leq x^{(1)}.
  3. 3.

    if Gk<0G_{k}<0 for all k=1,,nk=1,\cdots,n, then define δ=min{cnUn1,un}\delta=\min\{c_{n}-U_{n-1},u_{n}\}. Also define x~=x(n1)+δen\tilde{x}=x^{(n-1)}+\delta e_{n}. Then f(x~)f(\tilde{x}) is the optimal value of the following optimization problem

    minimize\displaystyle\operatorname{minimize} f(x),\displaystyle f(x),
    subjectto\displaystyle\operatorname{subject\;to} x(n1)xx(n).\displaystyle x^{(n-1)}\leq x\leq x^{(n)}.
Proof.

(1) By Lemma 2.2 we can partition the optimal solution set as I1I2I_{1}\cup I_{2} where I1=[x(n¯2),x(n¯1)]I_{1}=[x^{(\bar{n}-2)},x^{(\bar{n}-1)}] and I2=[x(n¯1),x(n¯)]I_{2}=[x^{(\bar{n}-1)},x^{(\bar{n})}]. We show that f(x¯)=min{f(x):xI1}f(\bar{x})=\min\{f(x):x\in I_{1}\} and f(x~)=min{f(x):xI2}f(\tilde{x})=\min\{f(x):x\in I_{2}\}. Indeed, we use a simple technique of single-variable calculus. Let xI1x\in I_{1}, then x=x(δ)x=x(\delta), for some δ[0,un¯1]\delta\in[0,u_{\bar{n}-1}], where x(δ)=x(n¯2)+δen¯1x(\delta)=x^{(\bar{n}-2)}+\delta e_{\bar{n}-1}. Thus the problem min{f(x):xI1}\min\{f(x):x\in I_{1}\} reduces to min{f(x(δ)):0δun¯1}\min\{f(x(\delta)):0\leq\delta\leq u_{\bar{n}-1}\}. On the other hand, one can write

f(x(δ))=12(Un¯2+δ)2i=1n¯2ciuicn¯1δ.f(x(\delta))=\frac{1}{2}\left(U_{\bar{n}-2}+\delta\right)^{2}-\sum_{i=1}^{\bar{n}-2}c_{i}u_{i}-c_{\bar{n}-1}\delta.

We have df(x(δ))/dδ=Un¯2+δcn¯1df(x(\delta))/d\delta=U_{\bar{n}-2}+\delta-c_{\bar{n}-1}. Thus df(x(δ))/dδ=0df(x(\delta))/d\delta=0 only if δ=δ=cn¯1Un¯2\delta=\delta^{\prime}=c_{\bar{n}-1}-U_{\bar{n}-2}. Since d2f(x(δ))/dδ2>0d^{2}f(x(\delta))/d\delta^{2}>0 and δ>12un¯1\delta^{\prime}>\frac{1}{2}u_{\bar{n}-1} the optimal value is achieved at δ1\delta_{1}.

To prove f(x~)=min{f(x):xI2}f(\tilde{x})=\min\{f(x):x\in I_{2}\}, by the same argument as the previous paragraph, it suffices to solve single optimization problem min{f(x(δ)):0δun¯}\min\{f(x(\delta)):0\leq\delta\leq u_{\bar{n}}\}, where x(δ)=x(n¯1)+δen¯x(\delta)=x^{(\bar{n}-1)}+\delta e_{\bar{n}}. It is easy to see that if δ=δ=cn¯Un¯1\delta=\delta^{\prime}=c_{\bar{n}}-U_{\bar{n}-1} then df(x(δ))/dδ=0df(x(\delta))/d\delta=0. Since δ12un¯\delta^{\prime}\leq\frac{1}{2}u_{\bar{n}}, by definition of n¯\bar{n}, then f(x~)f(\tilde{x}) is the optimal value of min{f(x):xI2}\min\{f(x):x\in I_{2}\}.

The proof of parts (2) and (3) is similar. ∎

The following Corollary 2.4 states simple conditions under which the optimal solution of the problem in Theorem 2.3(1) is x¯\bar{x} or x~\tilde{x}.

Corollary 2.4.

In Theorem 2.3(1),

  1. 1.

    if δ1=un¯1\delta_{1}=u_{\bar{n}-1} then min{f(x¯),f(x~)}=f(x~)\min\{f(\bar{x}),f(\tilde{x})\}=f(\tilde{x}), and,

  2. 2.

    if δ2=0\delta_{2}=0 then min{f(x¯),f(x~)}=f(x¯)\min\{f(\bar{x}),f(\tilde{x})\}=f(\bar{x}).

Proof.

For brevity, we just prove part (1). The proof of the second part is similar. Under the assumption of part (1), we have

f(x¯)f(x~)=12Un¯12i=1n¯1ciui12cn¯2+i=1n¯1ciui+cn¯(cn¯Un¯1)=12(Un¯1cn¯)20.f(\bar{x})-f(\tilde{x})=\frac{1}{2}U_{\bar{n}-1}^{2}-\sum_{i=1}^{\bar{n}-1}c_{i}u_{i}-\frac{1}{2}c_{\bar{n}}^{2}+\sum_{i=1}^{\bar{n}-1}c_{i}u_{i}+c_{\bar{n}}(c_{\bar{n}}-U_{\bar{n}-1})=\frac{1}{2}\left(U_{\bar{n}-1}-c_{\bar{n}}\right)^{2}\geq 0.

Theorem 2.3 solves a restricted version of problem (2). In the following theorem, we show that the solution of the restricted version is the solution of the original problem.

Theorem 2.5.

Define GkG_{k}’s, x(k)x^{(k)}’s, n¯\bar{n}, x¯\bar{x} and x~\tilde{x} as in Theorem 2.3. Then, the following assertions hold

  1. 1.

    If 1<n¯n1<\bar{n}\leq n, then min{f(x¯),f(x~)}\min\{f(\bar{x}),f(\tilde{x})\} is the optimal value of (4), where x~\tilde{x} and x¯\bar{x} are defined as in Theorem 2.3(1).

  2. 2.

    If n¯=1\bar{n}=1, then f(x~)f(\tilde{x}) is the optimal value of (4), where x~\tilde{x} is defined as in Theorem 2.3(2).

  3. 3.

    If Gk<0G_{k}<0 for all k=1,,nk=1,\cdots,n, then f(x~)f(\tilde{x}) is the optimal solution of (4), where x~=x(n1)+δen\tilde{x}=x^{(n-1)}+\delta^{\prime}e_{n}, and δ=min{cnUn1,un}\delta^{\prime}=\min\{c_{n}-U_{n-1},u_{n}\}.

Proof.

For two vectors x,znx,z\in\mathbb{R}^{n} we have

f(z)f(x)\displaystyle f(z)-f(x) =12(𝟏z+𝟏x)(𝟏z𝟏x)c(zx).\displaystyle=\frac{1}{2}({\boldsymbol{1}}^{\top}z+{\boldsymbol{1}}^{\top}x)({\boldsymbol{1}}^{\top}z-{\boldsymbol{1}}^{\top}x)-c^{\top}(z-x). (15)

Let xx be a feasible solution of (4). If x=u=x(n)x=u=x^{(n)}, then from the definition of n¯\bar{n} we have f(xn¯1)f(x)f(x^{\bar{n}-1})\leq f(x), and the result follows from Theorem 2.3. Suppose xux\neq u. We show there exists a specially structured feasible solution xx^{\prime} that is better than xx. Indeed, let kk be such that

Uk𝟏x<Uk+1.U_{k}\leq{\boldsymbol{1}}^{\top}x<U_{k+1}.

Define vector xx^{\prime} by

xi={ui,i=1,,k,𝟏xUk,i=k+1,0,i=k+2,,n.x^{\prime}_{i}=\begin{cases}u_{i},&i=1,\cdots,k,\\ {\boldsymbol{1}}^{\top}x-U_{k},&i=k+1,\\ 0,&i=k+2,\cdots,n.\end{cases}

Then, clearly xx^{\prime} is feasible for (4) and

𝟏x=i=1kxi+xk+1+i=k+2nxi=i=1kui+i=1nxii=1kui=𝟏x.\displaystyle{\boldsymbol{1}}^{\top}x^{\prime}=\sum_{i=1}^{k}x^{\prime}_{i}+x^{\prime}_{k+1}+\sum_{i=k+2}^{n}x^{\prime}_{i}=\sum_{i=1}^{k}u_{i}+\sum_{i=1}^{n}x_{i}-\sum_{i=1}^{k}u_{i}={\boldsymbol{1}}^{\top}x.

Moreover we have

cx\displaystyle c^{\top}x^{\prime} =i=1kuici+ck+1xk+1=i=1kuici+ck+1i=1nxick+1i=1kui\displaystyle=\sum_{i=1}^{k}u_{i}c_{i}+c_{k+1}x^{\prime}_{k+1}=\sum_{i=1}^{k}u_{i}c_{i}+c_{k+1}\sum_{i=1}^{n}x_{i}-c_{k+1}\sum_{i=1}^{k}u_{i}
=i=1kuici+ck+1i=1kxi+ck+1i=k+1nxick+1i=1kui\displaystyle=\sum_{i=1}^{k}u_{i}c_{i}+c_{k+1}\sum_{i=1}^{k}x_{i}+c_{k+1}\sum_{i=k+1}^{n}x_{i}-c_{k+1}\sum_{i=1}^{k}u_{i}
i=1kuici+i=1k(xiui)ci+i=k+1nxici\displaystyle\geq\sum_{i=1}^{k}u_{i}c_{i}+\sum_{i=1}^{k}(x_{i}-u_{i})c_{i}+\sum_{i=k+1}^{n}x_{i}c_{i} (by monotonicity of cic_{i}’s)
=cx.\displaystyle=c^{\top}x.

Therefor, (15) implies that f(x)f(x)=c(xx)0f(x^{\prime})-f(x)=-c^{\top}(x^{\prime}-x)\leq 0, i.e. f(x)f(x)f(x^{\prime})\leq f(x).

(1) Now, we consider three cases for index kk introduced in the definition of xx^{\prime}: kn¯k\geq\bar{n}, k<n¯2k<\bar{n}-2 and k=n¯1,n¯2k=\bar{n}-1,\bar{n}-2. In the latter case, we have x(n¯2)xx(n¯)x^{(\bar{n}-2)}\leq x^{\prime}\leq x^{(\bar{n})}, so the assertion is true by Theorem 2.3, since

min{f(x¯),f(x~)}=min{f(x):x[x(n¯2),x(n¯)]}f(x)f(x).\min\{f(\bar{x}),f(\tilde{x})\}=\min\{f(x)\;:\;x\in[x^{(\bar{n}-2)},x^{(\bar{n})}]\}\leq f(x^{\prime})\leq f(x).

We show in both the other cases there is a point in the set {x(i)}i=1,,n\{x^{(i)}\}_{i=1,\cdots,n} better than xx^{\prime}, that is f(x(i))f(x)f(x^{(i)})\leq f(x^{\prime}) for some i=1,,ni=1,\cdots,n. By Lemma 2.1, f(x(n¯1))f(x(i))f(x^{(\bar{n}-1)})\leq f(x^{(i)}) and the result follows by Theorem 2.3.

First, let kn¯k\geq\bar{n}. Then we have

f(x(k))f(x)\displaystyle f(x^{(k)})-f(x^{\prime}) =12(𝟏x(k)𝟏x)(𝟏x(k)+𝟏x)c(x(k)x)\displaystyle=\frac{1}{2}({\boldsymbol{1}}^{\top}x^{(k)}-{\boldsymbol{1}}^{\top}x^{\prime})({\boldsymbol{1}}^{\top}x^{(k)}+{\boldsymbol{1}}^{\top}x^{\prime})-c^{\top}(x^{(k)}-x^{\prime})
=12xk+1(2Uk+xk+1)+ck+1xk+1\displaystyle=-\frac{1}{2}x^{\prime}_{k+1}(2U_{k}+x^{\prime}_{k+1})+c_{k+1}x^{\prime}_{k+1}
=xk+1(12(2Uk+xk+1)ck+1).\displaystyle=-x^{\prime}_{k+1}\left(\frac{1}{2}(2U_{k}+x^{\prime}_{k+1})-c_{k+1}\right).

On the other hand, we have

2Uk+xk+1=2i=1n¯1ui+i=n¯kui+xk+1Un¯+Un¯1.2U_{k}+x^{\prime}_{k+1}=2\sum_{i=1}^{\bar{n}-1}u_{i}+\sum_{i=\bar{n}}^{k}u_{i}+x^{\prime}_{k+1}\geq U_{\bar{n}}+U_{\bar{n}-1}.

Therefor

12(2Uk+xk+1)ck+112(Un¯+Un¯1)cn¯=Gn¯0.\frac{1}{2}(2U_{k}+x^{\prime}_{k+1})-c_{k+1}\geq\frac{1}{2}(U_{\bar{n}}+U_{\bar{n}-1})-c_{\bar{n}}=G_{\bar{n}}\geq 0.

Thus f(x(k))f(x)f(x^{(k)})\leq f(x^{\prime}).

Now, let k<n¯2k<\bar{n}-2. Then

f(x(k+1))f(x)\displaystyle f(x^{(k+1)})-f(x^{\prime}) =12(𝟏x(k+1)𝟏x)(𝟏x(k+1)+𝟏x)c(x(k+1)x)\displaystyle=\frac{1}{2}({\boldsymbol{1}}^{\top}x^{(k+1)}-{\boldsymbol{1}}^{\top}x^{\prime})({\boldsymbol{1}}^{\top}x^{(k+1)}+{\boldsymbol{1}}^{\top}x^{\prime})-c^{\top}(x^{(k+1)}-x^{\prime})
=12(uk+1xk+1)(Uk+1+Uk+xk+1)ck+1(uk+1xk+1)\displaystyle=\frac{1}{2}(u_{k+1}-x^{\prime}_{k+1})(U_{k+1}+U_{k}+x^{\prime}_{k+1})-c_{k+1}(u_{k+1}-x^{\prime}_{k+1})
=(uk+1xk+1)(12(2Uk+xk+1+uk+1)ck+1).\displaystyle=(u_{k+1}-x^{\prime}_{k+1})\left(\frac{1}{2}(2U_{k}+x^{\prime}_{k+1}+u_{k+1})-c_{k+1}\right).

On the other hand, we have

2Uk+xk+1+uk+12Uk+2uk+12Uk+2i=k+1n¯2ui+un¯1=Un¯2+Un¯1.2U_{k}+x^{\prime}_{k+1}+u_{k+1}\leq 2U_{k}+2u_{k+1}\leq 2U_{k}+2\sum_{i=k+1}^{\bar{n}-2}u_{i}+u_{\bar{n}-1}=U_{\bar{n}-2}+U_{\bar{n}-1}.

Thus

12(2Uk+xk+1+uk+1)ck+112(Un¯2+Un¯1)cn¯1=Gn¯1<0.\frac{1}{2}(2U_{k}+x^{\prime}_{k+1}+u_{k+1})-c_{k+1}\leq\frac{1}{2}(U_{\bar{n}-2}+U_{\bar{n}-1})-c_{\bar{n}-1}=G_{\bar{n}-1}<0.

That is f(x(k+1))<f(x)f(x^{(k+1)})<f(x^{\prime}). Thus in both cases there exist a point x(t)x^{(t)}, say, such that f(x(t))f(x)f(x)f(x^{(t)})\leq f(x^{\prime})\leq f(x). Now, by Lemma 2.1, f(x(n¯1))f(x(t))f(x)f(x^{(\bar{n}-1)})\leq f(x^{(t)})\leq f(x) and the result follows by Theorem 2.3.

Proof of (2) Consider the possible values of kk at the beginning of the proof of part (1). Here, we just have kn¯=1k\geq\bar{n}=1. Now, similar argument for this case proves (2).

Proof of (3) Again consider the possible values of kk at the beginning of the proof of part (1). Similar argument with case k<n¯2k<\bar{n}-2 with n¯=n+1\bar{n}=n+1 proves part (3).

One can conclude the following result on the time needed to solve problem (4).

Theorem 2.6.

There exists an O(nlogn)O(n\log n) time algorithm for problem (4).

Proof.

Once the index n¯\bar{n} is determined the solution can be determined in O(n)O(n) time. We need O(nlogn)O(n\log n) to sort vector cc, O(n)O(n) to compute vector GG, and O(logn)O(\log n) to find index n¯\bar{n}. That is, problem (4) can be solved in O(nlogn)O(n\log n). ∎

3 The algorithm

Our algorithm consists of two phases: bounding the optimal solution, and, computing the optimal solution to the desired precision. The bounding phase is based on the Lagrangian dual of (2) and the solution structure of the bounded version described in section 2.

3.1 Lagrangian dual

Let λ\lambda be the Lagrange multiplier of equality constraint in (2). Then, the Lagrangian function is defined as

ϕ(λ)\displaystyle\phi(\lambda) =min{12(𝟏x)2cx+λ(bax): 0xu}\displaystyle=\min\left\{\frac{1}{2}({\boldsymbol{1}}^{\top}x)^{2}-c^{\top}x+\lambda(b-a^{\top}x)\;:\;0\leq x\leq u\right\} (16)
=λb+min{12(𝟏x)2(c+λa)x: 0xu}\displaystyle=\lambda b+\min\left\{\frac{1}{2}({\boldsymbol{1}}^{\top}x)^{2}-(c+\lambda a)^{\top}x\;:\;0\leq x\leq u\right\}

We have the following fact about the structure of the Lagrangian function ϕ\phi.

Theorem 3.7.

Given Lagrange multiplier λ\lambda, define n¯\bar{n} as in Theorem 2.5. If n¯>1\bar{n}>1, then we have

ϕ(λ)\displaystyle\phi(\lambda) =λb+fλ(x(n¯1)),if cn¯(λ)Un¯1cn¯1(λ),\displaystyle=\lambda b+f_{\lambda}(x^{(\bar{n}-1)}),\text{if }c_{\bar{n}}(\lambda)\leq U_{\bar{n}-1}\leq c_{\bar{n}-1}(\lambda), (Type A)
ϕ(λ)\displaystyle\phi(\lambda) =λb+pn¯(λ),if Un¯1cn¯(λ),\displaystyle=\lambda b+p_{\bar{n}}(\lambda),\text{if }U_{\bar{n}-1}\leq c_{\bar{n}}(\lambda), (Type B)
ϕ(λ)\displaystyle\phi(\lambda) =λb+pn¯1(λ),if Un¯1cn¯1(λ),\displaystyle=\lambda b+p_{\bar{n}-1}(\lambda),\text{if }U_{\bar{n}-1}\geq c_{\bar{n}-1}(\lambda), (Type C)

where fλf_{\lambda} is the objective function of the optimization part of (16), and,

pk(λ)\displaystyle p_{k}(\lambda) =12ak2λ2adkλ+12ck2cdk,\displaystyle=-\frac{1}{2}a_{k}^{2}\lambda^{2}-a^{\top}d_{k}\lambda+\frac{1}{2}c_{k}^{2}-c^{\top}d_{k},
dk\displaystyle d_{k} =x(k1)+(ckUk1)ek.\displaystyle=x^{(k-1)}+(c_{k}-U_{k-1})e_{k}.
Proof.

The proof is based on the four possible cases for δ1\delta_{1} and δ2\delta_{2} in Theorem 2.5. We just prove (Type A) and, for brevity, we omit the remaining parts.

Suppose that cn¯(λ)Un¯1cn¯1(λ)c_{\bar{n}}(\lambda)\leq U_{\bar{n}-1}\leq c_{\bar{n}-1}(\lambda). Then we have cn¯1(λ)Un¯2un¯1c_{\bar{n}-1}(\lambda)-U_{\bar{n}-2}\geq u_{\bar{n}-1} and cn¯(λ)Un¯10c_{\bar{n}}(\lambda)-U_{\bar{n}-1}\leq 0. Therefor the value of δ1\delta_{1} and δ2\delta_{2} in Theorem 2.5 can be determined as

δ1=min{cn¯1(λ)Un¯2,un¯1}=un¯1,δ2=max{cn¯(λ)Un¯1,0}=cn¯(λ)Un¯1.\delta_{1}=\min\{c_{\bar{n}-1}(\lambda)-U_{\bar{n}-2},u_{\bar{n}-1}\}=u_{\bar{n}-1},\qquad\delta_{2}=\max\{c_{\bar{n}}(\lambda)-U_{\bar{n}-1},0\}=c_{\bar{n}}(\lambda)-U_{\bar{n}-1}.

Thus we have x¯=x(n¯2)+δ1en¯1=x(n¯1)\bar{x}=x^{(\bar{n}-2)}+\delta_{1}e_{\bar{n}-1}=x^{(\bar{n}-1)}. Thus, by some simplifications we have fλ(x~)fλ(x¯)=12(cn¯(λ)Un¯1)20f_{\lambda}(\tilde{x})-f_{\lambda}(\bar{x})=\frac{1}{2}(c_{\bar{n}}(\lambda)-U_{\bar{n}-1})^{2}\geq 0. Now, by Theorem 2.5, we have min{fλ(x): 0xu}=min{f(x~),f(x¯}=fλ(x¯)=fλ(x(n¯1))\min\{f_{\lambda}(x)\;:\;0\leq x\leq u\}=\min\{f(\tilde{x}),f(\bar{x}\}=f_{\lambda}(\bar{x})=f_{\lambda}(x^{(\bar{n}-1)}). ∎

Now, one may conclude that if n¯\bar{n} is fixed on an interval [λa,λb][\lambda_{a},\lambda_{b}], then ϕ(λ)\phi(\lambda) is a piecewise function that contains exactly 33 pieces. However, the following simple example shows that this is not true.

Example 3.1.

Consider problem (2) with the following parameters

a=[75757],c=[544415870],\displaystyle a^{\top}=\begin{bmatrix}-7&-5&7&-5&7\end{bmatrix},\quad c^{\top}=\begin{bmatrix}54&44&15&-8&-70\end{bmatrix},
u=[6248368459].\displaystyle u^{\top}=\begin{bmatrix}62&48&36&84&59\end{bmatrix}.

In Figure 1 we plot ϕ(λ)\phi(\lambda) for λ[8.36,7.00]\lambda\in[-8.36,7.00]. We distinct three cases in (Type A), (Type B) and (Type C) with three colors blue, red and green, respectively. As it can be seen in the figure, ϕ(λ)\phi(\lambda) consists of 44 pieces.

Refer to caption
Figure 1: Plot of ϕ(λ)\phi(\lambda) for the problem of Example 3.1.

Inner optimization problem in (16) is a special case of problem (4), that can be solved by Theorem 2.5. In Theorem 2.5 it is assumed that coefficients of the linear term in the objective function is sorted in decreasing order. In problem (16), the order of coefficients of the linear term depends on λ\lambda. From now on, we denote by ci(λ)c_{i}(\lambda) the coefficient of xix_{i}, i.e. ci(λ)=ci+λaic_{i}(\lambda)=c_{i}+\lambda a_{i}. Moreover, we denote the line {ci(λ):λ}\{c_{i}(\lambda)\;:\;\lambda\in\mathbb{R}\} by i\ell_{i}. It is easy to see that, when λ\lambda becomes greater than the intersection of i\ell_{i} and j\ell_{j}, ci(λ)c_{i}(\lambda) and cj(λ)c_{j}(\lambda) change position in the ordered list of coefficients.

We use a modification of the well-known plane sweep algorithm to find the ordered intersection points of lines {i:i=1,,n}\{\ell_{i}\;:\;i=1,\cdots,n\}. Now, let λa\lambda_{a}, λ\lambda^{\prime} and λc\lambda_{c} are three consecutive intersection points, then because of the Lagrangian function is unimodal, the optimal Lagrange multiplier λ\lambda^{\ast} lies in the interval [λa,λb][\lambda_{a},\lambda_{b}] if ϕ(λ)>ϕ(λa)\phi(\lambda^{\prime})>\phi(\lambda_{a}) and ϕ(λ)>ϕ(λb)\phi(\lambda^{\prime})>\phi(\lambda_{b}).

We modify the implementation of the line-sweep algorithm proposed in [1]. In this algorithm, a vertical line \ell sweeps the plane from left to right. The status of the sweep line is the ordered sequence of lines that intersect it. The status initially contains all lines in the order of decreasing slope, that is the order of lines when they intersect with sweep line at λ=\lambda=-\infty. The status is updated when \ell reaches an intersecting point. For example, suppose that the sequence of four lines l\ell_{l}, i\ell_{i}, j\ell_{j}, and m\ell_{m} appears in the status when \ell reaches the intersection point of i\ell_{i} and j\ell_{j}. Then, i\ell_{i} and j\ell_{j} switch position and the intersection of lines i\ell_{i} and m\ell_{m} and the intersection of j\ell_{j} and l\ell_{l} are to be checked. The new detected intersection points are stored to proceed. The order of cost coefficient of the linear term in ϕ(λ)\phi(\lambda) is unchanged between two consecutive intersection points.

If ci(λ)<0c_{i}(\lambda)<0 for some ii, then xi=0x_{i}=0 in the optimal solution of the ϕ(λ)\phi(\lambda) subproblem. We introduce a set ZZ to store the non-vanished variables. To do so we add a dummy line 0:c0(λ)=0\ell_{0}:c_{0}(\lambda)=0. In each intersection of the dummy line and the other lines, the set ZZ should be updated. In fact, if i\ell_{i} intersect 0\ell_{0} and iZi\not\in Z, then we add ii to ZZ, otherwise, if iZi\in Z, then it should be removed from ZZ. In other words, since we sweep the plane from left to right, if i\ell_{i} intersect 0\ell_{0} and ai<0a_{i}<0, then we add ii to ZZ. If i\ell_{i} intersect 0\ell_{0} and ai>0a_{i}>0 then it means ii should be removed from ZZ. ZZ initially contains the set of all lines with a positive slope. With this modification, we guarantee that between two consecutive intersection points the set of zero-valued variables is unchanged. It should be noted here that lines with equal slopes are sorted based on increasing order of cic_{i}s. We summarize the algorithm in the following Algorithm 1. This algorithm is used as the first phase in the main algorithm.

Algorithm 1 A plane sweep algorithm for finding an interval containing the optimal solution of the Lagrangian dual problem.
1:  Input: vectors cc, aa and uu and scaler bb.
2:  Output: interval [λa,λb][\lambda_{a},\lambda_{b}] that contains the optimal solution of problem maxλϕ(λ)\max_{\lambda\in\mathbb{R}}\phi(\lambda) or the smallest and largest intersection points.
3:  Initialize state array, =[1,,n]\ell=[1,\cdots,n] , with lines [1],,[n]\ell[1],\cdots,\ell[n] sorted in decreasing order of slope.
4:  Initialize queue Q=Q=\emptyset.
5:  Initialize line indices array p=[1,,n]p=[1,\cdots,n].
6:  Fail \leftarrow true
7:  Insert intersection points of all adjacent lines into QQ.
8:  Set λprev\lambda^{\operatorname{prev}}\leftarrow-\infty, λprevprev\lambda^{\operatorname{prev}\operatorname{prev}}\leftarrow-\infty
9:  while QQ is not empty do
10:     Pop from QQ the current intersection point λnew\lambda^{\operatorname{new}} and the corresponding two adjacent lines [i]\ell[i] and [j]\ell[j].
11:     Update state array: [p[i]][p[j]]\ell[p[i]]\leftrightarrow\ell[p[j]].
12:     Update the line indices array: p[i]p[j]p[i]\leftrightarrow p[j].
13:     Insert the intersection point of [p[i]]\ell[p[i]] and [p[i]+1]\ell[p[i]+1] and the intersection point of [p[j]]\ell[p[j]] and [p[j]1]\ell[p[j]-1] into QQ, if there exists any.
14:     if ϕ(λprev)>ϕ(λprevprev)\phi(\lambda^{\operatorname{prev}})>\phi(\lambda^{\operatorname{prev}\operatorname{prev}}) and ϕ(λprev)>ϕ(λnew)\phi(\lambda^{\operatorname{prev}})>\phi(\lambda^{\operatorname{new}})  then
15:        Set Fail \leftarrow false
16:        return  [λprevprev,λnew][\lambda^{\operatorname{prev}\operatorname{prev}},\lambda^{\operatorname{new}}] as the promissing interval.
17:     end if
18:     Set λprevprevλprev\lambda^{\operatorname{prev}\operatorname{prev}}\leftarrow\lambda^{\operatorname{prev}}.
19:     Set λprevλnew\lambda^{\operatorname{prev}}\leftarrow\lambda^{\operatorname{new}}.
20:  end while
21:  if Fail then
22:     return  the smallest λLB\lambda_{LB} and the largest λUB\lambda_{UB} interseation points.
23:  end if
Theorem 3.8.

Algorithm 1 runs in O(n2logn)O(n^{2}\log n) time.

Proof.

Initializing state array \ell, line indices array pp and the queue QQ in steps 37 needs O(nlogn)O(n\log n) time. In each iteration we perform two main operations: computing the value of ϕ\phi for a new intersect point λnew\lambda^{\operatorname{new}} and updating QQ. The order of ci(λnew)c_{i}(\lambda^{\operatorname{new}}) and the vector GG can be updated from the previous intersection point in O(1)O(1) time. Finding n¯\bar{n} needs O(logn)O(\log n), using binary search. On the other hand, insertion and deletion on the priority queue QQ takes O(logn)O(\log n) since one can implement the priority queue by a heap to store the intersection points. Therefore each iteration of the main loop needs O(logn)O(\log n) time. Since there are O(n2)O(n^{2}) intersection points, the algorithm runs in O(n2logn)O(n^{2}\log n). ∎

Let λLB\lambda_{LB} and λUB\lambda_{UB} be the smallest and greatest intersection points of lines {i:i=1,,n}\{\ell_{i}\;:\;i=1,\cdots,n\}. The optimal solution of the Lagrangian problem may lie out of the interval [λLB,λUB][\lambda_{LB},\lambda_{UB}]. In this case, Algorithm 1 fails to find the optimal interval. So, we explore the outside of [λLB,λUB][\lambda_{LB},\lambda_{UB}] in a separate phase.

First consider the exploration of (,λLB)(-\infty,\lambda_{LB}). Since the components of vector GG in Theorem 2.5 are linear functions in term of λ\lambda, then there exists λLB<λLB\lambda^{\prime}_{LB}<\lambda_{LB} such that the order of GkG_{k}s does not change for λ<λLB\lambda<\lambda^{\prime}_{LB}. Indeed, a similar procedure for finding the smallest intersection of lines i\ell_{i}’s can be used here to compute λLB\lambda^{\prime}_{LB}. Now, since ϕ(λ)\phi(\lambda) is unimodal one can conclude that

max(,λLB]ϕ(λ)=max[λLB,λLB]ϕ(λ).\max_{(-\infty,\lambda_{LB}]}\phi(\lambda)=\max_{[\lambda^{\prime}_{LB},\lambda_{LB}]}\phi(\lambda). (17)

Similarly, for the values of λ\lambda greater than λUB\lambda_{UB}, one can find a threshold, say λUB\lambda^{\prime}_{UB}, such that

max[λUB,)ϕ(λ)=max[λUB,λUB]ϕ(λ).\max_{[\lambda_{UB},\infty)}\phi(\lambda)=\max_{[\lambda_{UB},\lambda^{\prime}_{UB}]}\phi(\lambda). (18)

We summarize the whole algorithm in Algorithm 2.

Algorithm 2 A two-phase algorithm for solving rank-one quadratic knapsack problem (2).
1:  Run Algorithm 1 to find a promising interval that contains the optimal Lagrange multiplier.
2:  if  Algorithm 1 returns an interval [λa,λb][\lambda_{a},\lambda_{b}]  then
3:      Solve optimization problem max[λa,λb]ϕ(λ)\max_{[\lambda_{a},\lambda_{b}]}\phi(\lambda) and return the optimal solution.
4:  else
5:     Solve optimization problems (17) and (18) and store the optimal values.
6:  end if
7:  return  the best λ\lambda found as an optimal Lagrange multiplier.

It is clear that Algorithm 2 converges to the optimal solution, since the output interval of Algorithm 1 contains the optimal solution and ϕ(λ)\phi(\lambda) is unimodal. In fact, the single variable optimization problem in step 3 can be solved efficiently by a classical root-finding algorithms.

4 Computational Experiments

In this section, we compare the running time and the numerical accuracy of Algorithm 2 with the general convex quadratic programming solver, CPLEX. We implement Algorithm 2 with MATLAB R2019b. All runs are performed on a system with Core i7 2.002.00 GHz CPU and 8.008.00 GB of RAM equipped with a 6464bit Windows operating system. We solve single variables optimization problems (18), (17) and step 3 in Algorithm 2, using MATLAB built-in function fminbnd which is based on golden section search and parabolic interpolation.

Our testbed contains two types of randomly generated rank-one knapsack problems up to n=50,000n=50,000 variables. In the first type, vectors aa and cc are integral and generated uniformly from the same interval. We denote this type by TypeI. In the second type (TypeII), vectors aa and cc are positive and negative randomly generated integral vectors, respectively. In Table 1 we summarize the parameter values for problem instances.

Table 1: Parameters for two types of problem instances.
Type aa cc ll ulu-l \MLTypeI U(50,50)U(-50,50) U(50,50)U(-50,50) U(0,20)U(0,20) U(1,100)U(1,100)
TypeII U(100,10)U(-100,10) U(10,100)U(10,100) U(0,20)U(0,20) U(1,100)U(1,100)\LL

As a well-known general convex quadratic programming solver, we chose CPLEX (ver. 12.9) to compare with our results. Based on our numerical tests, we set the quadratic programming solver of CPLEX (qpmethod option) to barrier. The barrier convergence tolerance, convergetol is set to 1e121e-12. After we complete our experimental tests, we found in [10] that the sparsity of the Hessian matrix influences the performance of CPLEX. To increase the performance, we reformulate our problem as

min{12y2cx: 1xy=0,ax=b, 0xu}.\min\left\{\frac{1}{2}y^{2}-c^{\top}x\;:\;{\boldsymbol{1}}^{\top}x-y=0,\;a^{\top}x=b,\;0\leq x\leq u\right\}.

We denote the results corresponding to running CPLEX on the original problem and the above modification respectively by CPLEXorg\text{CPLEX}_{org} and CPLEXref\text{CPLEX}_{ref}.

Table 2 shows the average running time for 55 runs of each algorithm/solver for each problem size. Dash sign, ’-’, denoted the algorithm/solver encounters out-of-memory status.

In all cases, Algorithm 2 outperforms CPLEXorg\text{CPLEX}_{org}. For instances up to n=5000n=5000, our algorithm and CPLEXref\text{CPLEX}_{ref} has same performance, whereas for larger instances, CPLEXref\text{CPLEX}_{ref} has smaller running time.

Table 2: A comparison of running times (in seconds) between our algorithm and CPLEXorg\text{CPLEX}_{org} and CPLEXref\text{CPLEX}_{ref}.
nn Our algorithm CPLEXorg\text{CPLEX}_{org} CPLEXref\text{CPLEX}_{ref} \ML10001000 TypeI 0.060.06 0.090.09 0.010.01
TypeII 0.010.01 0.060.06 0.020.02
15001500 TypeI 0.040.04 0.150.15 0.020.02
TypeII 0.020.02 0.130.13 0.020.02
20002000 TypeI 0.040.04 0.270.27 0.020.02
TypeII 0.020.02 0.270.27 0.020.02
50005000 TypeI 0.090.09 2.212.21 0.020.02
TypeII 0.060.06 2.122.12 0.030.03
1000010000 TypeI 0.260.26 16.2616.26 0.040.04
TypeII 0.230.23 16.9516.95 0.050.05
1500015000 TypeI 0.620.62 61.2061.20 0.100.10
TypeII 0.630.63 65.8865.88 0.100.10
2000020000 TypeI 1.161.16 - 1.201.20
TypeII 0.880.88 - 1.021.02
5000050000 TypeI 3.223.22 - 0.110.11
TypeII 3.193.19 - 0.110.11
100000100000 TypeI 12.1912.19 - 0.140.14
TypeII 11.3111.31 - 0.170.17 \ML

5 Conclusions

In this paper, we proposed a two-phase algorithm for rank-one quadratic knapsack problems. To this end, we studied the solution structure of the problem when it has no resource constraint. Indeed, we proposed an O(nlogn)O(n\log n) algorithm to solve this problem. We then used the solution structure to propose an O(n2logn)O(n^{2}\log n) line-sweep algorithm that finds an interval that contains the optimal Lagrange multiplier. Then, the estimated optimal interval is explored for computing the optimal solution with the desired accuracy. Our computational tests showed that our algorithm has better performance than CPLEX when CPLEX is used to solve the original problem. After a reformulation of the problem, CPLEX outperforms our algorithm for instances with n5000n\geq 5000.

References

  • [1] Mark de Berg, Otfried Cheong, Marc van Kreveld, and Mark Overmars, Computational geometry: Algorithms and Applications, Springer-Verlag TELOS, 2008.
  • [2] Gabriel R Bitran and Arnoldo C Hax, Disaggregation and resource allocation using convex knapsack problems with bounded variables, Management Science 27 (1981), no. 4, 431–441.
  • [3] Peter Brucker, An O(n)O(n) algorithm for quadratic knapsack problems, Operations Research Letters 3 (1984), no. 3, 163–166.
  • [4] Roberto Cominetti, Walter F Mascarenhas, and Paulo JS Silva, A Newton’s method for the continuous quadratic knapsack problem, Mathematical Programming Computation 6 (2014), no. 2, 151–169.
  • [5] Yu-Hong Dai and Roger Fletcher, New algorithms for singly linearly constrained quadratic programs subject to lower and upper bounds, Mathematical Programming 106 (2006), no. 3, 403–421.
  • [6] Daniela di Serafino, Gerardo Toraldo, Marco Viola, and Jesse Barlow, A two-phase gradient method for quadratic programming problems with a single linear constraint and bounds on the variables, SIAM Journal on Optimization 28 (2018), no. 4, 2809–2838.
  • [7] Jean-Pierre Dussault, Jacques A Ferland, and Bernard Lemaire, Convex quadratic programming with one constraint and bounded variables, Mathematical Programming 36 (1986), no. 1, 90–104.
  • [8] Roger Fletcher, Augmented lagrangians, box constrained QP and extensions, IMA Journal of Numerical Analysis 37 (2017), no. 4, 1635–1656.
  • [9] R Helgason, J Kennington, and H Lall, A polynomially bounded algorithm for a singly constrained quadratic program, Mathematical Programming 18 (1980), no. 1, 338–343.
  • [10] IBM, Cplex performance tuning for quadratic programs, https://www.ibm.com/support/pages/node/397129?mhsrc=ibmsearch_a&mhq=CPLEXPerformanceTuningforQuadraticPrograms, June 2018, [Online; accessed 23-January-2022].
  • [11] Meijiao Liu and Yong-Jin Liu, Fast algorithm for singly linearly constrained quadratic programs with box-like constraints, Computational Optimization and Applications 66 (2017), no. 2, 309–326.
  • [12] Panos M Pardalos, Yinyu Ye, and Chi-Geun Han, Algorithms for the solution of quadratic knapsack problems, Linear Algebra and its Applications 152 (1991), 69–91.
  • [13] Michael Patriksson, A survey on the continuous nonlinear resource allocation problem, European Journal of Operational Research 185 (2008), no. 1, 1–46.
  • [14] Michael Patriksson and Christoffer Strömberg, Algorithms for the continuous nonlinear resource allocation problem—new implementations and numerical studies, European Journal of Operational Research 243 (2015), no. 3, 703–722.
  • [15] AG Robinson, N Jiang, and CS Lerme, On the continuous quadratic knapsack problem, Mathematical programming 55 (1992), no. 1-3, 99–108.
  • [16] Thomas C Sharkey, H Edwin Romeijn, and Joseph Geunes, A class of nonlinear nonseparable continuous knapsack and multiple-choice knapsack problems, Mathematical Programming 126 (2011), no. 1, 69–96.