The stochastic bilevel continuous knapsack problem with uncertain follower's objective

08/27/2021 ∙ by Christoph Buchheim, et al. ∙ TU Dortmund TU Dresden 0

We consider a bilevel continuous knapsack problem where the leader controls the capacity of the knapsack, while the follower chooses a feasible packing maximizing his own profit. The leader's aim is to optimize a linear objective function in the capacity and in the follower's solution, but with respect to different item values. We address a stochastic version of this problem where the follower's profits are uncertain from the leader's perspective, and only a probability distribution is known. Assuming that the leader aims at optimizing the expected value of her objective function, we first observe that the stochastic problem is tractable as long as the possible scenarios are given explicitly as part of the input, which also allows to deal with general distributions using a sample average approximation. For the case of independently and uniformly distributed item values, we show that the problem is #P-hard in general, and the same is true even for evaluating the leader's objective function. Nevertheless, we present pseudo-polynomial time algorithms for this case, running in time linear in the total size of the items. Based on this, we derive an additive approximation scheme for the general case of independently distributed item values, which runs in pseudo-polynomial time.



There are no comments yet.


page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

In many real-world optimization problems, more than one decision-maker is involved. Often, decisions are taken in a hierarchical order: the first actor takes a decision that determines the feasible set and objective function of the second actor, whose decision in turn may influence the objective value of the first actor. Formally, such problems may be modeled as bilevel optimization problems, where the two decision-makers are often called leader and follower. Typical applications of bilevel optimization arise when the general rules of a system (e.g., an energy market or a transport system) are determined by one actor (e.g., some regulatory commission or some large logistics company) while the other actors (e.g., energy producers or subcontractors) try to optimize their own objectives within the rules of the system. For general introductions to bilevel optimization, we refer to [5, 7, 8].

Bilevel optimization problems often turn out to be NP-hard. This is the case, in general, even when all constraints and objective functions are linear [11]. A notable exception is the bilevel continuous knapsack problem [8]: here, the leader controls the capacity of the knapsack, while the follower chooses a feasible packing maximizing his own profit. The leader’s aim is to optimize an objective function that is linear in the chosen capacity and in the follower’s chosen solution. However, the leader’s item values may differ from the follower’s item values. This problem can be solved efficiently by first sorting the items according to the follower’s profits and then enumerating the capacities corresponding to the total size of each prefix in this ordering; see Section 2.1 for more details. Applications of the bilevel knapsack problem considered here arise in, e.g., revenue management [1].

In practice, however, it is very likely that the leader does not know the follower’s subproblem exactly. It is thus natural to combine bilevel optimization with optimization under uncertainty. To the best of our knowledge, uncertain bilevel optimization problems were first considered in [15]. For a survey on stochastic bilevel linear optimization, dealing in particular with structural properties of such problems, we refer to [4]. A thorough review of literature on stochastic bilevel linear optimization can be found in [12].

Regarding the bilevel continuous knapsack problem under uncertainty, the robust optimization approach has been investigated in depth in [2]

. It is assumed that the vector of follower’s item values is unknown to the leader. This implies that the follower’s order of preference for the items is now uncertain. However, according to the robust optimization paradigm, the leader knows a so-called

uncertainty set containing all possible (or likely) realizations of this vector. The aim is to find a capacity leading to an optimal worst-case objective value over all these realizations. Among other things, it is shown that the resulting problem is still tractable under discrete or interval uncertainty – the latter case being nontrivial here –, while it turns out to be NP-hard for budgeted uncertainty (which is sometimes called Gamma uncertainty) and for ellipsoidal uncertainty, among others. Complexity questions for general robust bilevel optimization problems have been settled in [3].

In the following, we consider the stochastic bilevel continuous knapsack problem. The follower’s item values are still unknown to the leader, but now given by probability distributions. Instead of the worst case, we are interested in optimizing the expected value. The problem can be written as


where  denotes the capacity determined by the leader and  are the optimization variables of the follower. As  is a random vector in the stochastic setting, the same is true for the follower’s optimum solution  and the leader’s objective value . The leader’s aim is now to optimize the expected value of the latter. For the sake of simplicity, we do not distinguish between the optimistic and the pessimistic view (which are the two standard ways to handle ambiguous follower’s optimal solutions) in this formulation. However, the results presented in the following hold in both settings.

We are interested in the computational complexity of the stochastic optimization problem (SP), which of course depends strongly on the underlying probability distribution of . Not surprisingly, it is highly relevant whether item values are independently distributed or not. In the latter case, we observe that the stochastic problem can be solved efficiently in case of a discrete distribution, assuming that all realizations of the follower’s objective vector are given explicitly as part of the input; see Section 3. Using standard methods, this result could be used to design a sample average approximation scheme for arbitrary distributions.

