The robust bilevel continuous knapsack problem

We consider a bilevel continuous knapsack problem where the leader controls the capacity of the knapsack and the follower’s proﬁts are uncertain. Adopting the robust optimization approach and assuming that the follower’s proﬁts belong to a given uncertainty set, our aim is to compute a worst case optimal solution for the leader. We show that this problem can be solved in polynomial time for both discrete and interval uncertainty. In the latter case, we make use of an algorithm by Woeginger [11] for a class of precedence constraint knapsack problems


Introduction
Bilevel optimization has received increasing attention in the last decades.The aim is to model situations where certain decisions are taken by a so-called leader, but then one or more followers optimize their own objective functions subject to the choices of the leader.The follower's decisions in turn influence the leader's objective, or even the feasibility of her decisions.The objective is to determine an optimal decision from the leader's perspective.In general, bilevel optimization problems are very hard to solve.Even in the case that both objectives and all constraints are linear, the bilevel problem turns out to be strongly NP-hard in general [17].Several surveys and books on bilevel optimization have been published recently, e.g., [9,11,12].
Our research is motivated by complexity questions.We investigate whether -and in which cases -taking uncertainty of some problem parameters into account renders a bilevel optimization problem significantly harder, where we focus on the robust optimization approach.In this approach, the uncertain parameters are specified by so-called uncertainty sets which contain all possible (or likely) values the parameters can attain; the aim is to find a solution that is feasible in each of these scenarios and that optimizes the worst case.Typical types of uncertainty sets that are used in robust optimization are finite sets, (general or special) polytopes, and ellipsoids.
In our investigation of the bilevel continuous knapsack problem, we only consider uncertainty in the coefficients of the follower's objective function.This is a very natural setting in bilevel optimization, as in practice the leader often does not know the follower's objective function precisely.A few other possible combinations of bilevel and robust optimization should be mentioned, in contrast to ours, as it can make a big difference what parameters are uncertain and from whose perspective.As already mentioned, we will investigate the case of an uncertain follower's objective function from the leader's perspective.One could also look at uncertainty in the leader's objective function (still from the leader's perspective) which corresponds to the single-level robust optimization setting with uncertain objective, ignoring the bilevel structure of the leader's problem.Yet another option would be to make the follower's problem uncertain in the singlelevel robust optimization sense, i.e., to assume that the follower's objective function is uncertain to the follower himself.In our opinion, the setting we chose is the most natural one and also the most interesting one because no results from single-level robust optimization can be applied directly.
Due to the hardness of deterministic bilevel optimization, it is not surprising that relatively few articles dealing with bilevel optimization problems under uncertainty, in particular using the robust optimization approach, have been published so far.In [8], the authors consider bilevel problems with linear constraints and a linear follower's objective, while the leader's objective is a polynomial.The robust counterpart of the problem, with interval uncertainty in the leader's and the follower's constraints, is solved via a sequence of semidefinite programming relaxations.In [26], a bilevel linear programming problem with the follower's objective vector lying in a polytopal uncertainty set is considered.A vertex enumeration approach is combined with a global optimality test based on an inner approximation method.Similar models have also been considered in a game-theoretic context; see, e.g., [20].More literature has been published on the stochastic optimization approach to bilevel optimization under uncertainty, where (some of) the problem's parameters are assumed to be random variables and the aim is to determine a solution optimizing the expected objective value; see, e.g., [18] and the references therein.
Contrary to our setting of an uncertain follower's objective function, one can assume that the leader knows the follower's objective function precisely, but that the follower does not necessarily choose his optimal solution.This leads to a closely related mathematical model, which corresponds to situations where the follower acts with so-called bounded rationality; this framework is also known as decision variable uncertainty.Multilevel optimization problems in which lower-level decision makers might deviate from their optimal values by a small amount are investigated in [2,3] under the notion of "near-optimal robustness".The authors show that the complexity does not increase when adding this type of uncertainty to a model [3].Similarly, in [29], it is assumed that the follower may choose a solution that is suboptimal to some degree in order to worsen the leader's objective value.The setting of [29] can be seen as a generalization of both pessimistic bilevel optimization and single-level robust optimization.
In classical single-level robust optimization, even in the case of uncertainty concerning only the objective function, some classes of uncertainty sets may lead to substantially harder robust counterparts, e.g., finite uncertainty sets in the context of combinatorial optimization [24].In other cases, the robust counterparts can be solved by an efficient reduction to the underlying certain problem.This is true in particular for the case of interval uncertainty, where each coefficient may vary independently within some given range.In this case, each interval may be replaced by one of its endpoints, depending on the direction of optimization, so that the robust counterpart is not harder than the underlying certain problem.For an overview of complexity results in robust combinatorial optimization under objective uncertainty, we refer the reader to the recent survey [5] and the references therein.We will show that the situation in case of interval uncertainty is more complicated in our robust bilevel optimization setting.
We concentrate on a bilevel continuous knapsack problem where the leader only controls the capacity, while the follower chooses the items, optimizing his own objective function.Without uncertainty, this problem is easy to solve, which makes it a good starting point for addressing the question of how much harder bilevel optimization problems can become when adding uncertainty.As mentioned above, linear bilevel optimization problems are NP-hard in general.As a general approach, not using any problem-specific information, bilevel problems are usually reformulated as single-level problems before being solved.For example, if the follower's problem is a linear program, it can be replaced by its Karush-Kuhn-Tucker conditions, allowing for a branch-and-bound or branch-andcut approach that branches over the resulting complementarity constraints; see, e.g., [16,23].However, the bilevel continuous knapsack problem can be solved in polynomial time by a direct combinatorial algorithm; see Section 2.
We only deal with the continuous problem version, i.e., the follower solving a continuous knapsack problem, which is also discussed in [12] as an introductory example.The variant of this problem where the follower solves a binary knapsack problem instead is introduced in [13] and further investigated in [4].Both articles devise pseudopolynomial algorithms for the problem.Other variants of bilevel knapsack problems include one where leader and follower each control a subset of the items and pack them into a common knapsack of fixed capacity [25], and one where leader and follower each have their own knapsack, but choose items from a common item set [14].All three variants are also investigated in [6] in terms of complexity and approximability.Algorithms for the continuous version of the problem in [14] can be found in [7,15].A stochastic version of the bilevel knapsack problem of [13] is considered in [30]: it is assumed that the capacity in the follower's problem depends on the leader's decision as well as an uncertain value, which is drawn from a discrete probability distribution.
A practical motivation to investigate the bilevel continuous knapsack problem under uncertainty is the possible application in revenue management that is also described in [4] and [25] for the respective variants of bilevel knapsack problems: the leader, who might be an investor or a company, hands a part of her savings over to the follower, an intermediary, who invests it, maximizing his own profit and giving back part of the returns to the leader.It is very natural to consider continuous variables in this application.Moreover, it is reasonable to consider the follower's objective uncertain, due to the inherent risk of investments and hence the investor's uncertainty about the intermediary's assessment of the expected returns.
While the certain bilevel continuous knapsack problem is easily solvable, it becomes much more involved when adding uncertainty in the follower's objective.It turns out that the interval uncertainty setting requires to deal with partial orders, more precisely, with the interval orders induced by the relations between the follower's profit ranges.Adapting an algorithm by Woeginger [28] for some precedence constraint knapsack problem, we show that the problem can still be solved in polynomial time.We also discuss why the case of finite uncertainty sets is tractable as well.For many other types of uncertainty sets, the robust bilevel continuous knapsack problem turns out to be NP-hard, and the same is true even for the problem of evaluating the leader's objective function, i.e., the adversary's optimization problem.We are able to show this for all common types of uncertainty sets and even special cases of them: we consider simplices as uncertainty sets, thus settling the more general cases of polytopal and Gamma-uncertainty, and uncertainty sets defined by norms, which includes the case of ellipsoidal uncertainty.For an overview and formal definitions of these classes of uncertainty sets, see, e.g., [5].
Our results also emphasize another significant difference to classical robust optimization: in general, it is not possible anymore to replace the uncertainty set by its convex hull and thus assume convexity without loss of generality.In fact, when restricting the possible scenarios in the interval case to the endpoints of the intervals, we show that the problem turns NP-hard.More precisely, the problem is NP-hard when the input consists of a finite set of realizations for each coefficient and these realizations arise independently.
The remainder of this paper is organized as follows.In Section 2, we introduce and discuss the certain variant of the problem.We then settle the cases of finite uncertainty sets in Section 3 and interval uncertainty in Section 4. The discrete uncorrelated case, where each coefficient varies in a finite set independently, is discussed in Section 5. Finally, uncertainty sets defined as simplices (Section 6) or by norms (Section 7) are discussed.Section 9 concludes.

