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

Adjustable Coins

Shlomo Moran Compter Science Department, Technion. Israel    Irad Yavneh11footnotemark: 1
Abstract

In this paper we consider a scenario where there are several algorithms for solving a given problem. Each algorithm is associated with a probability of success and a cost, and there is also a penalty for failing to solve the problem. The user may run one algorithm at a time for the specified cost, or give up and pay the penalty. The probability of success may be implied by randomization in the algorithm, or by assuming a probability distribution on the input space, which lead to different variants of the problem. The goal is to minimize the expected cost of the process under the assumption that the algorithms are independent. We study several variants of this problem, and present possible solution strategies and a hardness result.

1 Introduction

Some optimization problems concern optimal ordering of certain tasks that aim at achieving some common goal (see, e.g., [1]). A possible scenario can be described as follows: the king’s daughter is approaching marrying age. The miser king, who cares about money more than anything else, estimates that if she doesn’t marry then he will need to spend EE gold pieces to continue supporting her for the rest of their lives. There are nn princes he can invite to try to win her heart, and he must choose the order, knowing that the cost of travel room and board for princeiprince_{i} is μi\mu_{i}, and the probability that he will win the princess’s heart is PiP_{i}. What order minimizes the king’s expected cost? In a more challenging scenario, there are nn kingdoms with several eligible princes in each kingdom, each with his own μ\mu and PP, and the king must also decide which prince he should invite from each kingdom (he cannot invite more than one).

Such problems can be described as one player games, which we call adjustable coins games. An adjustable coin—A-coin in short—is a coin whose bias can be controlled by the user: the probability of success (rolling on one) can be increased, for a price. Formally, an A-coin is defined by a monotone increasing function μ:Dμ+\mu:D_{\mu}\rightarrow\mathbb{R}^{+} where Dμ(0,1]D_{\mu}\subseteq(0,1] contains the possible success probabilities, and for PDμP\in D_{\mu}, μ(P)\mu(P) is the nonnegative fee for tossing the coin with success probability PP. If |Dμ|=1|D_{\mu}|=1 then μ\mu is a simple coin, or just coin, denoted by a pair c=(P,μ)c=(P,\mu). Thus an A-coin μ\mu can be viewed as a set of the simple coins {(P,μ(P)):PDμ}\{(P,\mu(P)):P\in D_{\mu}\}.

In the games studied in this paper the player is given a set 𝒞\mathcal{C} of A-coins and a penalty E>0E>0, and in each step she may select an A-coin μ𝒞\mu\in\mathcal{C}, and a probability PDμP\in D_{\mu}, and toss the coin for the fee μ(P)\mu(P) . If the coin rolls on one the player terminates the game without paying a penalty, else she either takes another step, or terminates the game and pays the penalty EE. Thus, a strategy for an A-coin game maps each pair (𝒞,E)(\mathcal{C},E) of the set of A-coins and a penalty to a sequence SEQSEQ of the coins tossed by the player when the outcomes of all tosses are zeros. The goal is to minimize the expected cost—the total amount paid. Variants of this game are determined by the nature of the coins in 𝒞\mathcal{C}, the rules by which coins can be selected at each step, possible restrictions on the termination rule, etc. Specifically, we distinguish between reusable coins, which can be tossed many times, and one time coins, which can be tossed only once. The latter case corresponds to a scenario where one or more deterministic tests should be taken on a single item selected at random from a known distribution—repeating a test on the selected item just reproduces the initial outcome.

In Section 2 we study variants of the game for simple coins. In Section 3 we study the case where the A-coins are discrete, i.e., defined for finitely many values. In Section 4 we study the game for A-coins which are piecewise continuous functions.

2 Simple coins

In this section we study optimal strategies for the game where all A-coins are simple. A useful property of a simple coin c=(P,μ)c=(P,\mu) is its rate, given by the ratio r=μ/Pr=\mu/P. The notation c(P,r)c\sim(P,r) means that the simple coin cc has probability PP and is of rate rr, i.e., c=(P,rP)c=(P,rP).

2.1 Single simple coin, single toss

In the simplest scenario we are given a simple coin c=(P,μ)c=(P,\mu) and a penalty EE, and we must decide whether tossing the coin cc is beneficial, i.e., reduces the expected cost of the game.

The expected payment when cc is tossed is given by

COST(c,E)=μ+(1P)E=E(PEμ),COST\left(c,E\right)=\mu+(1-P)E=E-(PE-\mu), (1)

