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

Optimal Online Algorithms for One-Way Trading and Online Knapsack Problems: A Unified Competitive Analysis

Ying Cao, Bo Sun and Danny H.K. Tsang This work was supported by the Hong Kong Research Grants Councils General Research Fund through Project 16211220. The authors are with Dept. of Electronic and Computer Engineering, the Hong Kong University of Science and Technology. Emails: {ycaoan, bsunaa, eetsang}@ust.hk
Abstract

We study two canonical online optimization problems under capacity/budget constraints: the fractional one-way trading problem (OTP) and the integral online knapsack problem (OKP) under an infinitesimal assumption. Under the competitive analysis framework, it is well-known that both problems have the same optimal competitive ratio. However, these two problems are investigated by distinct approaches under separate contexts in the literature. There is a gap in understanding the connection between these two problems and the nature of their online algorithm design. This paper provides a unified framework for the online algorithm design, analysis and optimality proof for both problems. We find that the infinitesimal assumption of the OKP is the key that connects the OTP in the analysis of online algorithms and the construction of worst-case instances. With this unified understanding, our framework shows its potential for analyzing other extensions of OKP and OTP in a more systematic manner.

I INTRODUCTION

Online optimization under capacity/budget constraints is a classical and challenging problem. Two well-known examples are the one-way trading problem (OTP) and the online knapsack problem (OKP).

In the OTP, an investor plans to trade a total amount of 1 dollar into yen. The exchange rates pip_{i} arrive online and are bounded, i.e., pi[L,U]p_{i}\in[L,U], and the investor must immediately decide how much to trade at each exchange rate. If xix_{i} dollars are traded at the iith exchange rate pip_{i}, pixip_{i}x_{i} is the amount of yen the investor gains. Let NN denote the total number of exchange rates. The goal is to maximize the amount of yen traded after processing the NNth exchange rate i=1Npixi\sum_{i=1}^{N}p_{i}x_{i}, while respecting the budget limit i=1Nxi1\sum_{i=1}^{N}x_{i}\leq 1. It is well-known that (ln(U/L)+1)(\ln(U/L)+1)-competitive algorithms can be designed, e.g., the threat-based algorithm in [1] and the CR-Pursuit algorithm in [2].

The 0-1 knapsack problem is a classic problem in computer science, where a decision-maker maximizes the total value of the items selected while the total weight does not exceed the normalized knapsack capacity limit of 11. In the OKP, the items come one by one. The value viv_{i} and the weight wiw_{i} of the iith item are only revealed upon its arrival. An online decision is made on whether to accept the item (zi=1z_{i}=1) or not (zi=0z_{i}=0). There exist no online algorithms with bounded competitive ratios for the OKP in the general setting [3]. However, (ln(U/L)+1\ln(U/L)+1)-competitive algorithms can be designed [4, 5, 6] under the bounded value-to-weight ratio assumption (i.e., vi/wi[L,U]v_{i}/w_{i}\in[L,U]) and the infinitesimal assumption that the weight of each item is much smaller than the capacity (i.e., maxiwi1\max_{i}w_{i}\ll 1). The infinitesimal assumption is a technical simplification, but it has been shown to hold in practical applications such as cloud computing systems [6] and is widely accepted in the literature. In this paper, we make the same assumptions.

Both problems have appeared in numerous applications, including portfolio selection, cloud resource allocation, keyword auctions, etc. Thus, considerable attention has been paid to both problems and their many variants. Unbounded prices [7] and interrelated prices [8] have been considered for the OTP recently, and knapsacks with unknown capacity [9] and removable items [10] are interesting generalizations for the OKP. Additionally, different arrival models have been studied, such as stochastic arrivals [11, 12] and random order [13]. In this paper, we make no assumptions on the arrival model.

Motivated by the gaps in the understanding of the nature of challenges in the online algorithm design, we aim to unify the online algorithms for the OTP and the OKP into one algorithmic framework, namely, a threshold-based algorithm, the competitive performance of which mainly depends on the threshold function. We provide a sufficient condition on the threshold function that can ensure a bounded competitive ratio, and design the best possible threshold function based on this sufficient condition. Finally, we derive the lower bound of the competitive ratios of the OTP and the OKP. Although all results match those in the literature, the existing works approach the results by distinct methods and lack a systematic way of designing and analyzing related problems. This paper mainly focuses on the analysis and proofs rather than on the results. Our contributions are two-fold.

  • We unify the online algorithms for the OTP and the OKP into a threshold-based algorithm and show that the unified algorithm can achieve the optimal competitive ratios under a unified competitive analysis.

  • We provide new proofs for the lower bound of competitive ratios for the OTP and the OKP. The connection between these two problems is founded in the construction of the worst-case instances.

II A UNIFIED ALGORITHM and Our Results

II-A Notations

Since the two problems have originally distinct sets of terms, we unify the notations for the brevity of problem formulation and clarify the different meanings here. Let xix_{i} denote the amount of dollars traded at the iith exchange rate for the OTP, while for the OKP, it represents the capacity used after processing the iith item wiziw_{i}z_{i}. Let bib_{i} denote the exchange rate (i.e., pip_{i}) in the OTP and the value-to-weight ratio of the iith item in the OKP (i.e., vi/wi{v_{i}}/{w_{i}}). The following optimization problem characterizes the offline problem of the OTP:

maximize𝒙\displaystyle\underset{\bm{x}}{\text{maximize}} i=1Nbixi\displaystyle\sum_{i=1}^{N}b_{i}x_{i} (1)
s.t.\displaystyle{\rm s.t.} i=1Nxi1,\displaystyle\sum_{i=1}^{N}x_{i}\leq 1,
xi0,i[N].\displaystyle x_{i}\geq 0,\forall i\in[N].

The dual problem of (1) is

minimize𝜆\displaystyle\underset{\lambda}{\text{minimize}} λ\displaystyle\lambda (2)
s.t.\displaystyle{\rm s.t}. λbi,i[N].\displaystyle\lambda\geq b_{i},\forall i\in[N].

By changing the last constraint of (1) to 0xiwi0\leq x_{i}\leq w_{i}, the resulting problem serves as an upper bound of the OKP due to the LP relaxation, and its dual is

minimizeλ,𝜷\displaystyle\underset{\lambda,\bm{\beta}}{\text{minimize}} λ+i=1Nwiβi\displaystyle\lambda+\sum_{i=1}^{N}w_{i}\beta_{i} (3)
s.t.\displaystyle{\rm s.t.} λ+βibi,i[N],\displaystyle\lambda+\beta_{i}\geq b_{i},\forall i\in[N],
λ0,βi0,i[N],\displaystyle\lambda\geq 0,\beta_{i}\geq 0,\forall i\in[N],

where λ\lambda and βi\beta_{i}s are the dual variables of the corresponding dual programs.

II-B A Unified Algorithm