Underlying certain problem 2.1 Problem formulation
We first discuss the deterministic variant of the bilevel optimization problem under consideration, in which the follower solves a continuous knapsack problem, while the leader determines the knapsack's capacity and optimizes another linear objective function than the follower.This problem is also discussed in [12], but we replicate the formulation and the algorithm here for sake of completeness.
First recall that an important issue in bilevel optimization is that the follower's optimal solution is not necessarily unique, but the choice among the optimal solutions might have an impact on the leader.The two main approaches here are the optimistic and the pessimistic one.In the former case, the follower is assumed to decide in favor of the leader, whereas in the latter case, he chooses the optimal solution that is worst for the leader.For more details, see e.g., [12,27].While often only the optimistic approach is considered, we will focus on the pessimistic one in this paper, since it combines more naturally with the concept of robustness that will be added to the problem later on.Indeed, both the pessimistic view of the follower and the robustness force the leader to consider the worst case with respect to some set of choices.However, all our results hold for the optimistic approach as well, making only small changes to the proofs necessary, which will be sketched for every result.
The pessimistic version of the problem, without uncertainty, can be formulated as follows, where the minimization over x represents the leader's pessimism about the follower's choice among his optimal solutions: The leader's only variable is b ∈ R, which can be considered as the knapsack's capacity.The follower's variables are x ∈ R n , i.e., the follower fills the knapsack with a subset of the objects, where also fractions are allowed.The item sizes a ∈ R n ≥0 , the follower's item values c ∈ R n >0 , the capacity bounds b − , b + ∈ R as well as the leader's item values d ∈ R n ≥0 and a number δ ≥ 0 are given.The latter can be thought of as a price the leader has to pay for providing one unit of knapsack capacity.We may assume 0 ≤ b − ≤ b + ≤ n i=1 a i and a > 0. For a given leader's choice b, due to the assumptions 0 ≤ b ≤ n i=1 a i and c > 0, every optimal solution of the follower's problem satisfies a ⊤ x = b.This can be used to show that the following three ways to formulate the leader's objective function are equivalent: Clearly, (b) and (c) are special cases of (a).An objective function d ⊤ x − δb of type (a) can be reformulated in the form of (c): and similarly in the form of (b): where ε := min{δ, min i∈{1,...,n} d i a i }.This proves that all three formulations are equivalent.Note that this equivalence still holds for the uncertain problem versions considered later on.As already indicated, we will use the third formulation from now on because it is the most compact one, i.e., we omit δ and assume d ∈ R n .

Solution algorithm
The follower solves a continuous knapsack problem with fixed capacity b.This can be done, for example, using Dantzig's algorithm [10]: by first sorting the items, we may assume an .The idea is then to pack the items into the knapsack in this order until it is full.More formally, if b = n i=1 a i , everything can be taken, so the optimal solution is x i = 1 for all i ∈ {1, . . ., n}.Otherwise, we consider the critical item k := min j ∈ {1, . . ., n} : j i=1 a i > b and an optimal solution is given by We now turn to the leader's perspective.As only the critical item k, but not the sorting depends on b, the leader can just compute the described order of items by the values c i a i and then consider the behavior of the follower's optimal solution x when b changes.The leader's objective function f is given by the corresponding values d ⊤ x:

. , n}
Note that this piecewise linear function is well-defined and continuous with vertices in the points b = j i=1 a i , in which the critical item changes from j to j + 1 Remark 1.The order of items and hence the follower's optimal solution is not unique if the profits c i /a i are not all different.In the optimistic approach, a follower would sort the items with the same profit in descending order of the values d i /a i , in the pessimistic setting in ascending order.If this is still not unique, there is no difference for the leader either.

Discrete uncertainty
Turning to the uncertain problem variant, we first consider the robust version of the problem where the follower's objective function is uncertain for the leader, and this uncertainty is given by a finite uncertainty set U ⊂ R n >0 containing the possible objective vectors c.We obtain the following problem formulation: The inner minimization problem can be interpreted as being controlled by an adversary, thus leading to an optimization problem involving three actors: first, the leader takes her decision b, then the adversary chooses a follower's objective c leading to a follower's solution that is worst possible for the leader, and finally the follower optimizes this objective choosing x.In the pessimistic view of the bilevel problem, the adversary can be assumed to also choose among the follower's optimal solutions if this is not unique, i.e., to minimize over c as well as x.
Note that the robust uncertainty we consider really concerns the interplay of leader and follower in the bilevel problem structure and that the setting differs greatly from just combining a bilevel optimization problem with a robust optimization problem.In particular, the adversary's problem is not the same as in a continuous knapsack problem under uncertainty because he is the leader's and not the follower's adversary, having the inverse of the leader's objective as his objective function.
Again, we aim at solving the problem from the leader's perspective, which can be done as follows: for every c ∈ U , consider the piecewise linear function f c as described in Section 2. The vertices of each f c can be computed in O(n log n) time, both in the optimistic and the pessimistic approach.The leader's objective function is then the pointwise minimum f := min Note that the tractability of the robust bilevel continuous knapsack problem with finite uncertainty set U can also be obtained in a straightforward way, at the cost of a higher running time: in order to maximize the piecewise linear function f over [b − , b + ], it suffices to consider the endpoints b − , b + , the vertices of the function f c for each c ∈ U , and the intersection between each pair of linear pieces of the functions f c and f c ′ with c, c ′ ∈ U .Obviously, all these candidates can be examined in polynomial time.

Interval uncertainty
We next address a robust version of the problem having the same structure as in Section 3, but now the uncertainty is given by an interval for each component of c.We thus consider In classical robust optimization, one could just replace each uncertain coefficient c i by an appropriate endpoint c − i or c + i and obtain a certain problem again.However, such a replacement is not a valid reformulation in the bilevel context.We will show that, in fact, the situation in the bilevel case is more complicated, even though we can still devise an efficient algorithm.
To simplify the notation, we define p − i := −c + i /a i and p + i := −c − i /a i for the remainder of this section.It turns out that interval orders defined by the intervals [p − i , p + i ] play a crucial role in the investigation.

Interval orders and precedence constraint knapsack problems
For the leader, the exact entries of c i in their intervals [c − i , c + i ] do not matter, but only the induced sorting that the follower will use.The follower sorts the items by their values c i /a i and we therefore have to consider the intervals [c − i /a i , c + i /a i ] induced by the uncertainty set.Intuitively speaking, two situations can arise for a pair (i, j) of items: either, their corresponding intervals are disjoint, say, c − i /a i > c + j /a j .In this case, i will precede j in every sorting induced by some adversary's choice c ∈ U .Otherwise, the two intervals intersect.Then, the adversary can decide which of the two items comes first by choosing the values c i and c j appropriately.
More formally, given U and a, the possible sortings are exactly the linear extensions of the partial order P that is induced by the intervals [p − i , p + i ], in the sense that we set Such a partial order is called an interval order.Note that the values c i /a i are actually sorted in decreasing order by the follower, but it is more common to read an interval order from left to right.Therefore, by the definition of p − i and p + i , the intervals were flipped, so that we can think of the follower sorting the negative values −c i /a i increasingly.
Note that, in the pessimistic problem version, intervals intersecting in only one point do not have to be treated differently from intervals intersecting properly, since the adversary choosing the same value c i /a i for several items will result in the order of these items that is worst for the leader anyway, due to the pessimism.
To solve the robust bilevel continuous knapsack problem with interval uncertainty, one could compute the partial order P and enumerate all linear extensions of P .Every linear extension corresponds to a sorting of the items the follower will use when the adversary has chosen c appropriately.Every sorting corresponds to a piecewise linear function, and the leader's objective function is the pointwise minimum of all these, as in Section 3.This approach does not have polynomial runtime in general, as there could be exponentially many linear extensions.However, it turns out that it is not necessary to consider all linear extensions explicitly and that the problem can still be solved in polynomial time.We will see that the adversary's problem for fixed b ∈ [b − , b + ] is closely related to the precedence constraint knapsack problem or partially ordered knapsack problem.This is a 0-1 knapsack problem, where additionally, a partial order on the items is given and it is only allowed to pack an item into the knapsack if all its predecessors are also selected; see, e.g., Section 13.2 in [22].
For the special case where the partial order is an interval order, Woeginger described a pseudopolynomial algorithm, see Lemma 11 in [28].There the problem is formulated in a scheduling context and is called good initial set.The algorithm is based on the idea that every initial set (i.e., prefix of a linear extension of the interval order) consists of • a head, which is the item whose interval has the rightmost left endpoint among the set, • all predecessors of the head in the interval order, and • some subset of the items whose intervals contain the left endpoint of the head in their interior, assuming that all interval endpoints are pairwise distinct.The algorithm iterates over all items as possible heads, and looks for the optimal subset of the items whose intervals contain the left endpoint of the head in their interior that results in an initial set satisfying the capacity constraint.Since these items are incomparable to each other in the interval order, each subproblem is equivalent to an ordinary 0-1 knapsack problem and can be solved in pseudopolynomial time using dynamic programming; see, e.g., [22].Our algorithm for the adversary's problem is a variant of this algorithm for the continuous knapsack and uses Dantzig's algorithm as a subroutine, therefore we will obtain polynomial runtime.
For this, we introduce the notion of a fractional prefix of a partial order P , which is a triple (J, j, λ) such that J ⊆ {1, . . ., n}, j ∈ J, 0 ≤ λ < 1 , and there is an order of the items in J, ending with j, that is a prefix of a linear extension of P .Every optimal solution of the follower, given some b and c, corresponds to a fractional prefix.The follower's solution corresponding to a fractional prefix F = (J, j, λ) is defined by Additionally, there is the fractional prefix F corresponding to the case in which all items are chosen, i.e., x F i = 1 for all i ∈ {1, . . ., n}.Let F P be the set of all fractional prefixes of the interval order P given by U and a, corresponding to the set of all optimal follower's solutions for some b ∈ [0, n i=1 a i ] and some c ∈ U .Then the adversary's task is, for fixed b, to choose a fractional prefix F ∈ F P satisfying a ⊤ x F = b, which in the original formulation, he does implicitly by choosing c ∈ U and anticipating the follower's optimal solution under this objective.Therefore the leader's problem can be reformulated as follows: In the next subsections, we first describe an algorithm to solve the inner minimization problem for fixed b, i.e., the adversary's problem, which will then be generalized to the maximization problem over b.