which means that the benefit of using cc w.r.t. EE is (PEμ)(PE-\mu) (see Figure 1). COST(c,E)COST(c,E) as a function of the rate rr of cc is given by

COST(c,E)=Pr+(1P)E=EP(Er),COST\left(c,E\right)=Pr+(1-P)E=E-P(E-r), (2)

implying that the benefit of cc w.r.t. EE is P(Er)P(E-r). This means that an optimal strategy for this case is to toss cc if and only if its rate is smaller than EE.

Refer to caption
Figure 1: Benefit for a given penalty. A coin c=(P,μ)c=(P,\mu) is beneficial for penalty EE iff (P,μ)(P,\mu) lies below the line μ=PE\mu=PE, and the benefit of cc w.r.t. EE is PEμPE-\mu. Thus both c1c_{1} and c2c_{2} are beneficial for EE. The benefit of c2c_{2} is larger since it is further away from the line μ=PE\mu=PE, i.e. μ2μ1P2P1<E\frac{\mu_{2}-\mu_{1}}{P_{2}-P_{1}}<E.

In a natural extension of the “single coin single toss” game we are given a sequence of coins SEQ=(c1,,cn)SEQ=(c_{1},\ldots,c_{n}) and a penalty EE. Our task is to decide for each coin, in the given order, if it should be tossed or skipped, so that the expected cost of the implied game is minimized. For n=1n=1 this is the single coin single toss game. For n>1n>1 we use backwards induction: Suppose we have an optimal strategy for SEQ=(c2,,cn)SEQ^{\prime}=(c_{2},\ldots,c_{n}) and EE, whose cost is EE^{\prime}. Then, by a simple calculation, an optimal strategy for SEQSEQ and EE is: toss c1c_{1} iff r1<Er_{1}<E^{\prime}, and then, if the coin rolls on tail, continue with the optimal strategy for SEQSEQ^{\prime} and EE.

2.2 Multiple simple coins, single toss

Suppose next that we are given a (finite) set 𝒞\mathcal{C} of simple coins and a penalty EE, and we wish to select an optimal coin c𝒞c\in\mathcal{C} which minimizes COST(c,E)COST(c,E), the cost of the single toss game. Let c=(P,μ)c=(P,\mu). By Equation (1), COST(c,E)COST(c,E) is minimized if and only if the point c=(P,μ)c=(P,\mu) lies below the line μ=PE\mu=PE and at a maximal distance (see Fig. 1).

2.3 Reusable simple coins, multiple tosses

Suppose now that the coins in 𝒞\mathcal{C} are reusable, that is, we may toss each coin in 𝒞\mathcal{C} multiple times. An elementary calculation shows that if there is no bound on the number of tosses, then tossing a coin of minimal possible rate rminr_{min} until it rolls on one yields an expected cost rminr_{min}. Thus an optimal strategy is: if rmin<Er_{min}<E then toss a coin cminc_{min} of rate rminr_{min} until it rolls on one, else pay the penalty EE and terminate.

Assume now that we are allowed to make no more than kk tosses for some k0k\geq 0. Given a set of reusable simple coins 𝒞\mathcal{C} and a penalty EE, if rminEr_{min}\geq E then do nothing and pay the penalty EE. Else an optimal strategy is obtained again by a backwards induction:

If k=0k=0 or ErminE\leq r_{min} then do nothing and pay the penalty EE. So assume that E>rminE>r_{min}, and let Ek=Ek(𝒞,E,k)E_{k}=E_{k}(\mathcal{C},E,k) be the expected cost of an optimal strategy for set of coins 𝒞\mathcal{C}, penalty EE and kk tosses (in particular E0=EE_{0}=E). Then Ek>rminE_{k}>r_{min} and an optimal strategy for k+1k+1 tosses is obtained by first selecting and tossing a coin ck+1𝒞c_{k+1}\in\mathcal{C} which minimizes COST(ck+1,Ek)COST(c_{k+1},E_{k}) as in Section 2.2 (note that COST(ck+1,Ek)<EkCOST(c_{k+1},E_{k})<E_{k} since Ek>rminE_{k}>r_{min}); if ck+1c_{k+1} rolls on one then stop, else execute the optimal strategy for 𝒞,E\mathcal{C},E and kk. Thus Ek+1=COST(ck+1,Ek)>rminE_{k+1}=COST(c_{k+1},E_{k})>r_{min}.

2.4 One-time simple coins, multiple tosses

We now assume that each coin in 𝒞\mathcal{C} can be tossed at most once, and we are allowed to toss as many coins as we wish.