Our main results apply to the case of independently distributed item values. Even for the most basic setting where each item value is distributed uniformly on either a finite set or an interval, we show that the stochastic problem turns out to be #P-hard; see Section 4.1. It is thus unlikely that an efficient algorithm exists for solving the problem exactly. In fact, even the computation of the objective value resulting from a given capacity choice is #P-hard in these cases, and the same is true for finding a multiplicative approximation for any desired factor. However, all results only show weak #P-hardness. In fact, we also devise a pseudo-polynomial algorithm for the mentioned cases in Section 4.2, running in time linear in the total size of all items.

Finally, in Section 5

, we consider general distributions with independent item values, given only by oracles for the cumulative distribution functions and the quantile functions. Assuming that these oracles can be queried in constant time, we devise an algorithm for solving (

SP) with an arbitrarily small additive error . The running time of this algorithm is pseudo-polynomial in the problem data and linear in . The idea of this approach is to approximate the given distribution by a componentwise finite distribution and then to apply the main ideas used for the pseudo-polynomial algorithm of Section 4.2.

2 Preliminaries

We start with basic observations concerning the stochastic bilevel continuous knapsack problem. We first have a closer look at the deterministic problem variant in Section 2.1. Subsequently, in Section 2.2, we introduce notation and list some basic observations concerning the stochastic problem (SP).

2.1 The underlying certain problem

As mentioned in the introduction, the deterministic version of the bilevel continuous knapsack problem can be solved efficiently [8]. Since our algorithms for the stochastic case build on this, we now describe the solution approach in more detail. The deterministic bilevel continuous knapsack problem can be formulated as follows, using the same notation as in the stochastic problem (SP):


The leader’s only variable is , which can be considered the knapsack’s capacity. The follower’s variables are , i.e., the follower fills the knapsack with a subset of the objects, where also fractions are allowed. The item sizes , the follower’s item values , the capacity bounds as well as the leader’s item values  and a scalar  are given. The latter can be thought of as a price the leader has to pay for providing one unit of knapsack capacity. For the following, we define  and assume that and . Moreover, since we are mostly interested in complexity results, we assume throughout that  and . Finally, we will use the notation  for .

As usual in bilevel optimization, we have to be careful in case the follower’s optimal solution is not unique. In this case, the model (P) is not well-defined. The standard approach is to distinguish between the optimistic setting, in which the follower always chooses one of his optimal solutions that is best possible for the leader, and the pessimistic setting, where the follower chooses an optimal solution that is worst possible for the leader. The former case is equivalent to considering the follower’s variables  being under the leader’s control as well. However, regarding the results presented in this paper, there are no relevant discrepancies between the two cases. For the sake of simplicity, we assume in this section that the follower’s profits , , are pairwise distinct and nonzero, so that his optimal solution is unique for any capacity .

Indeed, the follower in (P) solves a continuous knapsack problem with fixed capacity . This can be done, for example, using Dantzig’s algorithm [6]: by first sorting the items, we may assume

for some . The idea is then to pack all items with positive profit into the knapsack, in this order, until it is full. More formally, if , all items with positive profit can be taken, so an optimum solution is for and  else. Otherwise, we consider the critical item

and an optimum solution is given by


We now turn to the leader’s perspective. As only the critical item , but not the ordering depends on , the leader can compute the described order of items once and then consider the behavior of the follower’s optimum solution  when changes. Every in (1) is a continuous piecewise linear function in , of the form


for  and for , and constantly zero for . The leader’s objective function is given by the corresponding values and thus corresponds to a weighted sum of the functions  for and :


Note that this piecewise linear function is well-defined and continuous with vertices in the points , , in which the critical item changes from  to . The leader has to maximize over the range . As is piecewise linear, it suffices to evaluate it at the boundary points  and  and at all feasible vertices, i.e., at all points  for  such that . By computing  incrementally, Problem (P) can be solved in  time, which is the time needed for sorting.

2.2 Basic definitions and observations

In the stochastic version of the problem, the vector

of follower’s item values is seen as a random variable having a known distribution. The follower’s optimum solution

and the leader’s objective value depend on the realization of and hence are also random variables. The leader optimizes the expected value .

If two different items have the same profit or an item has profit zero, the follower’s optimal solution might be ambiguous. For simplicity, we assume throughout this paper that the profits of two different items almost surely disagree and that the profit of each item is almost surely nonzero, i.e.,