Solving the adversary's problem
First, consider the special case where the interval order has no relations.This means that all intervals intersect and hence, all permutations are valid linear extensions.Note that a pairwise intersection of intervals implies that all intervals have a common intersection, since for every two intervals , so the smallest right endpoint is right of or equal to the largest left endpoint.
Then the adversary's problem is very similar to the ordinary continuous knapsack problem.The only differences are that the objective is now to minimize (and not maximize), that the objective vector d may contain positive and negative entries, and that the constraint a ⊤ x ≤ b is replaced by a ⊤ x = b.But with this changed, the problem can still be solved using Dantzig's algorithm as described in Section 2; note that the algorithm fills the knapsack completely anyway assuming b ≤ n i=1 a i and c > 0. Denote this algorithm, returning the corresponding fractional prefix, by Dantzig.We will also need this algorithm as a subroutine on a subset of the item set (like the pseudopolynomial knapsack algorithm in Woeginger's algorithm).Therefore, we consider Dantzig as having input I ⊆ {1, . . ., n}, d ∈ R n , a ∈ R n >0 , and b ∈ [0, i∈I a i ], and only choosing a solution among the items in I.
We have seen that in case the interval order has no relations the adversary's problem can be solved by Dantzig({1, . . ., n}, d, a, b).The general adversary's problem can now be solved by Algorithm 1.In the notation of Woeginger's algorithm, the k-th item is the head in iteration k, I − k is the set of its predecessors, and I 0 k corresponds to the intervals containing the left endpoint of the head -not necessarily in their interior here, so that, in particular, also k ∈ I 0 k .The basic difference to Woeginger's algorithm is that here it is important to have a dedicated last item of the prefix, which will be the one possibly taken fractionally by the follower.Apart from that, the order of the items in the prefix is not relevant.In our construction, any element of I 0 k could be this last item, in particular it could be k, but it does not have to.Note that, in Algorithm 1, the prefix constructed in iteration k Algorithm 1: Algorithm for the adversary's problem does not necessarily contain the k-th item, but still, all prefixes that do contain it as their head are covered by this iteration.

Lemma 3. Algorithm 1 is correct.
Proof.For b = n i=1 a i , the only feasible and therefore optimal solution is F , so that the result is correct if the algorithm terminates in line 2.
So assume b < n i=1 a i now.The first part of the proof shows that the algorithm returns a feasible solution if K = ∅.The second part proves the optimality of the returned solution and also that K = ∅ always holds.
In each iteration k, I − k is the set of predecessors of k in the interval order P .The set I 0 k consists of items that are incomparable to k and to each other in P , since the corresponding intervals all contain the point p − k by definition.Hence it is valid (with respect to P ) to call Dantzig's algorithm in line 8 on I 0 k .The condition in line 7 makes sure that we only call the subroutine if the available capacity is in the correct range, i.e., if it is possible to fill the knapsack with the items in I − k and a subset of the items in I 0 k of which one item is taken fractionally.Then (J k , j k , λ k ) is a fractional prefix of P , as all predecessors of k and therefore also all predecessors of all i k holds for them.The item j k is a valid last item of a prefix consisting of the items in J k because j k ∈ I 0 k by construction and therefore, there are no successors of j k in J k .Moreover, by construction and by the correctness of Dantzig.Therefore, for all k ∈ K, (J k , j k , λ k ) is a feasible solution.Now we prove the optimality of the returned solution.Let (J, j, λ) be an optimal solution (if F is optimal, then b must be n i=1 a i , and this case is trivial).Choose k ∈ J with maximal p − k (i.e., a head of the prefix).Then I − k ⊂ J since J is a prefix and k ∈ J, so all predecessors of k must be in J, as well.Moreover, j ∈ J \ I − k as all items in I − which is at least the cost of any returned solution.The second part of the proof also shows that K = ∅.Thus, the algorithm always returns an optimal solution.
An optimal solution of the adversary's problem in the original formulation, i.e., a vector c ∈ U , can be derived from the fractional prefix (J k , j k , λ k ) returned by the algorithm in the following way: Analogously, the items i ∈ {1, . . ., n} \ J k will be packed after j k by the follower.
Note that this solution sets each variable except for c j k to an endpoint of its corresponding interval.In general, there is no optimal solution with all variables set to an interval endpoint.This can be seen by the following example.

Example 4. Let n = 3 and a
The optimal solution returned by the algorithm is ({1, 3}, 3, 1 2 ) with value 1.For the follower to select the first item and half of the third item, i.e., for c 1 ≥ c 3 ≥ c 2 to hold, the adversary must choose c 3 ∈ [2, 3], so it cannot be at one of the endpoints of the interval [1,4].

Solving the leader's problem
Next, we describe an algorithm to solve the robust bilevel optimization problem, which performs the maximization over the capacity b.For this, we will use the variant of Dantzig's algorithm which returns a piecewise linear function, as described in Section 2.
We call this routine BilevelDantzig and assume its input to be I ⊆ {1, . . ., n}, d ∈ R n , a ∈ R n >0 , and 0 ≤ b − ≤ b + ≤ i∈I a i , since, as before, we need it also to work on a subset of the item set.The output is a piecewise linear function f : [b − , b + ] → R ≥0 , which can be represented by a list of all its vertices, given as points of the graph of f .The leader's problem can now be solved by Algorithm 2.
Algorithm 2: Algorithm for the leader's problem which is almost the same condition as the one for defining but this is only for convenience in the formulation of Algorithm 1.We could define it as (I − k ∪I 0 k ∪{j * }, j * , 0), where j * ∈ {1, . . ., n}\(I − k ∪I 0 k ) is chosen such that p − j * is minimum.However, this is not relevant since this fractional prefix is also considered in iteration j * .Note that such a j * always exists because of b < n i=1 a i .

Remark 7.
If there are intersections of intervals only consisting in one point, no special treatment is needed in the pessimistic problem version since the worst possible order of the corresponding items from the leader's perspective will be chosen anyway.If we use the optimistic approach, we have to be more careful about that.However, if no one-point intersections occur, there is no difference between the optimistic and the pessimistic case regarding the sortings the adversary can enforce.Hence, Algorithm 1 and Algorithm 2 can be used for the optimistic case without any changes.
In the optimistic setting with one-point intersections, the set of follower's sortings the adversary can enforce does not even have to be the set of linear extensions of a partial order.However, Algorithm 1 and Algorithm 2 can be modified to work also in the general optimistic setting as follows.Given an item k ∈ {1, . . ., n}, we distinguish two cases: , the follower will sort every item i ∈ {1, . . ., n} with p + i = p − k before item k, given an optimal adversary's choice.Indeed, the adversary either prefers the order where i precedes k anyway (i.e., d i /a i < d k /a k ) and can enforce it, e.g., by choosing p k = p − k + ε for some ε > 0 that is small enough, or he prefers the order where k precedes i (i.e., d i /a i > d k /a k ), but cannot enforce it because even if choosing p i = p k = p − k , the follower will choose item i before item k because of the optimism.If d i /a i = d k /a k holds, the leader and the adversary are indifferent about the order of i and k, and we may assume that i precedes k then, as well.With this idea, one can show that setting in Algorithm 1 and Algorithm 2 for this k leads to the desired result.
2. If p − k = p + k , the follower will sort every item i ∈ {1, . . ., n} with p − i < p + i = p − k before item k, given an optimal adversary's choice, by similar arguments as in the first case.Again similarly, every item i ∈ {1, . . ., n} with p − i = p − k < p + i will be chosen after item k.Among the items i ∈ {1, . . ., n} with p − i = p + i = p − k , the adversary has no choice at all, and the follower will choose the best order from the leader's perspective, i.e., every such i with d i /a i > d k /a k will precede k, while every i with d i /a i < d k /a k will be chosen after k.We may assume that there are no such items i with d i /a i = d k /a k because they could be merged into a single item together with item k in the beginning.With this knowledge, we can define in iteration k of Algorithm 1 and Algorithm 2. It might happen that there is no adversary's choice leading to the follower choosing the desired fractional prefix But in this case, iteration k is not relevant anyway, hence we can just omit k from K if this happens.Indeed, given an optimal solution in which p − k = p + k holds for every possible head k, one can show that the fractional item of the optimal solution can be assumed to be the head k that minimizes d i /a i .

Discrete uncorrelated uncertainty
We now consider the robust bilevel continuous knapsack problem with an uncertainty set of the form where each U i is a finite set, i.e., for every component of c, there is a finite number of options the adversary can choose from and these are independent of each other.It turns out that this version of the problem is NP-hard in general, even if we consider the special case , where there are only two options in every component.

Theorem 8. The robust bilevel continuous knapsack problem with an uncertainty set being the product of finite sets, is NP-hard, even if each of these sets has size two.
We show Theorem 8 by a reduction from the well-known NP-hard subset sum problem.Let m ∈ N and w 1 , . . ., w m , W ∈ N be an instance of subset sum.Without loss of generality, we may assume 1 ≤ W ≤ m i=1 w i − 1.We show that we can decide if there is a subset S ⊆ {1, . . ., m} with i∈S w i = W in polynomial time if the following instance of the robust bilevel continuous knapsack problem can be solved in polynomial time: define ε := 1  4 and M := m i=1 w i + ε.Let n := m + 2 and set The uncertainty set is defined as Note that, since all these values are distinct, the optimistic and pessimistic approach do not have to be distinguished for this instance.
In the following two lemmas, we investigate the structure of optimal follower's solutions and of the leader's objective function, respectively.Both are done for a large range [ε, M ) of values for b, which will be useful to understand the two different behaviors the function can have in the actual range [b − , b + ] afterwards, depending on the subset sum instance being a yes or a no instance.Lemma 9. Let any leader decision b ∈ [ε, M ) be given.Then, for every optimal choice of the adversary, the resulting follower's solution x satisfies x i ∈ {0, 1} for all i ∈ {2, . . ., n − 1}.
Proof.First note that the adversary can always enforce a solution with a value of at most −M , e.g., by setting c 1 = c + 1 and c i = c − i for all i ∈ {2, . . ., n}, so that the first item is taken first and therefore completely, i.e., x 1 = 1, because a 1 = ε ≤ b.Since every solution with x 1 = 0 has a value greater than −M , this implies x 1 > 0 for every follower's solution resulting from an optimal choice of the adversary.Moreover, note that we always have x n < 1 as a n = M > b.
Now let i ∈ {2, . . ., n − 1}.If the adversary chooses c i = c + i , it follows that x i = 1.Indeed, x i < 1 would imply x 1 = 0 since c 1 /a 1 < c + i /a i always holds.Analogously, if the adversary chooses c i = c − i , we have x i = 0, as x i > 0 would imply x n = 1, since c − i /a i < c n /a n .Therefore, an optimal adversary's solution always leads to a follower's solution x such that x i ∈ {0, 1} for all i ∈ {2, . . ., n − 1}.
For the remainder of the proof, denote the leader's objective function by f .This function is described for all b ∈ [ε, M ) by the following The case of a yes instance (Lemma 12) Figure 1: The leader's objective function f , the unique best choice of the adversary is to let the follower set x 1 = 1 and pack 2, . . ., n − 1 according to T , the rest is filled by a fraction of item n.Indeed, for b < V 2 , no better packing of items 2, . . ., n − 1 than T is possible, and since b ≥ V 1 + ε, the most profitable item 1 (from the adversary's perspective) can be added entirely without making the packing T infeasible.The adversary can produce this solution by choosing , the same solution, with a larger fraction of item n, is still possible.However, since now a better packing S ⊆ {1, . . ., m} with i∈S w i = V 2 is available, we also have to consider to pack according to S and add as much of item 1 as possible (which the adversary can obtain again by setting and the adversary chooses the solution leading to a smaller value of f .
] be an optimal leader's solution in the original range.We conclude the proof of Theorem 8 by showing that the given instance of subset sum is a yes instance if and only if b * = b + , which follows from the following two lemmas.The two situations arising in Lemma 11 and Lemma 12 are illustrated in Figure 1.Proof.Let V 1 and V 2 be the largest subset sum with V 1 < W and the smallest subset sum with V 2 > W , respectively.Then we have Proof.Let V be the largest subset sum with V < W .We obtain f (b Both can be easily seen to be strictly larger than f (b + ).This concludes the proof of Theorem 8.Note that this also proves the NP-hardness of the adversary's problem: Theorem 13.Evaluating the objective function value of the robust bilevel continuous knapsack problem with an uncertainty set being the product of finite sets, in some feasible point b, is NP-hard, even if each of the sets has size two.
Proof.Looking at the proof of Theorem 8, the two cases in Lemma 11 and Lemma 12 can also be distinguished by computing the adversary's optimal solution value (or the leader's objective function value, equivalently) in the point b = b + = W + 2ε.In case of a yes instance it is where V is the largest subset sum with V < W , which leads to the second value being larger than the first one.This shows that there is also a reduction from the subset sum problem to the adversary's problem.
In Section 4, we have seen that the robust bilevel continuous knapsack problem can be solved efficiently when each coefficient is chosen independently from a given interval.Theorem 8 shows that the same problem turns NP-hard when the adversary is only allowed to choose the follower's objective coefficients from the endpoints of the intervals.In particular, this implies that replacing an uncertainty set by its convex hull may change the problem significantly, in contrast to the situation in single-level robust optimization.This can also be shown by the following explicit example.Example 14.Let n = 5 and define a = (1, 1, 1, 1, 1) ⊤ , b − = 0, b + = 5, d = (2, −1, 1, −2, 0) ⊤ , and U = {5}×{4}×{3}×{2}×{1, 6}.In this instance, the order of the items 1, 2, 3, and 4 is fixed, while item 5 could be in the first or last position with respect to uncertainty set U , but also in every position in between the other items when the uncertainty set is conv(U ) = {5} × {4} × {3} × {2} × [1,6].The leader's objective function on [0, 5] is depicted in Figure 2, for uncertainty sets U and conv(U ).
In the former case, the leader's unique optimal solution is b = 5 2 with objective value 3 2 , while in the latter case the two optimal solutions are b = 5  3 and b = 10 3 with objective value