Consider first a variant of this game in which termination is possible only if either some coin rolls on one, or after all coins rolled on zero. We note that this variant is, in fact, the problem of optimal ordering of independent tests that was studied in [1], where each coin corresponds to a test, and it is needed to check if at least one test fails.

A strategy for this latter game is a permutation of all the available coins. Thus given a set of nn one-time simple coins 𝒞={c1,,cn}\mathcal{C}=\{c_{1},\ldots,c_{n}\}, where ci=(Pi,μi)c_{i}=(P_{i},\mu_{i}), and a nonnegative penalty EE, we need to find an optimal ordering of the coins in 𝒞\mathcal{C}, which minimizes the expected cost.

The expected cost for ordering SEQ=(c1,c2,,cn)SEQ=(c_{1},c_{2},...,c_{n}) and penalty EE is given by:

COST(SEQ,E)=P1μ1+(1P1)P2(μ1+μ2)++(1P1)(1P2)(1Pn)(μ1++μn+E).\begin{array}[]{lll}COST(SEQ,E)&=&{P_{1}\mu_{1}+(1-P_{1})P_{2}(\mu_{1}+\mu_{2})+\ldots}\\ &+&{(1-P_{1})(1-P_{2})\cdots(1-P_{n})(\mu_{1}+\cdots+\mu_{n}+E)}.\end{array} (3)

By straightforward induction, COST(SEQ,E)COST(SEQ,E) can also be expressed as the following convex combination of the coin rates r1,,rnr_{1},\ldots,r_{n} and EE.

COST(SEQ,E)=P1r1+(1P1)P2r2++(1P1)(1Pi1)Piri++(1P1)(1Pn)E.\begin{array}[]{lll}COST(SEQ,E)&=&P_{1}r_{1}+(1-P_{1})P_{2}r_{2}+\ldots+(1-P_{1})\cdots(1-P_{i-1})P_{i}r_{i}\\ &+&\ldots~{}~{}+(1-P_{1})\cdots(1-P_{n})E.\end{array} (4)

Equation (4) implies the following useful lemma:

Lemma 1.

Let SEQ=(c1,,cn)SEQ=(c_{1},\ldots,c_{n}), where ck(Pk,rk),k=1,,nc_{k}\sim(P_{k},r_{k}),k=1,\ldots,n, and let SEQSEQ^{\prime} be obtained from SEQSEQ by interchanging cic_{i} and ci+1c_{i+1}. If riri+1r_{i}\geq r_{i+1} then COST(SEQ,E)COST(SEQ,E)COST(SEQ^{\prime},E)\leq COST(SEQ,E), with equality iff ri=ri+1r_{i}=r_{i+1}.

Proof.

By substituting in Equation (4) we get

COST(SEQ,E)COST(SEQ,E)=(k=1i1(1Pk))PiPi+1(ri+1ri),COST(SEQ^{\prime},E)-COST(SEQ,E)=\bigg{(}\prod_{k=1}^{i-1}(1-P_{k})\bigg{)}P_{i}P_{i+1}(r_{i+1}-r_{i}),

which is negative for ri>ri+1r_{i}>r_{i+1}, and equals zero iff ri=ri+1r_{i}=r_{i+1}. ∎

Lemma 1 implies:

Lemma 2.

Let 𝒞={c1,,cn}\mathcal{C}=\{c_{1},\ldots,c_{n}\} be a set of one-time simple coins, where the rate of cic_{i} is rir_{i}. Then for each penalty EE and each permutation π\pi, (cπ(1),,cπ(n))(c_{\pi(1)},\ldots,c_{\pi(n)}) is an optimal ordering of 𝒞\mathcal{C} w.r.t EE if and only if rπ(i)rπ(i+1)r_{\pi(i)}\leq r_{\pi(i+1)} for i=1,,n1i=1,\ldots,n-1.

Observe that the optimal orderings of a set of coins are independent of the value of the penalty EE. We note that Lemma 2 is equivalent to Theorem 1 of [1] which considered optimal ordering of independent tests.

Assume now that the player can terminate the game at any time (i.e., even if no coin rolled on one and some coins were not tossed yet). By Lemma 2 and the comment at the end of Section 2.1, an optimal strategy is obtained by an optimal ordering of the coins in 𝒞\mathcal{C} whose rates are smaller than EE.

Lemma 3.

The optimal strategies for a set 𝒞\mathcal{C} of one-time simple coins and a penalty EE are obtained by the optimal orderings of the coins in 𝒞\mathcal{C} whose rates are smaller than EE.