If  follows a continuous distribution, this assumption is always satisfied. In case of a finite distribution, it can be obtained, if necessary, by a small perturbation of the entries in the support of . Using an appropriate perturbation, both the optimistic and the pessimistic setting can be modeled. In particular, we do not need to distinguish between these two settings in the following because under Assumption (4), the follower’s optimal solution is almost surely unique.

For fixed , we have seen in Section 2.1 that for and are piecewise linear functions in . These functions do not depend on directly, but only on the implied order of the items when the latter are sorted according to the values . Hence, the expected values


can be seen as expected values with respect to a probability distribution on all permutations of the items . As the number of permutations is finite, this implies that the functions and are finite convex combinations of functions and , respectively, for appropriate values of . In particular, they are piecewise linear functions again. Since we assume the item sizes to be integral, the vertices of these functions all lie on integer points because this holds for the functions defined in (2) and (3).

This gives rise to a general algorithmic scheme for solving the stochastic problem (SP): enumerate all permutations  of  and compute the corresponding leader’s objective functions  as in (3), together with the probabilities that the values  are sorted decreasingly when permuted according to . Finally, sum all piecewise linear functions  to determine the leader’s objective , and maximize  over .

We emphasize that, depending on the given probability distribution of , it might be nontrivial to compute the probabilities in general. Moreover, due to the exponential number of permutations, this approach does not yield a polynomial time algorithm in general. In fact, we will show that such an efficient algorithm cannot exist for some probability distributions unless P  NP. However, for distributions with finite support, enumerating all values in the support yields an efficient algorithm, as we show in the next section. Although the above algorithm is not efficient for other distributions, it will be useful for our proofs to know the structure of the follower’s optimum solutions and the leader’s objective function as described above.

Besides the piecewise linear functions defined in (5) and (6), we will also make use of the values


for . The values describe the expected amount of item  that will be added when increasing the capacity from to . Together with  and the leader’s item values , they yield the slope of the leader’s objective function. Note that, by integrality of , the functions and are linear on . Whenever we deal with slopes of piecewise linear functions, in a nondifferentiable point, this refers to the slope of the linear piece directly left of this point, i.e., we always consider left derivatives.

For some probability distributions, it will turn out that not only the optimization in (SP), but also the computation of the values and is hard in general. However, we will devise pseudo-polynomial time algorithms in these cases that compute all values , from which one can solve (SP) in pseudo-polynomial time as well; see Section 4.2.

3 Distributions with finite support

Assuming that  has a finite support , i.e., that there exists a finite set of possible follower’s objectives  which occur with probabilities , respectively, the leader’s objective is given as a finite sum of the piecewise linear functions , where  is defined as in (3). Note that the definition in (3) depends on the order of the items given by the follower’s preferences, which in turn depends on .

Similarly to the algorithm described in Section 2.2, the following algorithm solves Problem (SP) for distributions with finite support: for every , use the algorithm described in Section 2.1 to compute the piecewise linear function  in time, and multiply each function  by the factor . Then maximize the resulting weighted sum, which is a piecewise linear function again. Note that the sum has linear segments and that it can be computed by sorting the vertices of all functions and traversing them from left to right while keeping track of the sum of the active linear pieces. This is possible in a running time of . Thus, we obtain

Theorem 1.

Assume that  is finitely distributed and that the input consists of the support  together with the corresponding probabilities. Then Problem (SP) can be solved in time.

The result of Theorem 1 suggests to address the general problem (SP), with an arbitrary underlying distribution of , by means of sample average approximation: for a given number , first compute  samples  of the random variable . Then apply the algorithm of Theorem 1 to the uniform distribution over the finite set  and let  be the resulting optimal value (which is a random variable again). Using general results from [16], one can show that  almost surely converges to the optimal value of (SP) for , and a similar statement holds for the set of optimal solutions; see [17]. The only assumption needed here is that sampling of  is possible.

4 Componentwise uniform distributions

In this section, we consider the version of (SP) where the distribution of is uniform on a product of either finite sets or continuous intervals. Equivalently, each component of is drawn independently and according to some (finite or continuous) uniform distribution. For both cases, we will show that (SP) cannot be solved efficiently unless P  NP. However, we will devise pseudo-polynomial time algorithms with a running time linear in the total item size . The algorithm for the finite case solves the problem not only for uniform, but also for arbitrary componentwise finite distributions.

4.1 Hardness results