Both the OTP and the OKP target allocating one budget-constrained resource sequentially. Since the current decision affects the future decisions through the budget constraint, we need an estimation of the value of the remaining resource to facilitate decision-making. We use a threshold function to estimate the value of resources.

Definition 1.

A threshold function ϕ(y):[0,1][0,)\phi(y):[0,1]\to[0,\infty) estimates the marginal cost of a resource at utilization yy.

Denote the utilization level after the iith arrival by y(i)y^{(i)}. Given ϕ(y)\phi(y), we can estimate the pseudo-cost of allocating xix_{i} amount of resource by y(i1)y(i1)+xiϕ(δ)𝑑δ\int_{y^{(i-1)}}^{y^{(i-1)}+x_{i}}\phi(\delta)d\delta. Our unified algorithm then decides xix_{i} that maximizes the pseudo-revenue bixiy(i1)y(i1)+xiϕ(δ)𝑑δb_{i}x_{i}-\int_{y^{(i-1)}}^{y^{(i-1)}+x_{i}}\phi(\delta)d\delta. The overall algorithm is summarized in Algorithm 1.

Algorithm 1 A Unified Algorithm
  Initialize: ϕ(y)\phi(y), y(0)=0y^{(0)}=0, bi[L,U]b_{i}\in[L,U];
  for the iith time slot do
     1. xi=argmaxx𝕊bixy(i1)y(i1)+xϕ(δ)𝑑δ.x_{i}=\arg\max_{x\in\mathbb{S}}b_{i}x-\int_{y^{(i-1)}}^{y^{(i-1)}+x}\phi(\delta)d\delta.
     2. Update y(i)=y(i1)+xiy^{(i)}=y^{(i-1)}+x_{i};
     3. If y(i)>1,xi=0.y^{(i)}>1,x_{i}=0.
  end for