2.4.1 One-time simple coins, bounded number of tosses

Assume now that the coins are not reusable, and we may use at most kk coins for some k0k\geq 0. This problem can be solved by the following dynamic programming algorithm. First sort the coins whose rates are smaller than EE by increasing rates (ties are broken arbitrarily). Let the sorted list be (c1,,cn)(c_{1},\ldots,c_{n}), where ci=(Pi,μi)c_{i}=(P_{i},\mu_{i}).
For i=1,,ni=1,\ldots,n and j=0,,max(k,ni+1)j=0,\ldots,\max(k,n-i+1), let OPT(i,j)OPT(i,j) be the value of the optimal strategies for the sequence (ci,ci+1,,cn)(c_{i},c_{i+1},\ldots,c_{n}) and penalty EE which use at most jj coins. Thus our task is to find OPT(1,k)OPT(1,k). This can be done in knkn steps by setting OPT(i,0)=EOPT(i,0)=E for i=1,,ni=1,\ldots,n, OPT(n,j)=μn+(1Pn)EOPT(n,j)=\mu_{n}+(1-P_{n})E for j1j\geq 1, and then using the following recursive formula for i=n1,n2,,1,j=1,2ki=n-1,n-2,\ldots,1,j=1,2\ldots k:

OPT(i,j)=min(OPT(i+1,j),μi+(1Pi)OPT(i+1,j1)).OPT(i,j)=\min\bigg{(}OPT(i+1,j),~{}~{}~{}\mu_{i}+(1-P_{i})OPT(i+1,j-1)~{}~{}\bigg{)}.

This implies the following.

Lemma 4.

Given a set 𝒞\mathcal{C} of nn one-time simple coins and bound kk on the number of tosses, an optimal strategy for the implied game can be found in O(kn)O(kn) time.

The results for simple coins are summarized in Table 1.

Table 1: Optimal solutions for Simple Coins
#coins Reuse Tosses Discussed Comments
1 No 1 Section 2.1 Toss if rate<Erate<E
1 Yes Unlimited rate<Erate<E\rightarrow toss until success
nn No Unlimited, order given Backwards induction
nn Yes Unlimited Section 2.3 Toss cminc_{min} until success
nn Yes Bounded Backwards induction
nn No Unlimited Lemma 3 Toss by increasing rates
nn No Bounded Lemma 4 Backwards dynamic programming

3 Discrete coins

Refer to caption
Figure 2: A: LdL_{d}, the supporting line for dd and EdE_{d}, is a supporting line of the convex hull of μ={c,d,f}\mu=\{c,d,f\}. B: The rate of cc (i.e., the slope of the dashed line segment connecting cc to the origin) is smaller than the rate of dd, (the slope of the line connecting dd to the origin).

An A-coin μ\mu is discrete if its domain DμD_{\mu} is finite and contains at least two simple coins. Given a penalty E>0E>0, COST(μ,E)COST(\mu,E) is naturally defined as

COST(μ,E)=mincμCOST(c,E).COST(\mu,E)=\min_{c\in\mu}COST(c,E).

An A-coin μ\mu can be viewed as the set of the simple coins {(P,μ(P)):PDμ}\{(P,\mu(P)):P\in D_{\mu}\}. We assume that this set does not contain redundant coins, in the sense of the following definitions.

Definition 1.

A coin cμc\in\mu is essential for μ\mu (or just essential when μ\mu is clear) if there is a penalty EcE_{c} s.t. for any other coin dμd\in\mu, COST(c,Ec)<COST(d,Ec)COST(c,E_{c})<COST(d,E_{c}). Given such cc and EcE_{c}, the supporting line for cc and EcE_{c} is the line LcL_{c} which contains cc and is parallel to the line μ=PEc\mu=PE_{c} (see Fig. 2).

Note that if cc is not essential then for each E>0E>0, COST(μ{c},E)=COST(μ,E)COST(\mu\setminus\{c\},E)=COST(\mu,E), meaning that cc can be removed from μ\mu without reducing its quality. Hence, we assume from now on that a discrete coin contains only essential simple coins.

Definition 2.

A discrete coin μ\mu is efficient if each coin in μ\mu is essential.

Efficient discrete coins posses nice geometrical properties, depicted in Fig. 2:

Lemma 5.

Let μ\mu be an efficient discrete coin. Then

  1. 1.

    μ\mu is a strictly convex function on DμD_{\mu}, and

  2. 2.

    The function r(P)=μ(P)/Pr(P)=\mu(P)/P is strictly increasing on DμD_{\mu}.