Our first aim is to show that (SP

) is #P-hard in case of componentwise uniform distributions. The class #P contains all counting problems associated with decision problems belonging to NP, or, more formally, all problems that ask for computing the number of accepting paths in a polynomial time nondeterministic Turing machine. Using a natural concept of efficient reduction for counting problems, one can define a counting problem to be #P-hard if every problem in #P can be reduced to it. A polynomial time algorithm for a #P-hard counting problem can only exist if P 

 NP. In the following proofs, we will use the #P-hardness of the problem #Knapsack, which asks for the number of feasible solutions of a given binary knapsack instance [9].

In stochastic optimization with continuous distributions, problems often turn out to be #P-hard, and this is often even true for the evaluation of objective functions containing expected values. For an example, see [10], from where we also borrowed some ideas for the following proofs.

Theorem 2.

Problem (SP) with a finite componentwise uniform distribution of  is #P-hard.


We show the result by a reduction from #Knapsack. More precisely, for some given and , we will prove that one can compute

in polynomial time if the following instances of (SP) can be solved in polynomial time. In case , this is clear, so from now on, we assume that .

We define a family of instances of (SP), parameterized by : each of the instances has items, where

We set , and , and assume


The proof consists of two main steps. First, we investigate the structure of the leader’s objective functions for the described instances and show that by determining the slope of any of them at , up to a certain precision, we can compute

In the second step, we show how to determine this slope up to the required precision by solving a polynomial number of these instances in a bisection algorithm.

As described in Section 2.2, the leader’s objective function can be thought of as a weighted sum of piecewise linear functions corresponding to the permutations induced by different choices of , with weights being the probabilities of the permutations, respectively. For fixed , consider the set

of items the follower would choose before item . The corresponding piecewise linear function first has slope and then slope , since for all , and . The order of the items in does not matter to the leader because they all result in the same slope in her objective. The slope changes from to at . The slope would change back to at , but this is outside of the range of the leader’s objective.

The actual leader’s objective is now a weighted sum of such functions. For obtaining the weights, we only need to know the probabilities for different sets , because all resulting in the same also result in the same piecewise linear function . The probability distribution is chosen such that occurs with probability , while each other set has probability : first, if , we certainly have because holds with probability , for all . On the other hand, if , then each item is contained in with probability exactly . Indeed, means , hence , whereas  means , hence . Thus, the leader’s objective function is given as

where is the function that has slope for and slope afterwards. It follows that, for any ,


This shows that by computing for any fixed , we can determine the number

It is even enough to compute an interval of length less than containing because the number of feasible knapsack solutions is an integer and this gives an interval of length less than in which it must lie. This concludes the first step of our proof.

In the second step, we will describe a bisection algorithm to compute up to the required precision. We know that as it is a convex combination of values and . Starting with and , we iteratively halve the length of the interval  by setting either and or  and . After iterations, we have an interval of length containing , which allows to compute .

It remains to show how to determine whether or , in order to choose the new interval. To this end, we first maximize  for  over . This can be done by solving (SP) for the corresponding instance, which by our assumption is possible in polynomial time. Suppose the maximum is attained at . As a weighted sum of concave functions, is concave, and hence, we know that for all , and  for all . From (9), one can conclude that for all  and all . We derive that if , and  otherwise. ∎

Theorem 3.

Problem (SP) with a continuous componentwise uniform distribution of  is #P-hard.


The result can be shown by a similar proof to the one of Theorem 2: instead of the finite distribution used before, the continuous distribution

is considered, while fixing . The sets are defined as before, and it can be shown that each set has probability : if , we have that , hence , while implies , so that . Both events have probability . The rest of the proof is analogous, except for a small change in the computation in (9) due to the slightly different probabilities. ∎

Note that  is fixed in the proof of Theorem 3. In order to avoid this, one can consider instead, for sufficiently small .

Theorem 4.

Evaluating the objective function of Problem (SP) with a finite or continuous componentwise uniform distribution of  is #P-hard.


Using the same construction and notation as in the preceding proofs, we have shown that computing  is #P-hard. It follows that also evaluating is #P-hard. ∎

Note that the proof of Theorem 4, together with (6) and (8), implies that already the computation of the values and for some given and can be #P-hard. Moreover, the constructions in the proofs of Theorem 2 and 3 show that all stated hardness results still hold when . One can show that, since all follower’s item values in these constructions are positive, the hardness result also holds when assuming  and ; see [2].

Considering these results, it is a natural question whether (SP) can at least be approximated efficiently. Assuming , this question is well-defined, since all optimal values are nonnegative then, due to . However, it is easy to derive the following negative result, which excludes the existence of any polynomial time (multiplicative) approximation algorithm, unless P  NP.