𝕊\mathbb{S} denotes the set of all positive real numbers for the OTP and the set {0,wi}\{0,w_{i}\} for the OKP, separately. Note that for the OKP, step 1 reduces to xi={wi,biϕ(y(i1))0,otherwisex_{i}=\begin{cases}w_{i},&b_{i}\geq\phi(y^{(i-1)})\\ 0,&otherwise\end{cases}, which corresponds to the update equation in [4]. Algorithm 1 can be easily applied in the posted-price setting by its nature.

II-C Main Results

A standard measure for the performance of an online algorithm is the competitive ratio. Under the unified notation, define an arrival instance 𝒜\mathcal{A} as {bi}i[N]\{b_{i}\}_{\forall i\in[N]} for the OTP, and as {bi,wi}i[N]\{b_{i},w_{i}\}_{\forall i\in[N]} for the OKP. Denote the objective value achieved by the online algorithm and the offline optimal by ALG(𝒜)\text{ALG}(\mathcal{A}) and OPT(𝒜)\text{OPT}(\mathcal{A}), respectively, given the arrival instance 𝒜\mathcal{A}. If α=max𝒜OPT(𝒜)ALG(𝒜)\alpha=\max_{\mathcal{A}}{}\frac{\text{OPT}(\mathcal{A})}{\text{ALG}(\mathcal{A})}, then we say the online algorithm is α\alpha-competitive. The competitive ratio of Algorithm 1 depends only on the choice of the function ϕ\phi. We find the sufficient conditions for ϕ\phi for Algorithm 1 to be α\alpha-competitive in the following theorem.

Theorem 2 (Sufficiency).

Algorithm 1 is α\alpha-competitive for both the OTP and the OKP if ϕ\phi is given by

ϕ(y)={Ly[0,ω]φ(y)y[ω,1],\phi(y)=\left\{\begin{array}[]{cc}L&y\in[0,\omega]\\ \varphi(y)&y\in[\omega,1]\end{array},\right.

where ω\omega is a budget/capacity utilization level that satisfies 1αω1\frac{1}{\alpha}\leq\omega\leq 1, and φ(y)\varphi(y) is an increasing function that satisfies

{φ(y)1αφ(y),y[ω,1]φ(ω)=L,φ(1)U.\left\{\begin{array}[]{l}\varphi(y)\geq\frac{1}{\alpha}\varphi^{\prime}(y),y\in[\omega,1]\\ \varphi(\omega)=L,\varphi(1)\geq U.\end{array}\right. (4)

In the theorem, ϕ\phi is composed of two segments, one constant and the other exponential. Note that the functions used in [4] and [6] satisfy the conditions. However, the basis of the functions is unknown; the authors do not explain the intuition behind the functions nor rigorously characterize the properties of the functions. In contrast, by the following theorem, we can characterize the performance limit over the space of all eligible functions and rigorously show the function that admits the smallest (best) competitive ratio.

Theorem 3.

Given LL and UU, the best competitive ratio that can be achieved by Algorithm 1 is (lnθ+1)(\ln\theta+1), where θ=U/L\theta=U/L, and the corresponding ϕ\phi^{*} is unique.

We show that no other online algorithms can perform better than Algorithm 1 using the following theorem.

Theorem 4.

Given LL and UU, (lnθ+1)(\ln\theta+1) is the lowest possible competitive ratio for both the OTP and the OKP.

In the next section, we introduce the primal-dual analysis framework, with which we prove Theorem 2. Subsequently, we prove Theorem 3 by Gronwall’s inequality. In Section IV, we show Theorem 4 by adversarial arguments.

III COMPETITIVE ANALYSIS

III-A Primal-Dual Competitive Analysis

Given the arrival instance 𝒜\mathcal{A}, we denote the primal and dual objective values after processing bnb_{n} by Pn(𝒜)P_{n}(\mathcal{A}) and Dn(𝒜)D_{n}(\mathcal{A}), respectively. For simplicity, we drop the parenthesis and write PnP_{n} and DnD_{n} hereafter. We briefly introduce the framework by giving the following lemma.

Lemma 1.

An online algorithm is α\alpha-competitive if it can determine the primal variables xx and construct dual variables λ\lambda based on the primal variables such that

  • (Feasible Solutions) xx and λ\lambda are feasible solutions of the primal and the dual,

  • (Initial Inequality) there exists an index k[N]{0}k\in[N]\cup\{0\} such that Pk1αDkP_{k}\geq\frac{1}{\alpha}D_{k},

  • (Incremental Inequalities) for i{k+1,,N}i\in\{k+1,\dots,N\},

    PiPi11α(DiDi1).P_{i}-P_{i-1}\geq\frac{1}{\alpha}(D_{i}-D_{i-1}).
Proof.

The primal feasibility is trivial since any online algorithm must first produce a feasible solution to the problem. It suffices to prove PN1αDNP_{N}\geq\frac{1}{\alpha}D_{N} since

ALG=PN1αDN(a)1αD(b)1αOPT,\text{ALG}=P_{N}\geq\frac{1}{\alpha}D_{N}\overset{(a)}{\geq}\frac{1}{\alpha}D^{*}\overset{(b)}{\geq}\frac{1}{\alpha}\text{OPT},

where (aa) is due to the dual feasibility, and (bb) is due to the weak duality. Suppose there exists a kk such that PiPi11α(DiDi1)P_{i}-P_{i-1}\geq\frac{1}{\alpha}(D_{i}-D_{i-1}) holds for all i{k+1,,N}i\in\{k+1,\dots,N\}, then we have PNPk1α(DNDk).P_{N}-P_{k}\geq\frac{1}{\alpha}(D_{N}-D_{k}). Combining this with the initial inequality leads to PN1αDNP_{N}\geq\frac{1}{\alpha}D_{N}. We thus complete the proof. ∎

Note that the primal-dual competitive analysis framework that we use is more general than those used in the existing works, in that the initial inequality starts from k[N]{0}k\in[N]\cup\{0\} rather than the original 0.

Next, we show the proofs of Theorems 2 and 3 for the OTP, and highlight the differences between them and those for the OKP.

III-B Analysis of OTP

Proof of Theorem 2.

(Feasible Solutions) First we show that the primal and dual solutions given by Algorithm 1 are feasible:

xi={ϕ1(bi)y(i1)biϕ(y(i1))0bi<ϕ(y(i1)),\displaystyle x_{i}=\begin{cases}\phi^{-1}(b_{i})-y^{(i-1)}&b_{i}\geq\phi(y^{(i-1)})\\ 0&b_{i}<\phi(y^{(i-1)})\end{cases}, (5)

where ϕ1(b)={ωb=Lφ1(b)b>L\phi^{-1}(b)=\begin{cases}\omega&b=L\\ \varphi^{-1}(b)&b>L\end{cases}. (5) ensures i,xi0\forall i,x_{i}\geq 0, and ϕ(1)U\phi(1)\geq U ensures ϕ1(U)1\phi^{-1}(U)\leq 1. Since y(N)=ϕ1(maxi[N]bi)y^{(N)}=\phi^{-1}(\max_{i\in[N]}b_{i}), we have y(N)ϕ1(U)1y^{(N)}\leq\phi^{-1}(U)\leq 1. Thus, the primal solutions are feasible. Construct the dual variables as λi=ϕ(y(i)).\lambda_{i}=\phi(y^{(i)}). Since ϕ(y)\phi(y) is non-decreasing, λN=ϕ(y(N))ϕ(y(i)),i[N]\lambda_{N}=\phi(y^{(N)})\geq\phi(y^{(i)}),\forall i\in[N]. Thus, λN\lambda_{N} is a feasible solution to the dual.

(Initial Inequality) For the OTP, P0=0,D0=ϕ(y(0))=L>0P_{0}=0,D_{0}=\phi(y^{(0)})=L>0. When k1k\geq 1, the primal objective at the end of the kkth time slot is Pk=i=1kbixi,P_{k}=\sum_{i=1}^{k}b_{i}x_{i}, while the dual objective is Dk=λk=ϕ(y(k)).D_{k}=\lambda_{k}=\phi(y^{(k)}).

Since y(0)=0y^{(0)}=0 and ϕ(0)=Lbi,i\phi(0)=L\leq b_{i},\forall i, by (5), we have

x1=ϕ1(b1)={ωb1=Lφ1(b1)b1>L.x_{1}=\phi^{-1}(b_{1})=\begin{cases}\omega&b_{1}=L\\ \varphi^{-1}(b_{1})&b_{1}>L\end{cases}.

Because φ(y)\varphi(y) is an increasing function, we have x1ω1α.x_{1}\geq\omega\geq\frac{1}{\alpha}. Since b1=ϕ(x1)b_{1}=\phi(x_{1}), it follows that

P1=b1x1b1α=1αϕ(x1)=1αD1.P_{1}=b_{1}x_{1}\geq\frac{b_{1}}{\alpha}=\frac{1}{\alpha}\phi(x_{1})=\frac{1}{\alpha}D_{1}.

(Incremental Inequalities) Next we show the incremental inequalities for i>1i>1. Note that when xi=0x_{i}=0, Pi=Pi1P_{i}=P_{i-1} and Di=Di1D_{i}=D_{i-1}. In this case, the incremental inequality PiPi11α(DiDi1)P_{i}-P_{i-1}\geq\frac{1}{\alpha}(D_{i}-D_{i-1}) always holds. Thus, we only need to focus on the case where xi>0,i>1x_{i}>0,\forall i>1, when the behavior of the algorithm is controlled by the second segment of ϕ\phi, which satisfies φ(y)1αφ(y)\varphi(y)\geq\frac{1}{\alpha}\varphi^{\prime}(y) for y[ω,1]y\in[\omega,1] and two boundary conditions φ(ω)=L\varphi(\omega)=L and φ(1)U\varphi(1)\geq U.

The change in the primal objective is given as follows:

PiPi1=bixi=(a)ϕ(y(i))xi,P_{i}-P_{i-1}=b_{i}x_{i}\overset{(a)}{=}\phi(y^{(i)})x_{i},

where (aa) is due to (5) and y(i)=y(i1)+xiy^{(i)}=y^{(i-1)}+x_{i}.

The change in the dual objective is given as follows: DiDi1=φ(y(i))φ(y(i1)).D_{i}-D_{i-1}=\varphi(y^{(i)})-\varphi(y^{(i-1)}). By the Cauchy mean value theorem, for every segment [y(i1),y(i)][y^{(i-1)},y^{(i)}], there exists a δi[y(i1),y(i)]\delta_{i}\in[y^{(i-1)},y^{(i)}] such that

φ(y(i))φ(y(i1))y(i)y(i1)=φ(δi).\frac{\varphi(y^{(i)})-\varphi(y^{(i-1)})}{y^{(i)}-y^{(i-1)}}=\varphi^{\prime}(\delta_{i}).

Since y[ω,1],φ(y)1αφ(y)\forall y\in[\omega,1],\varphi(y)\geq\frac{1}{\alpha}\varphi^{\prime}(y), and φ(y)\varphi(y) is increasing, we have αφ(y(i))αφ(δi)φ(y(i))φ(y(i1))y(i)y(i1).\alpha\varphi(y^{(i)})\geq\alpha\varphi(\delta_{i})\geq\frac{\varphi(y^{(i)})-\varphi(y^{(i-1)})}{y^{(i)}-y^{(i-1)}}. Because y(i)y(i1)>0y^{(i)}-y^{(i-1)}>0, we have φ(y(i))(y(i)y(i1))1α(φ(y(i))φ(y(i1))),\varphi(y^{(i)})(y^{(i)}-y^{(i-1)})\geq\frac{1}{\alpha}(\varphi(y^{(i)})-\varphi(y^{(i-1)})), where the LHS is PiPi1P_{i}-P_{i-1}, and the RHS is 1α(DiDi1)\frac{1}{\alpha}(D_{i}-D_{i-1}). Thus, PiPi11α(DiDi1)P_{i}-P_{i-1}\geq\frac{1}{\alpha}(D_{i}-D_{i-1}) holds for all i>1i>1.

Therefore, Theorem 2 holds for the OTP. ∎

Theorem 3 characterizes the performance limit of Algorithm 1.

Proof of Theorem 3.

(Best Competitive Ratio) By the differential form of Gronwall’s Inequality [14], if there exists a φ\varphi that satisfies φ(y)1αφ(y),y[ω,1],\varphi(y)\geq\frac{1}{\alpha}\varphi^{\prime}(y),y\in[\omega,1], where ω[1α,1]\omega\in[\frac{1}{\alpha},1], it is bounded as follows:

φ(y)φ(ω)exp((ωyα𝑑t)),y[ω,1].\varphi(y)\leq\varphi(\omega)\exp{\bigg{(}\int_{\omega}^{y}\alpha dt\bigg{)}},y\in[\omega,1].

Substituting the first boundary condition φ(ω)=L\varphi(\omega)=L, we have φ(y)Lexp((α(yω))),y[ω,1].\varphi(y)\leq L\exp{\big{(}\alpha(y-\omega)\big{)}},y\in[\omega,1]. If the other boundary condition φ(1)U\varphi(1)\geq U holds, it implies Lexp((α(1ω)))U,L\exp{\big{(}\alpha(1-\omega)\big{)}}\geq U, otherwise φ(1)Lexp((α(1ω)))<U\varphi(1)\leq L\exp{\big{(}\alpha(1-\omega)\big{)}}<U, which incurs infeasibility. From the inequality above, we have ω11αlnθ.\omega\leq 1-\frac{1}{\alpha}\ln\theta. A necessary condition for ω1α\omega\geq\frac{1}{\alpha} to hold is 11αlnθ1α,1-\frac{1}{\alpha}\ln\theta\geq\frac{1}{\alpha}, and thus the competitive ratio αln(θ)+1.\alpha\geq\ln{\theta}+1.

(Φ\Phi^{*} and Its Uniqueness) When α\alpha takes the smallest possible α=lnθ+1\alpha^{*}=\ln\theta+1, the corresponding ϕ\phi^{*}s satisfy

ϕ(y)={Ly[0,ω]φ(y)y[ω,1],\phi^{*}(y)=\left\{\begin{array}[]{cc}L&y\in[0,\omega]\\ \varphi^{*}(y)&y\in[\omega,1]\end{array},\right.

where ω[1lnθ+1,1]\omega\in[\frac{1}{\ln\theta+1},1] and φ\varphi^{*}s are given by

{φ(y)1lnθ+1φ(y),y[ω,1]φ(ω)=L,φ(1)U.\left\{\begin{array}[]{l}\varphi^{*}(y)\geq\frac{1}{\ln\theta+1}{\varphi^{*}}^{\prime}(y),y\in[\omega,1]\\ \varphi^{*}(\omega)=L,\varphi^{*}(1)\geq U.\end{array}\right. (6)

By Gronwall’s inequality, we have

φ(y)\displaystyle\varphi^{*}(y) Lexp((lnθ+1)(yω)missing)\displaystyle\leq L\exp\big((\ln\theta+1)(y-\omega)\big{missing}) (7)
(a)Lexp((lnθ+1)y1missing),y[ω,1],\displaystyle\overset{(a)}{\leq}L\exp\big((\ln\theta+1)y-1\big{missing}),y\in[\omega,1],

where (aa) is due to ω1lnθ+1\omega\geq\frac{1}{\ln\theta+1}. Then we have φ(1)Lexp(lnθ)=Lθ=U.\varphi^{*}(1)\leq L\exp(\ln\theta)=L\theta=U. Combining with the second boundary condition φ(1)U\varphi^{*}(1)\geq U, we have φ(1)=U\varphi^{*}(1)=U. Substituting this into (7), we have ω1lnθ+1.\omega\leq\frac{1}{\ln\theta+1}. Because ω1lnθ+1\omega\geq\frac{1}{\ln\theta+1} as stated in Theorem 2, we have ω=1lnθ+1\omega=\frac{1}{\ln\theta+1}. Therefore, the solution space of (6) is equivalent to the solution space of the following differential inequality with equality boundary conditions:

{u(y)1lnθ+1u(y),y[1lnθ+1,1]u(1lnθ+1)=L,u(1)=U.\left\{\begin{array}[]{l}u(y)\geq\frac{1}{\ln\theta+1}{u}^{\prime}(y),y\in[\frac{1}{\ln\theta+1},1]\\ u(\frac{1}{\ln\theta+1})=L,u(1)=U.\end{array}\right. (8)

The differential equation counterpart is as follows:

{v(y)=1lnθ+1v(y),y[1lnθ+1,1]v(1lnθ+1)=L,v(1)=U.\left\{\begin{array}[]{l}v(y)=\frac{1}{\ln\theta+1}{v}^{\prime}(y),y\in[\frac{1}{\ln\theta+1},1]\\ v(\frac{1}{\ln\theta+1})=L,v(1)=U.\end{array}\right. (9)

The unique solution to (9) is v(y)=Lee(lnθ+1)yv(y)=\frac{L}{e}e^{(\ln\theta+1)y}. Suppose uu is a feasible solution to (8), by Gronwall’s inequality, u(y)v(y),y[1lnθ+1,1]u(y)\leq v(y),\forall y\in[\frac{1}{\ln\theta+1},1]. Next, we are going to show that the solution of (8) is unique and is exactly v(y)v(y).

Suppose u(y)<v(y)u(y)<v(y) for y𝕀y\in\mathbb{I}, where 𝕀[1lnθ+1,1]\mathbb{I}\subset[\frac{1}{\ln\theta+1},1]. We know that for any y[1lnθ+1,1]y\in[\frac{1}{\ln\theta+1},1], v(y)=(lnθ+1)v(y).v^{\prime}(y)=(\ln\theta+1)v(y). Thus, for y𝕀y\in\mathbb{I}, we have

v(y)=(lnθ+1)v(y)>(lnθ+1)u(y)u(y).v^{\prime}(y)=(\ln\theta+1)v(y)>(\ln\theta+1)u(y)\geq u^{\prime}(y).

Take the integral of uu^{\prime} over [1lnθ+1,1][\frac{1}{\ln\theta+1},1], we have 1lnθ+11u(y)𝑑y=u|1lnθ+11=UL,\int_{\frac{1}{\ln\theta+1}}^{1}u^{\prime}(y)dy=u\big{|}_{\frac{1}{\ln\theta+1}}^{1}=U-L, which can also be expressed as

1lnθ+11u(y)𝑑y\displaystyle\int_{\frac{1}{\ln\theta+1}}^{1}u^{\prime}(y)dy =𝕀u(y)𝑑y+[1lnθ+1,1]\𝕀u(y)𝑑y\displaystyle=\int_{\mathbb{I}}u^{\prime}(y)dy+\int_{[\frac{1}{\ln\theta+1},1]\backslash\mathbb{I}}u^{\prime}(y)dy
<𝕀v(y)𝑑y+[1lnθ+1,1]\𝕀u(y)𝑑y\displaystyle<\int_{\mathbb{I}}v^{\prime}(y)dy+\int_{[\frac{1}{\ln\theta+1},1]\backslash\mathbb{I}}u^{\prime}(y)dy
=1lnθ+11v(y)𝑑y=v|1lnθ+11=UL,\displaystyle=\int_{\frac{1}{\ln\theta+1}}^{1}v^{\prime}(y)dy=v\big{|}_{\frac{1}{\ln\theta+1}}^{1}=U-L,

which shows UL<ULU-L<U-L. Thus, u(y)=v(y)u(y)=v(y) for y[1lnθ+1,1]y\in[\frac{1}{\ln\theta+1},1]. In conclusion, the optimal ϕ\phi^{*} achieving competitive ratio (lnθ+1)(\ln\theta+1) is unique, and

ϕ(y)={Ly[0,1lnθ+1]Lee(lnθ+1)yy(1lnθ+1,1].\phi^{*}(y)=\left\{\begin{array}[]{cc}L&y\in[0,\frac{1}{\ln\theta+1}]\\ \frac{L}{e}e^{(\ln\theta+1)y}&y\in(\frac{1}{\ln\theta+1},1]\end{array}.\right.

III-C Analysis of OKP

We highlight the differences in the analysis of the OKP. The primal feasibility holds trivially and the dual variables are constructed as follows:

λ=λN,βi={biλixi=wi0xi=0,\displaystyle\lambda=\lambda_{N},\quad\beta_{i}=\begin{cases}b_{i}-\lambda_{i}&x_{i}=w_{i}\\ 0&x_{i}=0\end{cases},

where λi=ϕ(y(i1))\lambda_{i}=\phi(y^{(i-1)}). When xi=wix_{i}=w_{i}, based on the decision-making rule (Step 1 in the algorithm), we must have biϕ(y(i1))b_{i}\geq\phi(y^{(i-1)}). Therefore, βi0,i[N]\beta_{i}\geq 0,\forall i\in[N]. The constraint of the dual problem is

λ+βibi={λλi0xi=wiλbi0xi=0.\displaystyle\lambda+\beta_{i}-b_{i}=\begin{cases}\lambda-\lambda_{i}\geq 0&x_{i}=w_{i}\\ \lambda-b_{i}\geq 0&x_{i}=0\end{cases}.

Thus, the dual feasibility holds.

Assume that the online algorithm will accept the first kk items, and ω=i=1kwi\omega=\sum_{i=1}^{k}w_{i}. Also note that λi=L,i[k]\lambda_{i}=L,\forall i\in[k]. Then we have

Dk\displaystyle D_{k} =λk+i=1kwiβi=λk+i=1kwi(biλi)\displaystyle=\lambda_{k}+\sum_{i=1}^{k}w_{i}\beta_{i}=\lambda_{k}+\sum_{i=1}^{k}w_{i}(b_{i}-\lambda_{i})
=L(1ω)+i=1kwibi\displaystyle=L(1-\omega)+\sum_{i=1}^{k}w_{i}b_{i}
1ω(i=1kwibi)αi=1kwibi=αPk.\displaystyle\leq\frac{1}{\omega}(\sum_{i=1}^{k}w_{i}b_{i})\leq\alpha\sum_{i=1}^{k}w_{i}b_{i}=\alpha P_{k}.

Thus, there exists kk that satisfies the initial inequality.

With regard to the incremental inequalities, we have PiPi1=biwi,DiDi1=φ(y(i))φ(y(i1))+wi(biφ(y(i1))=(a)wi[φ(y(i1))+biφ(y(i1))],P_{i}-P_{i-1}=b_{i}w_{i},D_{i}-D_{i-1}=\varphi(y^{(i)})-\varphi(y^{(i-1)})+w_{i}(b_{i}-\varphi(y^{(i-1)})\overset{(a)}{=}w_{i}[\varphi^{\prime}(y^{(i-1)})+b_{i}-\varphi(y^{(i-1)})], where (a)(a) is due to the fact φ(y(i1))=φ(y(i))φ(y(i1))wi\varphi^{\prime}(y^{(i-1)})=\frac{\varphi(y^{(i)})-\varphi(y^{(i-1)})}{w_{i}} and wi=y(i)y(i1)w_{i}=y^{(i)}-y^{(i-1)} (using the infinitesimal weight assumption). Combining the ODE (4) with the fact that biϕ(y(i1))=φ(y(i1))b_{i}\geq\phi(y^{(i-1)})=\varphi(y^{(i-1)}), the incremental inequality holds for i[N]i\in[N]. Thus, Theorem 2 holds for the OKP. Note that the proof of Theorem 3 holds generally for the two problems.

IV Lower Bounds

In this section, we show that the lower bound of the OTP and that of the OKP coincide. Denote Algorithm 1 with ϕ\phi^{*} by ALGϕ\text{ALG}_{\phi^{*}}. We first present the proofs for the OTP, then call attention to the differences for the OKP case.

IV-A Lower Bounds of OTP

Below we find the family of the worst-case sequences under which ALGϕ\text{ALG}_{\phi^{*}} incurs a ratio of lnθ+1\ln\theta+1.

Lemma 2.

Given LL and UU, the family of the worst-case sequences of ALGϕ\text{ALG}_{\phi^{*}} in the OTP are denoted by {δ^k}k+\{\hat{\delta}_{k}\}_{k\in\mathbb{N}^{+}}, where δ^k={b^1,,b^k}\hat{\delta}_{k}=\{\hat{b}_{1},\dots,\hat{b}_{k}\}, b^i[L,U]\hat{b}_{i}\in[L,U] and the rates satisfy

b^1=L,b^i=b^i1+ϵi1,i>1,limkb^k=U,\hat{b}_{1}=L,\hat{b}_{i}=\hat{b}_{i-1}+\epsilon_{i-1},i>1,\lim_{k\rightarrow\infty}\hat{b}_{k}=U,

where ϵi\epsilon_{i}s are infinitesimal positive values. The amount traded by ALGϕ\text{ALG}_{\phi^{*}} at the exchange rate b^i\hat{b}_{i} is denoted by x^i\hat{x}_{i}, which satisfies

x^1=1lnθ+1,x^i=lnb^i/b^i1lnθ+1,i>1,limki=1kx^i=1.\hat{x}_{1}=\frac{1}{\ln\theta+1},\hat{x}_{i}=\frac{\ln\hat{b}_{i}/\hat{b}_{i-1}}{\ln\theta+1},i>1,\lim_{k\rightarrow\infty}\sum_{i=1}^{k}\hat{x}_{i}=1.
Proof.

The proof of Lemma 2 is in the Appendix. ∎

Proof of Theorem 4.

Let ALG be any online algorithm different from ALGϕ.\text{ALG}_{\phi^{*}}. We show that ALG cannot achieve a competitive ratio smaller than lnθ+1\ln\theta+1 by using an adversarial argument.

Let δ^={L,L+ϵ1,,U}\hat{\delta}=\{L,L+\epsilon_{1},\dots,U\}. First present b^1=L\hat{b}_{1}=L to ALG. If ALG exchanges x1<x^1=1/(lnθ+1)x^{\prime}_{1}<\hat{x}_{1}=1/(\ln\theta+1), then we end the sequence, and on doing so, ALG cannot achieve lnθ+1\ln\theta+1, because OPT(δ^1)ALG(δ^1)=1x1>lnθ+1.\frac{\text{OPT}(\hat{\delta}_{1})}{\text{ALG}(\hat{\delta}_{1})}=\frac{1}{x^{\prime}_{1}}>\ln\theta+1. Thus, we can assume that ALG spends an amount x1x^1x^{\prime}_{1}\geq\hat{x}_{1}, in this case, we continue and present b^2\hat{b}_{2} to ALG. In general, if after processing the kkth exchange rate, the total amount of dollars spent is less than i=1kx^i\sum_{i=1}^{k}\hat{x}_{i}, we immediately end the sequence. Otherwise, we continue to present b^k+1\hat{b}_{k+1}, etc.

Let f(k)=i=1k(xix^i)f(k)=\sum_{i=1}^{k}(x^{\prime}_{i}-\hat{x}_{i}). Let 𝕂={k|f(k)<0}\mathbb{K}=\{k\in\mathbb{N}|f(k)<0\}, denote the minimum in 𝕂\mathbb{K} as jj, we have

x1x^1,\displaystyle x^{\prime}_{1}\geq\hat{x}_{1},
x1+x2x^1+x^2,\displaystyle x^{\prime}_{1}+x^{\prime}_{2}\geq\hat{x}_{1}+\hat{x}_{2},\dotsc
i=1j1xii=1j1x^i,\displaystyle\sum_{i=1}^{j-1}x^{\prime}_{i}\geq\sum_{i=1}^{j-1}\hat{x}_{i},
i=1jxi<i=1jx^i.\displaystyle\sum_{i=1}^{j}x^{\prime}_{i}<\sum_{i=1}^{j}\hat{x}_{i}.

Thus, ALG can gain more by spending exactly the same as ALGϕ\text{ALG}_{\phi^{*}} at the first (j1)(j-1) exchange rates and by spending xj~=xj+i=1j1(xix^i)\tilde{x^{\prime}_{j}}=x^{\prime}_{j}+\sum_{i=1}^{j-1}(x^{\prime}_{i}-\hat{x}_{i}) at the jjth exchange rate. Since xj~<x^j\tilde{x^{\prime}_{j}}<\hat{x}_{j}, ALG cannot guarantee the competitive ratio of lnθ+1\ln\theta+1. If f(k)0f(k)\geq 0 for all k+k\in\mathbb{N}^{+}, we have

lim infkf(k)0,lim supkf(k)0.\displaystyle\liminf_{k\rightarrow\infty}f(k)\geq 0,\limsup_{k\rightarrow\infty}f(k)\geq 0.

Since ALG cannot exceed the capacity limit, we have limki=1kxi1,\lim_{k\rightarrow\infty}\sum_{i=1}^{k}x^{\prime}_{i}\leq 1, and we also have limki=1kx^k=1\lim_{k\rightarrow\infty}\sum_{i=1}^{k}\hat{x}_{k}=1, therefore, we have limkf(k)0.\lim_{k\rightarrow\infty}f(k)\leq 0. For an infinite sequence f(k)f(k), the limit exists iff

lim supf(k)=lim inff(k)=limf(k),\limsup f(k)=\liminf f(k)=\lim f(k),

so we have limkf(k)=0.\lim_{k\rightarrow\infty}f(k)=0. By the Abel transformation, we have i=1kb^i(xix^i)=i=1k1f(i)(b^ib^i+1)+f(k)b^k(a)f(k)b^k,\sum_{i=1}^{k}\hat{b}_{i}(x^{\prime}_{i}-\hat{x}_{i})=\sum_{i=1}^{k-1}f(i)(\hat{b}_{i}-\hat{b}_{i+1})+f(k)\hat{b}_{k}\\ \overset{(a)}{\leq}f(k)\hat{b}_{k}, where (aa) is due to the monotonicity of {b^i}\{\hat{b}_{i}\}.

Thus, the performance gap between ALG and ALGϕ\text{ALG}_{\phi^{*}} for this infinite exchange rate sequence is limki=1kb^i(xix^i)limkf(k)b^k=0.\lim_{k\rightarrow\infty}\sum_{i=1}^{k}\hat{b}_{i}(x^{\prime}_{i}-\hat{x}_{i})\leq\lim_{k\rightarrow\infty}f(k)\hat{b}_{k}=0.

Therefore, any online algorithm for the OTP cannot achieve a better competitive ratio than ALGϕ\text{ALG}_{\phi^{*}}. The lowest possible competitive ratio is lnθ+1\ln\theta+1.

IV-B Lower Bounds of OKP

We show that with a slight modification, {δ^k}k+\{\hat{\delta}_{k}\}_{k\in\mathbb{N}^{+}} are also the worst-case sequences for the OKP.

Consider a family of the value-to-weight ratio sequences {Ib}\{I_{b}\} indexed by b[L,U]b\in[L,U]. IbI_{b} is composed of a continuum of subsequences, with the ratios in the iith subsequence all being b^i,i+\hat{b}_{i},i\in\mathbb{N}^{+}, where b^ib\hat{b}_{i}\leq b, which is given in Lemma 2. The length of each subsequence is sufficiently large so that it can fulfill the capacity of the knapsack even if it is presented alone. Note that given IbI_{b}, the resource allocation strategy is analogous to the OTP case. The offline optimal solution is to only select from the subsequence with b^i=b\hat{b}_{i}=b until reaching the capacity limit, whereas ALGϕ\text{ALG}_{\phi^{*}} will select a value-to-weight ratio as long as it is no less than ϕ(y)\phi^{*}(y), where yy is the current capacity utilization level. Therefore, {Ib}b[L,U]\{I_{b}\}_{b\in[L,U]} are the worst-case sequences for the OKP.

With regards to the proof of Theorem 4, one can replace the worst sequence δ^\hat{\delta} with IUI_{U}, present a subsequence instead of an arrival at a time to ALG, and act adversarially in the same way in response to the decisions made by ALG, and the results still hold.

V CONCLUSION

We provide a unified threshold-based algorithm for two well-known online problems, namely, the one-way trading problem and the online knapsack problem. We show the sufficient conditions for the algorithm to have a bounded competitive ratio for both problems via a unified competitive analysis. We reveal the threshold function that can achieve the best (smallest) competitive ratio, show that it matches the lower bounds, and present new proofs for the lower bounds for both problems. This is the first work that introduces the connections between the OTP and the OKP and provides a unified algorithmic framework for both of them, and we believe there is much more to be explored in this direction, i.e., unifying the online algorithm design.

APPENDIX

Proof of Lemma 2.

Denote any strictly-increasing sequence with length kk by δk={b1,,bk}\delta_{k}=\{b_{1},\dots,b_{k}\}. We can simply focus on the strictly-increasing sequences, because ALGϕ\text{ALG}_{\phi^{*}} only trades something when the current exchange rate is the new high observed. Any normal sequences can be transformed into a strictly-increasing sequence by keeping the exchange rate higher than all of its predecessors and omitting the rest, and the optimal in hindsight is not affected by this transformation. By (5), we have

x1\displaystyle x_{1} =ϕ1(b1)=ln(b1e/L)lnθ+1,\displaystyle={\phi^{*}}^{-1}(b_{1})=\frac{\ln(b_{1}e/L)}{\ln\theta+1},
xi\displaystyle x_{i} =ϕ1(bi)ϕ1(bi1)\displaystyle={\phi^{*}}^{-1}(b_{i})-{\phi^{*}}^{-1}(b_{i-1})
=ln(bi/bi1)lnθ+1,i2.\displaystyle=\frac{\ln(b_{i}/b_{i-1})}{\ln\theta+1},i\geq 2.

Denote the total amount of yen ALGϕ\text{ALG}_{\phi^{*}} trades for δk\delta_{k} by ALG(δk\delta_{k}) and the offline optimal amount by OPT(δk\delta_{k}). We have OPT(δk)=bk,\text{OPT}(\delta_{k})=b_{k}, and

ALG(δk)=i=1kbixi=b1ln(b1e/L)+i=2kbiln(bi/bi1)lnθ+1.\displaystyle\text{ALG}(\delta_{k})=\sum_{i=1}^{k}b_{i}x_{i}=\frac{b_{1}\ln(b_{1}e/L)+\sum_{i=2}^{k}b_{i}\ln(b_{i}/b_{i-1})}{\ln\theta+1}.

Let rk(b1,,bk)=b1ln(b1e/L)+i=2kbiln(bi/bi1)bkr_{k}(b_{1},\dots,b_{k})=\frac{b_{1}\ln(b_{1}e/L)+\sum_{i=2}^{k}b_{i}\ln(b_{i}/b_{i-1})}{b_{k}}. Thus, the competitive ratio for ALGϕ\text{ALG}_{\phi^{*}} can be expressed as

max{b1,,bk,k}OPT(δk)ALG(δk)\displaystyle\underset{\{b_{1},\dots,b_{k},k\}}{\max}\frac{\text{OPT}(\delta_{k})}{\text{ALG}(\delta_{k})} =lnθ+1min{b1,,bk,k}rk(b1,,bk).\displaystyle=\frac{\ln\theta+1}{\underset{\{b_{1},\dots,b_{k},k\}}{\min}r_{k}(b_{1},\dots,b_{k})}.

Because ALGϕ\text{ALG}_{\phi^{*}} can achieve lnθ+1\ln\theta+1 with ϕ\phi^{*} by Theorem 3, we know that min{b1,,bk,k}rk=1\underset{\{b_{1},\dots,b_{k},k\}}{\min}r_{k}=1. Next, we look for {b1,,bk}\{b_{1},\dots,b_{k}\} that minimize rk(b1,,bk)r_{k}(b_{1},\dots,b_{k}) for each kk. When k=1k=1, r1(b1)=ln(b1e/L)1r_{1}(b_{1})=\ln(b_{1}e/L)\geq 1, therefore, δ^1={L}\hat{\delta}_{1}=\{L\}, x^1=1lnθ+1\hat{x}_{1}=\frac{1}{\ln\theta+1} and OPT(δ^1)ALG(δ^1)=lnθ+1\frac{\text{OPT}(\hat{\delta}_{1})}{\text{ALG}(\hat{\delta}_{1})}=\ln\theta+1. When k=2k=2,

r2(b1,b2)=b1ln(b1e/L)+b2ln(b2/b1)b2.\displaystyle r_{2}(b_{1},b_{2})=\frac{b_{1}\ln(b_{1}e/L)+b_{2}\ln(b_{2}/b_{1})}{b_{2}}.

The first order derivatives are

r2b1\displaystyle\frac{\partial r_{2}}{\partial b_{1}} =ln(b1e/L)+1b2/b1b2,\displaystyle=\frac{\ln(b_{1}e/L)+1-b_{2}/b_{1}}{b_{2}},
r2b2\displaystyle\frac{\partial r_{2}}{\partial b_{2}} =b2b1ln(b1e/L)b22.\displaystyle=\frac{b_{2}-b_{1}\ln(b_{1}e/L)}{{b_{2}}^{2}}.

We notice that r2/b1\partial r_{2}/\partial b_{1} and r2/b2\partial r_{2}/\partial b_{2} cannot be zero simultaneously. This means that r2r_{2} has no critical points, and the minimum value of r2r_{2} on [L,U]×[L,U][L,U]\times[L,U] must be on one of the four boundary points. It turns out that r2r_{2} reaches minimum when (b1,b2)=(L,L)(b_{1},b_{2})=(L,L). We need to find a close neighbor to (L,L)(L,L) with b2>b1b_{2}>b_{1} and whose value does not increase too much. Notice that r2/b1|(L,L)>0,r2/b2|(L,L)=0\partial r_{2}/\partial b_{1}\big{|}_{(L,L)}>0,\partial r_{2}/\partial b_{2}\big{|}_{(L,L)}=0, increasing b2b_{2} to b2+ϵb_{2}+\epsilon with infinitesimal positive ϵ\epsilon should incur the least inaccuracy, thus, δ^2={L,L+ϵ}\hat{\delta}_{2}=\{L,L+\epsilon\} and OPT(δ^2)ALG(δ^2)(lnθ+1)\frac{\text{OPT}(\hat{\delta}_{2})}{\text{ALG}(\hat{\delta}_{2})}\rightarrow(\ln\theta+1)^{-} as ϵ0+\epsilon\rightarrow 0^{+}. For general k3k\geq 3,

rk(b1,,bk)=b1ln(b1e/L)+i=2kbiln(bi/bi1)bk.\displaystyle r_{k}(b_{1},\dots,b_{k})=\frac{b_{1}\ln(b_{1}e/L)+\sum_{i=2}^{k}b_{i}\ln(b_{i}/b_{i-1})}{b_{k}}.

The first order derivatives are:

rkb1=ln(b1e/L)+1b2/b1b2,\displaystyle\frac{\partial r_{k}}{\partial b_{1}}=\frac{\ln(b_{1}e/L)+1-b_{2}/b_{1}}{b_{2}},
rkbk=bkbk1rk1(b1,,bk1)bk2,\displaystyle\frac{\partial r_{k}}{\partial b_{k}}=\frac{b_{k}-b_{k-1}r_{k-1}(b_{1},\dots,b_{k-1})}{{b_{k}}^{2}},
rkbi=ln(bi/bi1)+1bi+1/bibk,i=2,,k1.\displaystyle\frac{\partial r_{k}}{\partial b_{i}}=\frac{\ln(b_{i}/b_{i-1})+1-b_{i+1}/b_{i}}{b_{k}},i=2,\dots,k-1.

A commonality is that, rk/bk\partial r_{k}/\partial b_{k} and rk/bk1\partial r_{k}/\partial b_{k-1} cannot be zero at the same time, and rkr_{k} reaches minimum when bi=L,i[k]b_{i}=L,i\in[k]. The increasing sequence closest to the minimum point is {L,L+ϵ1,,L+i=1k1ϵi}\{L,L+\epsilon_{1},\dots,L+\sum_{i=1}^{k-1}\epsilon_{i}\}, where ϵi\epsilon_{i}s are infinitesimal positive values, and we have OPT(δ^k)ALG(δ^k)(lnθ+1)\frac{\text{OPT}(\hat{\delta}_{k})}{\text{ALG}(\hat{\delta}_{k})}\rightarrow(\ln\theta+1)^{-} as i=1k1ϵi0+.\sum_{i=1}^{k-1}\epsilon_{i}\rightarrow 0^{+}. Actually, each δ^k\hat{\delta}_{k} is the prefix of δ^m,mk.\hat{\delta}_{m},m\geq k. From these observations, we claim that as long as the exchange rate sequence increases slowly enough from LL, it is the worst-case sequence for ALGϕ\text{ALG}_{\phi^{*}}.

To verify the claim, let b^k\hat{b}_{k} be L+i=1k1ϵiL+\sum_{i=1}^{k-1}\epsilon_{i}, we have

ALG(δ^k)\displaystyle\text{ALG}(\hat{\delta}_{k}) =i=1kb^ixi\displaystyle=\sum_{i=1}^{k}\hat{b}_{i}x_{i}
=Llnθ+1+i=2kb^i(ln(b^i)ln(b^i1)lnθ+1)\displaystyle=\frac{L}{\ln\theta+1}+\sum_{i=2}^{k}\hat{b}_{i}\bigg{(}\frac{\ln(\hat{b}_{i})-\ln(\hat{b}_{i-1})}{\ln\theta+1}\bigg{)}
=Llnθ+1+Lb^kγdln(γ)lnθ+1=b^klnθ+1,\displaystyle=\frac{L}{\ln\theta+1}+\int_{L}^{\hat{b}_{k}}\gamma\cdot\frac{d\ln(\gamma)}{\ln\theta+1}=\frac{\hat{b}_{k}}{\ln\theta+1},

and thus

OPT(δ^k)ALG(δ^k)=max{b1,,bk,k}OPT(δk)ALG(δk)=lnθ+1.\frac{\text{OPT}(\hat{\delta}_{k})}{\text{ALG}(\hat{\delta}_{k})}=\underset{\{b_{1},\dots,b_{k},k\}}{\max}\frac{\text{OPT}(\delta_{k})}{\text{ALG}(\delta_{k})}=\ln\theta+1.

Since the exchange rate is upper bounded by UU, by the monotone convergence theorem, we have

limkb^k=U,\lim_{k\rightarrow\infty}\hat{b}_{k}=U,

and thus limki=1kx^i=1\lim_{k\rightarrow\infty}\sum_{i=1}^{k}\hat{x}_{i}=1. ∎

References

  • [1] R. El-Yaniv, A. Fiat, R. M. Karp, and G. Turpin, “Optimal search and one-way trading online algorithms,” Algorithmica, vol. 30, no. 1, pp. 101–139, 2001.
  • [2] Q. Lin, H. Yi, J. Pang, M. Chen, A. Wierman, M. Honig, and Y. Xiao, “Competitive online optimization under inventory constraints,” Proceedings of the ACM on Measurement and Analysis of Computing Systems, vol. 3, no. 1, pp. 1–28, 2019.
  • [3] M. Babaioff, N. Immorlica, D. Kempe, and R. Kleinberg, “A knapsack secretary problem with applications,” in Approximation, randomization, and combinatorial optimization. Algorithms and techniques.   Springer, 2007, pp. 16–28.
  • [4] Y. Zhou, D. Chakrabarty, and R. Lukose, “Budget constrained bidding in keyword auctions and online knapsack problems,” in International Workshop on Internet and Network Economics.   Springer, 2008, pp. 566–576.
  • [5] X. Tan, B. Sun, A. Leon-Garcia, Y. Wu, and D. H. Tsang, “Mechanism design for online resource allocation: A unified approach,” Proc. ACM Meas. Anal. Comput. Syst., vol. 4, no. 2, June 2020. [Online]. Available: https://doi.org/10.1145/3392142
  • [6] Z. Zhang, Z. Li, and C. Wu, “Optimal posted prices for online cloud resource allocation,” Proceedings of the ACM on Measurement and Analysis of Computing Systems, vol. 1, no. 1, pp. 1–26, 2017.
  • [7] F. Y. Chin, B. Fu, J. Guo, S. Han, J. Hu, M. Jiang, G. Lin, H.-F. Ting, L. Zhang, Y. Zhang, et al., “Competitive algorithms for unbounded one-way trading,” Theoretical Computer Science, vol. 607, pp. 35–48, 2015.
  • [8] P. Schroeder, R. Dochow, and G. Schmidt, “Optimal solutions for the online time series search and one-way trading problem with interrelated prices and a profit function,” Computers & Industrial Engineering, vol. 119, pp. 465–471, 2018.
  • [9] Y. Disser, M. Klimm, N. Megow, and S. Stiller, “Packing a knapsack of unknown capacity,” SIAM Journal on Discrete Mathematics, vol. 31, no. 3, pp. 1477–1497, 2017.
  • [10] X. Han, Y. Kawase, and K. Makino, “Randomized algorithms for removable online knapsack problems,” in Frontiers in Algorithmics and Algorithmic Aspects in Information and Management.   Springer, 2013, pp. 60–71.
  • [11] L. Tran-Thanh, Y. Xia, T. Qin, and N. R. Jennings, “Efficient algorithms with performance guarantees for the stochastic multiple-choice knapsack problem,” in Twenty-Fourth International Joint Conference on Artificial Intelligence, 2015.
  • [12] H. Fujiwara, K. Iwama, and Y. Sekiguchi, “Average-case competitive analyses for one-way trading,” Journal of Combinatorial Optimization, vol. 21, no. 1, pp. 83–107, 2011.
  • [13] S. Albers, A. Khan, and L. Ladewig, “Improved online algorithms for knapsack and gap in the random order model,” in Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques (APPROX/RANDOM 2019).   Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 2019.
  • [14] D. S. Mitrinovic, J. Pecaric, and A. M. Fink, Inequalities involving functions and their integrals and derivatives.   Springer Science & Business Media, 1991, vol. 53.