Sketch of proof..

Let c(Pc,rc)c\sim(P_{c},r_{c}) be any coin in μ\mu. Then LcL_{c}, the supporting line for cc and EcE_{c}, is a supporting line of the convex hull of μ\mu which contains cc but no other coin in μ\mu (see Fig. 2A). This proves (1).
To show (2), let d(Pd,rd)d\sim(P_{d},r_{d}) be another coin in μ\mu, where Pc<PdP_{c}<P_{d}. Then rc<Ecr_{c}<E_{c} (since cc lies below the line μ=PEc\mu=PE_{c}), and dd lies strictly above LcL_{c}, the supporting line for cc and EcE_{c}, whose slope is EcE_{c}. Hence rc<rdr_{c}<r_{d} (see Fig. 2B). ∎

3.1 Reusable discrete coins

Optimal strategies for reusable discrete coins are implied by such strategies for sets of simple coins: Given a set 𝒞\mathcal{C} of discrete coins and a penalty EE, let 𝒞\mathcal{C}^{\prime} be the union of the discrete coins in 𝒞\mathcal{C}. Applying the optimal strategies for reusable simple coins presented in Section 2.3 on 𝒞\mathcal{C}^{\prime} and EE yields optimal strategies for 𝒞\mathcal{C} and EE. For example, when the number of tosses is unbounded, 5 implies the following strategy for a reusable efficient discrete coin μ\mu: Let cmin(Pmin,rmin)c_{min}\sim(P_{min},r_{min}) be the coin with the minimum success probability in μ\mu. If E>rminE>r_{min} then repeatedly toss cminc_{min} until it rolls on one, else pay the penalty EE and terminate.

3.2 One-time discrete coins

Suppose we are given a sequence of one-time discrete coins and we need to decide for each coin μ\mu, in its turn, whether to toss a simple coin from μ\mu, and if so which one. Then we can use a simple extension of the strategy for simple coins in Section 2.1: Given an optimal strategy for a sequence (μ2,,μn)(\mu_{2},\ldots,\mu_{n}) with optimal cost EE^{\prime}, an optimal strategy for (μ1,μ2,,μn)(\mu_{1},\mu_{2},\ldots,\mu_{n}) is obtained by skipping μ1\mu_{1} if COST(μ1,E)ECOST(\mu_{1},E^{\prime})\geq E^{\prime}, and tossing a coin cμ1c\in\mu_{1} which minimizes COST(μ1,E)COST(\mu_{1},E^{\prime}) and upon failure executing the optimal strategy for (μ2,,μn)(\mu_{2},\ldots,\mu_{n}) otherwise.

Finding an optimal strategy for one-time discrete coins when the sequence is not given is complicated by the fact that we need to decide which simple coin should be selected from each discrete coin (if any) before the order of tosses is known. Once these coins are selected, all we need to do is to toss them in an increasing order of their rates, until some coin rolls on one (or all coins roll on zero), as discussed in Section 2.4. Thus, the strategy is determined by the way the simple coins are chosen from the given discrete ones. We next show that such a selection is NP Hard even in a highly restricted variant of the problem.

3.2.1 The {0,1}\{0,1\} discrete coins problem

We now present a restricted version of the A-coins problem—the {0,1}\{0,1\} A-coins problem, and prove that it is NP hard. An instance (𝒞,E)(\mathcal{C},E) for this problem consists of a set 𝒞={A1,,An}\mathcal{C}=\{A_{1},\ldots,A_{n}\} of one-time discrete coins, where each AiA_{i} contains two coins ci,dic_{i},d_{i}, s.t. the rate of all cic_{i} coins is 0 and the rate of all did_{i} coins is 11, i.e., ci=(0,Pi,0)c_{i}=(0,P_{i,0}) and di=(Pi,1,Pi,1)d_{i}=(P_{i,1},P_{i,1}), where 0Pi,0<Pi,11,i=1,,n0\leq P_{i,0}<P_{i,1}\leq 1,i=1,\ldots,n. Let hi=1Pi,0h_{i}=1-P_{i,0} and i=1Pi,1\ell_{i}=1-P_{i,1}; then h=(h1,,hn)h=(h_{1},\ldots,h_{n}) and =(1,,n)\ell=(\ell_{1},\ldots,\ell_{n}) are the failure probability vectors of cic_{i}’s and did_{i}’s (note that hi>ih_{i}>\ell_{i} for all ii).

NP Hardness of the {0,1}\{0,1\} discrete coin problem