Theorem 5.

For Problem (SP) with a finite or continuous componentwise uniform distribution of  and with , it is #P-hard to decide whether the optimal value is zero.


For any given instance of (SP) and any , we can efficiently construct a new instance of (SP) by adding an item  with leader’s value , size , and any distribution of  guaranteeing  for all . Let  and  denote the objective functions of the original and the extended problem, respectively. By construction, the follower will always choose item  first in the extended instance. Thus  for  and  for . In summary, we can polynomially reduce the decision of


to the decision of

Since the computation of an optimal solution for the original instance of (SP) can be polynomially reduced to problems of type (10), using a bisection algorithm, the desired result now follows from Theorems 2 and 3. ∎

4.2 Pseudo-polynomial time algorithms

We now present pseudo-polynomial time algorithms for the stochastic bilevel continuous knapsack problem in the #P-hard cases addressed in the previous section. These algorithms are based on a dynamic programming approach. As discussed in Section 2.2, the leader’s objective function is piecewise linear with vertices at integral positions , since the item sizes are assumed to be integral. Therefore, we could solve the problem by evaluating for  many values of , and  has polynomial size in the numerical values of the sizes . The quest for a pseudo-polynomial algorithm thus reduces to the computation of  for given . However, we have seen in the previous section that also the latter task is #P-hard in general.

Actually, as mentioned, even the computation of for given and  can be #P-hard. In the following, we will present algorithms for computing in pseudo-polynomial time for the distributions addressed above, i.e., for item values that are componentwise uniformly distributed on a finite set or on a closed interval. From one can compute using formula (7) and with that evaluate for all integral capacities using formula (6), which takes pseudo-polynomial time .

In order to compute , we first define the auxiliary function

for , , and , i.e., the probability that item  is profitable and that the total size of all items in  that the follower prefers over item is exactly . We then have


for all and . Indeed, for , the value  describes the probability that a percentage of exactly  of item  is packed when the capacity is , and hence  when the capacity is . The sum thus represents the probability that the percentage of item  being packed is increased by  when increasing the capacity from  to . Hence, the right hand side agrees with .

Note that  and  in the definition of  could be replaced equivalently by  and by Assumption (4), and the same is true in the following whenever comparing profits of different items.

Determining all probabilities would thus allow us to compute  and hence to solve Problem (SP) in pseudo-polynomial time. To this end, for , , , and , we next define


i.e., the probability that the total size of all items in with profit larger than  is exactly . For the following, let .

From now on we assume componentwise independent item values. Under this assumption, for finitely distributed item values, we then have


while for continuously distributed item values, we have



denotes the probability density function of the random variable 

. For all  and , it is easy to verify that

and, if  and ,


This recursive formula enables an incremental computation of for all , all , and . Using this, we can now develop pseudo-polynomial time algorithms for computing in case of independently and uniformly distributed item values, with supports being either finite sets or continuous intervals.

4.2.1 Finitely distributed item values

In this section, we assume componentwise finitely distributed item values. For , the value of item  has different realizations with probabilities , respectively. Let denote the maximum number of different values any item can take.

Lemma 6.

All probabilities for , , and can be computed in time .


Each such probability can be computed in time as

and the claim follows. ∎

Lemma 7.

Let and . Given the probabilities for all , the probabilities for all  can be computed in time .


We apply the recursive formula (15) in order to compute the desired probabilities . More specifically, setting and at the beginning, we iterate over all in an arbitrary order. For each such , we first compute

for all , with for , and then set and . After the last iteration, we then have computed for all . There are iterations and each iteration can be executed in time . ∎

Theorem 8.

For item values that are independently distributed on finite sets, Problem (SP) can be solved in time .


By Lemmas 6 and 7, all values for , , and can be computed in time . Next, all probabilities can be computed in time according to (13). Finally, all values  for and can be computed in time using and

for , which follows from (11). From one can compute in time  using (7) and with that evaluate for all  in time  using (6). ∎

In case the number of possible realizations for each component of  is bounded by a constant, e.g., when we have as in the proof of Theorem 2, the running time stated in Theorem 8 simplifies to .

4.2.2 Continuous uniformly distributed item values

In this section, we assume that the value  of item  is distributed uniformly on the continuous interval with . The key difference to the finite case discussed in the previous section is that we compute the probabilities  not for fixed , but as functions in . The involved probabilities are piecewise linear in . As a result, is a piecewise polynomial function in and the expected values can be computed as integrals over piecewise polynomial functions.

Consider and set . Let  with be the ascending enumeration of all elements in . For , , and , we have