Simplicial uncertainty
We next consider uncertainty sets being simplices and again show that the problem is NP-hard in this case.This case is of interest because it can be considered a special case of two commonly used types of uncertainty in robust optimization: polytopal and Gamma-uncertainty.Moreover, it can be viewed as the convex variant of the discrete uncertainty case investigated in Section 3. We will write the uncertainty set in the following as where a vector ĉ ∈ R n >0 and a number Γ > 0 bounding the deviation from ĉ are given.We have Theorem 15.The robust bilevel continuous knapsack problem with simplicial uncertainty set U ĉ,Γ , where ĉ and Γ are part of the input, is NP-hard.
Proof.We again show this by a reduction from the subset sum problem.Let m ∈ N and w 1 , . . ., w m , W ∈ N be an instance of subset sum.We show that we can decide if there is a subset S ⊆ {1, . . ., m} with i∈S w i = W in polynomial time if the following instance of the robust bilevel continuous knapsack problem can be solved in polynomial time: define n := m + 1, M := m i=1 w i + 1 and As in the discrete uncertainty case, we may imagine the leader's objective function f as the pointwise minimum of all piecewise linear functions f c for c ∈ U ĉ,Γ .Note that, although there are infinitely many c ∈ U ĉ,Γ , the number of distinct functions f c is finite since the functions depend only on the follower's sorting of the items induced by c.Since d i /a i = −1 for all i = 1, . . ., m and d m+1 /a m+1 = 1, all functions f c have the structure shown in Figure 3, where V c := i∈Ic a i = i∈Ic w i for The leader's objective function is the pointwise minimum of the functions f c .It follows easily that it agrees with f c * where c * ∈ argmax c∈U ĉ,Γ V c .In particular, since the leader's optimal solution is V c * + M with value −V c * + M , so that it remains to show that by computing V c * we can decide the subset sum instance.Since ĉi /a i = 2M − 1 < 2M = ĉm+1 /a m+1 for all i = 1, . . ., m, the adversary has two options for every item i: 1. Either he decides to include i in the set I c , which can be achieved by shifting the value ĉi /a i to the right by 1 up to ĉm+1 /a m+1 , by choosing c i = ĉi + a i = ĉi + w i and thus paying c i − ĉi = w i in the constraint m i=1 (c i − ĉi ) ≤ Γ on the uncertainty set.Note that there is no incentive to choose c i greater than that, as it would not change the leader's objective function value.
2. Or he decides not to include i in the set I c , for which it is most efficient in terms of the Γ-constraint to choose c i = ĉi .
Note that there is no incentive to choose c m+1 > ĉm+1 .Therefore, we may assume that c i ∈ {ĉ i , ĉi + w i } for all i ∈ {1, . . ., m} and c m+1 = ĉm+1 hold in an optimal adversary's solution.By maximizing V c = i∈Ic w i , we can thus compute the largest subset sum V with V ≤ W , since i∈Ic w i = m i=1 (c i − ĉi ) ≤ Γ = W . Thus, the subset sum instance is a yes instance if and only if V c * = W . Remark 16.In the proof of Theorem 15, we used the assumption of the pessimistic approach, because item i was included in the set I c even if c i /a i = c m+1 /a m+1 .In the optimistic approach, item i may be packed only if strict inequality holds in the definition of I c .Without changing the effect of the constraint m i=1 (c i − ĉi ) ≤ Γ, this could be modeled by choosing ĉm+1 slightly smaller than 2M 2 in the definition of the instance.
Again, also the adversary's problem is NP-hard: Theorem 17. Evaluating the objective function value of the robust bilevel continuous knapsack problem with simplicial uncertainty set U ĉ,Γ , where ĉ and Γ are part of the input, in some feasible point b, is NP-hard.
Proof.Looking at the proof of the previous theorem, it can be seen that the subset sum instance is a yes instance if and only if f (W ) = −W , so the subset sum problem can also be solved by computing the objective function value at b = W .
The uncertainty set U ĉ,Γ is a polytope defined explicitly by n + 1 linear inequalities.In particular, this shows NP-hardness for polytopal uncertainty sets given by an outer description: Corollary 18.The robust bilevel continuous knapsack problem with an uncertainty set being a polytope, given by a set of linear inequalities, is NP-hard.
Theorem 15 also implies that the problem is NP-hard under Gamma-uncertainty, which is sometimes also called budgeted uncertainty [1].However, this is only true in case the total amount of deviation is bounded.Since uncertainty sets cannot be replaced equivalently by their convex hulls in the bilevel case, the above result does not necessarily hold for the original definition of Gamma-uncertainty, where the number of deviating entries is bounded.
It is easy to check that U ĉ,Γ agrees with conv{ĉ, ĉ + Γe 1 , . . ., ĉ + Γe n }, where e i denotes the i-th unit vector.This proves Corollary 19.The robust bilevel continuous knapsack problem with an uncertainty set being the convex hull of a finite set of vectors, which are explicitly given as part of the input, is NP-hard.
It follows from Theorem 17 that also the evaluation of the leader's objective function is NP-hard in all cases mentioned in the last corollaries.
Recall that the problem is tractable if the uncertainty set U is finite and given explicitly as part of the input; see Theorem 2. Together with Corollary 19, this again shows that replacing the uncertainty set by its convex hull may not only change the optimal solution, but even the complexity of the problem significantly.
Remark 20.In contrast to the result of Corollary 19, the problem can be solved in polynomial time if the uncertainty set is given as the convex hull of a constant number k of vectors.In fact, the number of possible sortings in the follower's solution can be bounded by O(n 2k ) in this case, and they can be enumerated explicitly in polynomial time for constant k.The tractability then follows from Theorem 2.