Consider an instance to the {0,1}\{0,1\} problem with penalty E>1E>1, and let D=E1D=E-1. By Lemma 3 an optimal strategy for this instance is obtained by selecting a set SInS\subseteq I_{n} of indices ii for which the coin cic_{i} is chosen, and tossing the coins in SS first. The cost of this strategy can be calculated as follows: charge each event (sequence of tosses) in which the first |S||S| tosses are zero by one, and in addition charge the event in which all tosses are zero by DD. The resulting cost is

COSTh,,D(S)=iShi(1+DiInSi).COST_{h,\ell,D}(S)=\prod_{i\in S}h_{i}\left(1+D\cdot\prod_{i\in I_{n}\setminus S}\ell_{i}\right). (5)

For a vector a=(a1,,an)a=(a_{1},\ldots,a_{n}), let prod(a)prod(a) be the product i=1nai\prod_{i=1}^{n}a_{i}. Then [iInS]i=prod()iSi\prod_{[i\in I_{n}\setminus S]}\ell_{i}=\frac{prod(\ell)}{\prod_{i\in S}\ell_{i}}. Hence, letting bi=ihi<1b_{i}=\frac{\ell_{i}}{h_{i}}<1 and b=(b1,,bn)b=(b_{1},\ldots,b_{n}), we can rewrite (5) as a function of hh and bb:

COSTh,b,D(S)=iShi+Dprod()iSbiCOST_{h,b,D}(S)=\prod_{i\in S}h_{i}+\frac{D\cdot prod(\ell)}{\prod_{i\in S}b_{i}} (6)

Let HS=iShiH_{S}=\prod_{i\in S}h_{i} and BS=iSbiB_{S}=\prod_{i\in S}b_{i}. Then Equation (6) can be rewritten as

COST,b,C(S)=HS+CBS,COST_{\ell,b,C}(S)=H_{S}+\frac{C}{B_{S}}, (7)

where C=Dprod()C=D\cdot prod(\ell). Consider now the case h=bh=b (i.e., i:i=hi2\forall i:\ell_{i}=h_{i}^{2}).Then we get

COSTh,C(S)=HS+CHS.COST_{h,C}(S)=H_{S}+\frac{C}{H_{S}}. (8)

Since the function f(x)=x+Cxf(x)=x+\frac{C}{x} has a unique minimum at x=Cx=\sqrt{C}, we get that COSTh,C(S)C+1CCOST_{h,C}(S)\geq\sqrt{C}+\frac{1}{\sqrt{C}}, with equality iff Hs=CH_{s}=\sqrt{C}. This implies the following:

Lemma 6.

Let 𝒞={Ai:i=1,,n}\mathcal{C}=\{A_{i}:i=1,\ldots,n\} be a set of A-coins with Ai={ci,di}A_{i}=\{c_{i},d_{i}\} where

ci(0,1hi),di(1,1hi2)c_{i}\sim(0,1-h_{i}),~{}~{}d_{i}\sim(1,1-h_{i}^{2})

and let C=D(prod(h))2C=D\cdot\left(prod(h)\right)^{2}. Let further OPT(𝒞,D+1)OPT(\mathcal{C},D+1) be the value of the optimal solution to the {0,1}\{0,1\} A-coins problem for 𝒞\mathcal{C} and penalty D+1D+1. Then

OPT(𝒞,D+1)C+1C,OPT(\mathcal{C},D+1)\geq\sqrt{C}+\frac{1}{\sqrt{C}},

with equality iff for some SInS\subseteq I_{n} it holds that HS=CH_{S}=\sqrt{C}.

Lemma 6 now implies:

Theorem 7.

The {0,1}\{0,1\} A-coins problem is NP Hard.

Outline of proof.

By a reduction from the NP hard subset product problem [2]:
Input: An n+1n+1 tuple of natural numbers (m1,,mn,N)(m_{1},\ldots,m_{n},N)
Property: There is a subset SInS\subseteq I_{n} s.t. iSmi=N\prod_{i\in S}m_{i}=N.

Given an instance (m1,,mn,N)(m_{1},\ldots,m_{n},N) to the subset product problem, we reduce it to an instance (𝒞,D+1)(\mathcal{C},D+1) to the {0,1}\{0,1\} problem in which 𝒞={A1,,An}\mathcal{C}=\{A_{1},\ldots,A_{n}\}, where for each ii, ci(0,11mi)c_{i}\sim(0,1-\frac{1}{m_{i}}) and di(1,11mi2)d_{i}\sim(1,1-\frac{1}{m_{i}^{2}}) - i.e., hi=1mih_{i}=\frac{1}{m_{i}} and i=1mi2\ell_{i}=\frac{1}{m_{i}^{2}}. In addition, we set DD to (prod(m)N)2\left(\frac{prod(m)}{N}\right)^{2}.

Let C=D(prod(h))2=D(prod(m))2C=D\cdot\left(prod(h)\right)^{2}=\frac{D}{\left(prod(m)\right)^{2}}. Then from Lemma 6 it follows that OPT(𝒞,D+1)C+1COPT(\mathcal{C},D+1)\geq\sqrt{C}+\frac{1}{\sqrt{C}}, and OPT(𝒞,D+1)=C+1COPT(\mathcal{C},D+1)=\sqrt{C}+\frac{1}{\sqrt{C}} iff there is a subset SInS\subseteq I_{n} s.t. iSmi=N\prod_{i\in S}m_{i}=N. The theorem follows. ∎

Note: The rates 0 and 1 in 7 could be replaced by any pair of distinct rates 0a<b0\leq a<b.

A summary of the results for discrete coins appears in Table 2 below.

Table 2: Solutions and hardenss results for Discrete Coins
#Coins Reuse Tosses Discussed Comments
1 No 1 Lemma 5
nn Yes Unlimited Section 3.1 Extensions of solutions
nn Yes Bounded for simple coins
nn No Unlimited, order given Section 3.2
nn No Unlimited Theorem 7 NP hard even for {0,1} coins

4 Continuous coins

A continuous adjustable coin, or CA-coin, enables the user to smoothly and continuously adjust the desired success probability. As a possible example, assume an algorithm which gets a composite integer nn as an input, and repeatedly attempts to find a divisor of nn. μ(P)\mu(P) is the cost (e.g. running time) of finding a divisor with probability PP, and the penalty EE is the loss implied by failing to find a divisor. The reusable version assumes that the algorithm is randomized, and the one time version assumes that the composite number is selected at random from a given distribution.

In general, a CA-coin is defined by a non-decreasing cost function μ(P):[Pmin,Pmax]\mu(P):[P_{min},P_{max}]\rightarrow{\cal R} where 0<Pmin<Pmax10<P_{min}<P_{max}\leq 1 are the minimum and maximum success probabilities supported by the coin. The (optimal) cost of a CA-coin for a penalty EE is naturally defined as

COST(μ,E)=minP[Pmin,Pmax]COST(P,μ(P))=minP[Pmin,Pmax1]μ(P)+(1P)E.COST(\mu,E)=\min_{P\in[P_{min},P_{max}]}COST(P,\mu(P))=\min_{P\in[P_{min},P_{max}1]}\mu(P)+(1-P)E.

We assume, as in the case of discrete A-coins, that each CA-coin is efficient, that is, for each P0[Pmin,Pmax]P_{0}\in[P_{min},P_{max}] there is a penalty EP0E_{P_{0}} s.t. COST((P,μ(P)),EP0)COST((P,\mu(P)),E_{P_{0}}) has a unique minimum at P=P0P=P_{0}. By arguments similar to the ones used in 5, this implies that a CA-coin μ\mu is a nonnegative convex function on [Pmin,Pmax][P_{min},P_{max}], and that r(P)=μ(P)/Pr(P)=\mu(P)/P is a strictly increasing function of PP. We restrict our attention to regular CA-coins μ(P)\mu(P) which are defined and twice continuously differentiable on the segment [Pmin,Pmax][P_{min},P_{max}]. This implies that

dμdP>0andd2μdP2>0,P(Pmin,Pmax).\frac{d\mu}{dP}>0~{}~{}\mbox{and}~{}~{}\frac{d^{2}\mu}{dP^{2}}>0,~{}~{}P\in(P_{min},P_{max})\,.

4.1 Single CA-coin, single toss

Suppose we are given a single (efficient) CA-coin and are allowed to toss it once at most. That is, given EE we must decide whether we wish to use our CA-coin at all, and if we do, which value of PP we should choose so as to minimize the expected cost. Recall that the expected cost is given by

COST(μ(P),P,E)=μ(P)+(1P)E=Pr(P)+(1P)E,COST\left(\mu(P),P,E\right)=\mu(P)+(1-P)E=P\cdot r(P)+(1-P)E\,,

where r(P)=μ/Pr(P)=\mu/P. Differentiating COSTCOST with respect to PP we obtain