Norm uncertainty
In Section 4, we have shown that the robust bilevel continuous knapsack problem can be solved efficiently if the uncertainty set is defined componentwise by intervals.This can be seen as a special case of an uncertainty set defined by a p-norm, where ĉ ∈ R n >0 , Γ > 0, and p = ∞.On the other hand, the case p = 1 is closely related to the simplicial case discussed in the previous section, which turned out to be NP-hard.In the following, we show NP-hardness for all p ∈ [1, ∞).This is also of interest because the case p = 2 corresponds to an ellipsoidal uncertainty set, which is commonly used in robust optimization.Proof.This can be shown very similarly to Theorem 15.We use the same instance, except that ĉ := (2M w 1 − w 1/p 1 , . . ., 2M w m − w 1/p m , 2M 2 ) and Γ := W 1/p .By the same reasoning as before, we may assume that an adversary's optimal solution satisfies c i ∈ {ĉ i , ĉi + w 1/p i } for all i ∈ {1, . . ., m} and c m+1 = ĉm+1 .For this, note that, although it is now allowed to deviate from ĉ in any direction, the adversary has no incentive to choose c i < ĉi for any i ∈ {1, . . ., n} in the given instance.In particular, it is cheaper in terms of the constraint The rest of the proof is analogous.
In the proof of Theorem 21, we implicitly assumed that we can compute p-th roots in polynomial time when defining ĉ and Γ.In general, these values cannot be computed or even represented exactly in a polynomial time algorithm.However, they only influence the set of possible sortings, not the actual leader's solution and objective function values.For the former, a sufficiently good approximation of the p-th roots, which can be computed in polynomial time, leads to the same result.