dCOSTdP=dμdPE.\frac{dCOST}{dP}=\frac{d\mu}{dP}-E\,.

Differentiating r(P)r(P) and noting that it is strictly increasing yield

drdP=1P(dμdPr)>0.\frac{dr}{dP}=\frac{1}{P}\left(\frac{d\mu}{dP}-r\right)>0\,.

Observe that for P0(Pmin,Pmax)P_{0}\in(P_{min},P_{max}), for each coin c0=(P0,μ(P0))c_{0}=(P_{0},\mu(P_{0})) there is a unique supporting line, namely, the tangent to μ\mu at c0c_{0}. This yields the following conclusions. Let rmin=r(Pmin)r_{min}=r(P_{min}), ElowE_{low} be the derivative of μ\mu at PminP_{min}, and EhighE_{high} be the derivative of μ\mu at PmaxP_{max}—see Fig. 3. Then

  1. 1.

    If ErminE\leq r_{min} then the coin is not beneficial for EE, i.e., COST(μ,E)=ECOST(\mu,E)=E. Otherwise the coin is beneficial for EE, and the maximum benefit for a given penalty EE is attained as follows:

  2. 2.

    If rmin<EElowr_{min}<E\leq E_{low} then the benefit is maximized at PminP_{min}.

  3. 3.

    If Elow<E<EhighE_{low}<E<E_{high} then the maximal benefit is attained at the unique internal value Popt(Pmin,Pmax)P_{opt}\in(P_{min},P_{max}), where dμdP=E\frac{d\mu}{dP}=E.

  4. 4.

    If EhighEE_{high}\leq E then the benefit is maximized at PmaxP_{max}.

Refer to caption
Figure 3: cmin=(Pmin,μ(Pmin))c_{min}=(P_{min},\mu(P_{min})), cmax=(Pmax,μ(Pmax))c_{max}=(P_{max},\mu(P_{max})), and rmin=μ(Pmin)Pminr_{min}=\frac{\mu(P_{min})}{P_{min}}. If E<rminE<r_{min} then cminc_{min} lies above the line μ=PE\mu=PE, meaning that the CA-coin is not beneficial for EE. For E(rmin,Elow]E\in(r_{min},E_{low}] any supporting line of μ=PE\mu=PE passes through cminc_{min}. For E(Elow,Ehigh)E\in(E_{low},E_{high}) there is a unique supporting line that passes through an internal point of the coin, and for E[Ehigh,)E\in[E_{high},\infty) any supporting line passes through cmaxc_{max}.

4.2 Reusable CA-coins

Suppose next that we are given a single regular CA-coin which we may toss multiple times, selecting PP for each toss. The optimal strategy for minimizing the expected cost as a function of the number of tosses we are allowed, is obtained recursively from the observations of the previous subsection 4.1. If the number of tosses is unlimited and rmin<Er_{min}<E, then we can reduce the expected cost to rminr_{min} by repeatedly tossing the coin with P=PminP=P_{min} until we succeed. If the number of tosses is bounded then we can use the recursive approach described in Section 2.3.

When we are given a few regular CA-coins {μ1,,μk}\{\mu_{1},\ldots,\mu_{k}\} which we may toss multiple times, we adapt a variant of strategies used in Sections 2.3 and 3.2: whenever we need to toss a coin for a given penalty EE, we select μj\mu_{j} for which COST(μj,E)COST(\mu_{j},E) is minimized. This can be done by computing COST(μi,E)COST(\mu_{i},E) for all i[1,k]i\in[1,k].

5 Conclusion

We present the concept of adjustable coins, which aims to model a scenario in which various algorithms for solving a given problem can be applied: Each such algorithm is modeled by an adjustable coin, which is characterized by a cost and a probability of success. The related optimization problem is: Given a set of independent A-coins and a penalty for failing to solve the problem, find a sequence of coin-tosses which minimizes the expected cost, subject to possible further restrictions.

We note that all our solutions are by offline algorithms, which require that the full set (or sequence) of coins is given before the first coin is tossed. An interesting problem is what conditions enable useful algorithms which use only partial information on the available coins (e.g., that the coins are drawn from a known distribution, or that only a limited number of coins is known ahead of time).

References

  • [1] D. Berend, R. Brafman, S. Cohen, S.E. Shimony, and S. Zucker. Optimal ordering of independent tests with precedence constraints. Discrete Applied Mathematics, 162:115 – 127, 2014.
  • [2] S. Moran. General approximation algorithms for some arithmetical combinatorial problems. Theoretical Computer Science, 14(3):289 – 303, 1981.