Remark 22.
In the situation of Theorem 21, Remark 16 still applies: while the proof is formulated for the pessimistic setting, the variation proposed in Remark 16 allows to show NP-hardness also in the optimistic setting.
In the case p = 2, the uncertainty set U 2 ĉ,Γ is an axis-parallel ellipsoid.We thus derive the following result:

Corollary 23. The robust bilevel continuous knapsack problem with (uncorrelated) ellipsoidal uncertainty is NP-hard.
Finally, we can again show NP-hardness even for the problem of evaluating the leader's objective function.The proof is analogous to the case of simplicial uncertainty discussed in the previous section.

Uncertain item sizes
While our research was focused on uncertain follower's profits, one may also consider the variant of the robust bilevel continuous knapsack problem in which the item sizes a are uncertain.This was investigated in [21], considering different uncertainty sets similarly to here.In case of discrete uncertainty, the algorithm presented in Section 3 could be transferred directly.Regarding interval uncertainty, different types of leader's objective functions were distinguished since the variants (a), (b) and (c) mentioned in Section 2 are not equivalent anymore.Moreover, one has to be very careful about the optimistic setting because with uncertain item sizes, the optimal value might not be attained in the adversary's problem.Additionally, one-point intersections of intervals in the optimistic setting are not understood completely in this problem version yet; they can be expected to be at least as complicated to handle as in Remark 7.However, many structural results were established and an algorithm similar to the one presented in Section 4 was shown to solve the problem under mild additional assumptions.Similarly to the results in Section 5 and Section 6, NP-hardness was also proved for uncertain item sizes lying in a discrete uncorrelated or a polytopal uncertainty set, assuming the pessimistic setting in the latter case.

Conclusion
We have started the investigation of robust bilevel optimization by addressing the bilevel continuous knapsack problem with uncertain follower's objective.It turned out that standard results from single-level robust optimization do not hold anymore: firstly, it is not possible in general to replace an uncertainty set by its convex hull without changing the problem.Secondly, the case of interval uncertainty is not trivial anymore.Even if we have shown that it is still tractable in the case of the bilevel continuous knapsack problem, we conjecture that in general, the interval case cannot be reduced to the certain problem anymore.
All hardness results presented in this paper are in the weak sense.This leaves open the question whether the corresponding problem variants are actually strongly NP-hard or whether pseudopolynomial algorithms exist.This is left as future work, together with questions of approximability.In view of the remarks in Section 8, another task left for (a) d ∈ R n and δ ∈ R, the most general variant, (b) d ∈ R n ≥0 and δ ≥ 0, as in the problem formulation above, and (c) d ∈ R n and δ = 0, which we will use in the following.
. The leader has to maximize f over the range [b − , b + ].As f is piecewise linear, it suffices to evaluate it at the boundary points b − and b + and at the feasible vertices b = j i=1 a i for all j ∈ {0, . . ., n} with j i=1 a i ∈ [b − , b + ].Hence, Problem (P) can be solved in time O(n log n), which is the time needed for sorting.

Theorem 2 .
c∈U f c and her task is to maximize f over [b − , b + ].The function f can be seen as the lower envelope of |U |n many linear segments, corresponding to the pieces of the functions f c , and can thus be computed in time O(|U |n log(|U |n)) [19].This proves The robust bilevel continuous knapsack problem with finite uncertainty set U can be solved in O(|U |n log(|U |n)) time.

k
have at least one successor (namely k) in J.By the choice of k, we have J \ I − k ⊆ I 0 k and (J \ I − k , j, λ) is a feasible solution of the subproblem solved by the call of Dantzig in line 8 since a

10 // and by i∈I − k d i in y direction 11 KLemma 5 .
:= K ∪ {k} 12 f := min{f k : k ∈ K} // pointwise minimum 13 return argmax{f (b) : b − ≤ b ≤ b + } Algorithm 2 is correct.Proof.First note that Algorithm 1 can be considered as the special case of Algorithm 2 where b = b − = b + .For the correctness of Algorithm 2, it suffices to show that the function f describes the value of the output of Algorithm 1 depending on b ∈ [b − , b + ].For b = n i=1 a i , which is only possible if b + = n i=1 a i , consider any iteration k = k * , where k * ∈ {1, . . ., n} is chosen such that p − k * is maximum.It is easy to check that this iteration results in a function f k * with f k * (b + ) = n i=1 d i , corresponding to the fractional prefix F returned in Algorithm 1, and that for no k with p − k < p − k * , the function f k is defined for b.For the rest of the proof, we assume b < n i=1 a i .The condition in line 5 ensures that b− ≤ b+ , so that the call of BilevelDantzig in line 8 is valid.Let

Theorem 6 .
λ b k ) agree because the piecewise linear function returned by BilevelDantzig consists of the values of the solutions returned by Dantzig for given values of b.Since f (b) is the minimum of all f k (b) that are defined, this implies that it is equal to the value of the optimal solution computed in Algorithm 2. The robust bilevel continuous knapsack problem with interval uncertainty can be solved in O(n 2 log n) time.Proof.In every of the n iterations, Algorithm 2 needs O(n) time to compute the sets I − k and I 0 k , and, since |I 0 k | ≤ n, O(n log n) time for Dantzig's algorithm.As explained in Section 3, the pointwise minimum of the at most n piecewise linear functions with at most n segments each, as well as the maximum of the resulting function (lines 12 and 13) can be computed in O(n 2 log n) time.

Lemma 11 .
If the given instance (w 1 , . . ., w m , W ) of subset sum is a no instance, then b * = b + .

Lemma 12 .
Hence, by Lemma 10, the function f is linear on [b − , b + ] with slope ε M > 0. If the given instance (w 1 , . . ., w m , W ) of subset sum is a yes instance, then f (b − ) > f (b + ) and hence b * = b + .

Figure 2 :
Figure 2: The leader's objective function in Example 14

Theorem 21 .
Let p ∈ [1, ∞).Then the robust bilevel continuous knapsack problem with uncertainty set U p ĉ,Γ , where ĉ and Γ are part of the input, is NP-hard.This remains true under the assumption U p ĉ,Γ ⊆ R n >0 .

Theorem 24 .
Let p ∈ [1, ∞).Then evaluating the objective function of the robust bilevel continuous knapsack problem with uncertainty set U p ĉ,Γ , where ĉ and Γ are part of the input, is NP-hard.