Computing Walrasian Equilibria: Fast Algorithms and Structural Properties

We present the first polynomial time algorithm for computing Walrasian equilibrium in an economy with indivisible goods and \emph{general} buyer valuations having only access to an \emph{aggregate demand oracle}, i.e., an oracle that given prices on all goods, returns the aggregated demand over the entire population of buyers. For the important special case of gross substitute valuations, our algorithm queries the aggregate demand oracle $\widetilde{O}(n)$ times and takes $\widetilde{O}(n^3)$ time, where $n$ is the number of goods. At the heart of our solution is a method for exactly minimizing certain convex functions which cannot be evaluated but for which the subgradients can be computed. We also give the fastest known algorithm for computing Walrasian equilibrium for gross substitute valuations in the \emph{value oracle model}. Our algorithm has running time $\widetilde{O}((mn + n^3) T_V)$ where $T_V$ is the cost of querying the value oracle. A key technical ingredient is to regularize a convex programming formulation of the problem in a way that subgradients are cheap to compute. En route, we give necessary and sufficient conditions for the existence of \emph{robust Walrasian prices}, i.e., prices for which each agent has a unique demanded bundle and the demanded bundles clear the market. When such prices exist, the market can be perfectly coordinated by solely using prices.


Introduction 1.A macroscopic view of the market
As part of our everyday experience, prices reach equilibria in a wide range of economics settings.Yet, markets are complicated and consist of heterogeneous goods and a huge population of buyers can have very diverse preferences that are hard to model analytically.With the sheer amount of information needed to describe the economy, how can the market possibly reach an equilibrium?Well, perhaps not all this information is needed.
In this paper, we provide evidence supporting this belief through the lens of algorithms.Specifically, we propose algorithms for computing market equilibrium using very limited amount of information.Our result suggests that information theoretically, it is not necessary to make too many measurements or observations of the market to compute an equilibrium.This may also shed light into how markets operate.
As the first step, we must design a realistic model to represent the economy.The standard TCS approach would require the entire input be specified but for a market, it is simply too computationally expensive to model its individual agents in full details.So what should we turn to?If equilibrium represents the collective behavior of the agents, perhaps some kind of aggregate information would be enough.Such information can be average salaries, interest rate, population, fashion trend and so on.An algorithm would ideally process these macroscopic-scale information in an efficient manner to compute equilibrium price that allows the market to clear.We show that it is possible to compute market equilibrium by exploiting the very rudimentary information of aggregate demand, i.e. the quantity demanded for each item at a given price aggregated over the entire population of buyers.This result implies, among other things, that a market can be viewed as an aggregate entity.For the sake of reaching equilibrium, detailed knowledge about its individual buyers at the microscopic level may not really be needed.Rather, it should be their collective behavior that dictates the outcome of the market.
The use of aggregate demand by our algorithm also resonates with a common perception of the role played by excess demand/supply.A highly sought-after good would usually see its price soar whereas an unpopular good would be inexpensive.This is similar to our algorithms which, in some sense, operate by increasing the price of overdemanded good and vice versa in an iterative fashion.We note however that by no means are we suggesting that our algorithms closely mirror how a market actually works.While the holy grail of this research direction is to understand how a market reaches equilibrium in practice, perhaps a humble first step is to show that this can be done algorithmically with as little information and assumption as possible.
Our starting point is the Gul and Stachetti's model [GS99] of an economy of indivisible goods, but we make no further assumptions on the structure of the valuation functions.The goal is to compute market equilibrium: a set of item prices and allocations of items to buyers such that the market clears and each buyer gets his or her favorite bundle of goods under the current prices.
The market can only be accessed via an aggregate demand oracle: given prices for each item, what is the demand for each item aggregated over the entire population.Clearly in this model, it is not possible to compute an allocation of items to buyers, since the oracle access model doesn't allow any sort of buyer-specific information.Curiously, equilibrium prices are still computable in a very efficient manner: Theorem (informal).In a consumer market with n goods and m buyers, we can find (a vector of ) equilibrium prices, whenever it exists, using O(n 2 ) calls to the aggregate demand oracle and O(n 5 ) time.If valuations are gross substitutes, O(n) calls to the aggregate demand oracle and O(n 3 ) time suffice.
Notably, the number of buyers plays no role.Our algorithm has query and time complexity essentially independent of the number of players.This feature is especially relevant in practice as markets are usually characterized by a large population and relatively few number of goods.The city of Berkeley, for example, has about 350 restaurants but 120,000+ people!

From telescopes to augmenting lenses
Aggregate demand oracles are like looking at the economy from a telescope.Having a telescope has its advantages: it is possible to get a very global view of the economy with a few queries.On the other hand, extracting details is hard.
Our second question is how fast equilibrium can be computed with only a local view of the economy?Our analogue for augmenting lenses will be the value oracle model, in which one can query the value of each buyer for each bundle of items.This again has its advantages: it provides very fine-grained information about the market, but has the shortcoming that many queries are needed to extract any sort of global information.
Can equilibrium prices be computed with small amount of information even at the microscopic level?This quest is clearly hopeless for general valuation functions.But for one of the most important classes of valuation functions in economics, gross substitute valuations, there are enough structures to allow us to construct equilibrium prices using microscopic information.
The history of gross substitutes is intertwined with the development of theory of Walrasian equi-librium (also called market equilibrium in this paper).Indeed, Kelso and Crawford [KC82] show that Walrasian equilibrium always exists for gross substitute valuations.Hatfield and Milgrom [HM05] argue that most important examples of valuation functions arising in matching markets belong to the class of gross substitutes.Gross substitutes have been used to guarantee the convergence of salary adjustment processes in the job market [KC82], to guarantee the existence of stable matchings in a variety of settings [Rot84,KTY14], to show the stability of trading networks [HKN + 15], to design combinatorial auctions [AM02,MSY13] and even to analyze settings with complementarities [SY06,HK15].
Since the oracle access is very local, we clearly need to query each agent at least once, so the dependence on the number of buyers needs to be at least linear.We show that indeed it is possible to solve this problem with a linear dependence on the number of buyers and cubic dependence in the number of items: Theorem (informal).In a consumer market with n goods and m buyers whose valuation functions satisfy the gross substitute condition, we can find an equilibrium (or Walrasian) price and allocation using mn + O(n 3 ) calls to the value oracle and O(n 3 ) time.
Now that we have buyer-specific information, we can also compute the optimal allocation at no additional time.
Proving this result requires novel insights into the structure of gross substitute valuations.In particular, one of our main structural lemmas answers a question posed by Hsu et al. [HMR + 16]: when do prices coordinate markets?In general, Walrasian prices mean that there is a choice of favorite bundles for each buyer that clears the market.It is far from trivial how to choose those bundles, since each agent can have multiple favorite bundles (for example, consider the case where all items are identical and all agents have the same valuation for the items).We say that a price vector form robust Walrasian prices if each agent demands a unique bundle under those prices and the bundles clear the market.Such vectors would allow prices alone to clear the market without any external coordination.We show that: Theorem (informal).In a consumer market with n goods and m buyers whose valuation functions satisfy the gross substitute condition, robust Walrasian prices exist if and only if there is a unique Walrasian allocation.Whenever they exist, they can be computed in O(mn + n 3 ) time.

Our algorithms and techniques
We study the Walrasian equilibrium problem in three different settings: (i) general valuations in the aggregate demand oracle model; (ii) gross substitute valuations in the aggregate demand oracle model and (iii) gross substitutes in the value oracle model.In all three settings, the starting point is the linear programming formulation of Bikhchandani and Mamer [BM97].
General valuations in the aggregate demand oracle model (Section 3).The main difficulty of working with the LP in Bikhchandani and Mamer [BM97] is that the constraints depend on the value of buyers for each bundle, which we have no access to.In particular, we are not able to test for any given setting of variables of the LP if it is feasible or not.We are in a strange situation where the LP to be solved is not known in full.Our solution is to move the constraints to the objective function and turn the problem into an unconstrained convex minimization problem.The problem in hand has the feature that we cannot evaluate the function but we can compute its subgradients.
Traditional cutting plane algorithms such as the Ellipsoid Method need access to both a separation oracle and functional values.To overcome this issue we use the fact that the cutting plane of Lee, Sidford and Wong [LSW15] provides strong dual guarantees and that our separation oracle is given by subgradients.Originally, in Theorem 42 of their paper [LSW15] show how to adapt their cutting plane method to convex optimization; however, their algorithm and proof still rely on being able to evaluate the function.We show in Theorem 3.7 that their algorithm can be slightly modified to achieve the same guarantee using only subgradients (i.e., without using functional values).
A second obstacle we face is that algorithms to minimize convex functions only provide approximate guarantees and to find a Walrasian equilibrium we need the exact minimum.In general minimizing a convex function exactly is impossible, but in our case this can be done by exploiting the connection to the LP.Note that given the very restricted way that we can access the problem (only via the aggregate demand oracle), we cannot apply the Khachiyan's perturbation and rounding techniques for linear programming [Kha80] in a black-box fashion.Nevertheless his approach can be nontrivially adapted to our setting.We show how to perturb and round the objective function to achieve the desired running time.
Gross substitutes in the aggregate demand model (Section 4).If valuation functions satisfy gross substitutes, then we can exploit the fact that the set of Walrasian prices form an integral polytope with a lattice structure to simplify the algorithm and obtain an improved running time and oracle call complexity.The improvement comes from using structural properties of gross substitutes to show that a simpler and milder perturbation to the objective is enough and that rounding can be done in a simpler manner.This highlights the important of looking at perturbation and rounding in a non-black-box manner.
Gross substitutes in the value oracle model (Section 5).An aggregate demand oracle call can be simulated from O(mn 2 ) value oracles calls.This can be plugged into the previous algorithm to obtain a running time of Õ(mn 3 T V ) where T V is the time required by the value oracle.We use two ideas to improve the running time to Õ((mn + n 3 )T V ).The first one is to regularize the objective function.As with the use of regularizers in other context in optimization, this is to penalize the algorithm for being too aggressive.The bound of O(mn 2 ) value oracle calls per iteration of the cutting plane algorithm is so costly precisely because we are trying to take an aggressively large step.A second idea is to re-use one of the stages of the subgradient computation in multiple iterations, amortizing its cost per iteration.
Robust Walrasian Prices and Market Coordination (Section 6).Still in the value oracle model, we show how to obtain the efficient allocation from the subgradients observed in the optimization procedure.An important by-product of our analysis is that we give necessary and sufficient conditions for the existence of robust Walrasian prices, i.e., Walrasian prices under which each buyer has an unique bundle in their demand set.Whenever such prices exist, we give an Õ(mn + n 3 ) algorithm to compute them.This answers an open question in Hsu et al [HMR + 16], who ask when it is possible to completely coordinate markets by solely using prices.
Combinatorial Algorithms for Walrasian equilibrium (Section 7).Murota and Tamura [MT03] give combinatorial algorithms for the problem of computing Walrasian equilibria via a reduction to the M -convex submodular flow problem.It is also possible to obtain combinatorial algorithms for the welfare problem by reducing it to the valuated matroid intersection problem and applying the algorithms in Murota [Mur96b,Mur96c].The running time is not explicitly analyzed in [MT03,Mur96b,Mur96c].Here we describe those algorithms for the reader unfamiliar with M-convex submodular flows in terms of a sequence of elementary shortest path computations and analyze its running time.We show that they have running time of Õ(mn 3 ) in the value oracle model.We use the same ideas used to speed up the computation of Walrasian prices by regularizing the market potential to speed up those algorithms and improve its running time to Õ(mn + n 3 ).

Comparison to related work
Iterative auctions and subgradient algorithms.The first algorithm for computing Walrasian equilibria in an economy of indivisible goods is due to Kelso and Crawford [KC82] and it is inspired by Walras' tâtonnement procedure [Wal74], which means "trial-and-error".Despite the name, it constitutes a very ingenious greedy algorithm: goods start with any price, then we compute the aggregate demand of the agents, increase the price by one for all goods that were over-demanded and decrease by one the price of all goods that are under-demanded.This gives a very natural and simple algorithm in the aggregate demand oracle model.This algorithm, however, is not polynomial time since it runs in time proportional to the magnitude of the valuations.
The seminal work of [KC82] originated two lines of attack of the problem of computing Walrasian equilibria: the first line is by applying subgradient descent methods [Par99, PU02, AM02].Such methods typically either only guarantee convergence to an approximate solution or converge in pseudo-polynomial time to an exact solution.This is unavoidable if subgradient descent methods are used, since their convergence guarantee is polynomial in M/ǫ where M is the maximum valuation of a buyer for a bundle and ǫ is the accuracy of the desired solution.To be able to round to an exact optimal solution the running time must depend on the magnitude of the valuations.Another family of methods is based on primal-dual algorithms.We refer to de Vries, Schummer and Vohra [dVSV07] for a systematic treatment of the topic.For primal-dual methods to converge exactly, they need to update the prices slowly -in fact, in [dVSV07] prices change by one unit in each iteration -causing the running time to be pseudo-polynomial time.
Polynomial time approaches via the Ellipsoid Method.The Welfare Problem for gross substitutes was independently shown to be solvable in polynomial by Murota [Mur96c] and Nisan and Segal [NS06].Remarkably, this was done using completely different methods.
Nisan and Segal's approach is based on a linear programming formulation of Walrasian equilibrium due to Bikhchandani and Mamer [BM97].The authors show that the dual of this formulation can be solved using both the value and demand oracles for gross substitutes as a separation oracle for the LP.This can be combined with the fact that demand oracles for gross substitutes can be constructed from value oracles in O(n 2 ) time [DT95] to obtain a polynomial-time algorithm in value oracle model.This is the method that is closer to ours in spirit: since we both approach the problem via a mathematical programming formulation and apply interior point methods.In terms of oracle access, Nisan and Segal crucially rely on value oracles to implement the separation oracle in their LP -so their solution wouldn't generalize to the aggregate demand oracle model, since neither per-agent demand oracles nor value oracles can be recovered from aggregate demand oracle1 .The running time in their paper is never formally analyzed, but since their formulation has m + n variables, it would lead to a superlinear dependence in the number of agents.
Nisan and Segal employ the LP to compute a set of Walrasian prices and the value of the Walrasian allocation.In order to compute the allocation itself, they employ a clever technique called self-reducibility, commonly used in complexity theory.While it allows for an elegant argument, it is a very inefficient technique, since it requires solving nm linear programs.In total, this would lead to a running time of O(mn2 (m + n) 3 ) using currently fastest cutting plane algorithms as the LP solver.Murota [Mur96b,Mur96c] and leads to very efficient combinatorial algorithms.Murota's original paper never mentions the term "gross substitutes".They were developed having a different object in mind, called valuated matroids, introduced by Dress and Wenzel [DW92,DW90] as a generalization of the Grassmann-Plücker relations in p-adic analysis.Murota developed a strongly-polynomial time algorithm based on network flows for a problem called the valuated matroids assignment problem.There is a tortuous path connecting gross substitutes to valuated matroids.Valuated matroid turned out to be one aspect of a larger theory, Discrete Convex Analysis, developed by Murota (see his book [Mur03] for a comprehensive discussion).One central object of this theory is the concept of M ♮ -concave functions, introduced by Murota and Shioura [MS99].It came to many as a surprise when Fujishige and Yang [FY03] showed that M ♮ -concave functions and gross substitutes are the same thing.Their equivalence is highly non-trivial and their definitions are very different to the point it took at least a decade for those concepts to be connected.Murota and Tamura [MT03] later apply the ideas in discrete convex analysis to give polynomial time algorithms to various equilibrium problems in economics.The running time is never explicitly analyzed in their paper.Here we show that their running time is Õ(mn 3 ) and improve it to Õ(mn + n 3 ) Market Coordination.Related to Section 6 in our paper is the line of research on Market Coordination.This line of inquiry was initiated by Hsu, Morgenstern, Rogers, Roth and Vohra [HMR + 16] who pose the question of when prices are enough to coordinate markets.More precisely, they showed that under some genericity condition the minimal Walrasian price for a restricted class of gross substitutes induces an overdemand at most 1 for each item.On the other hand, we show in Theorem 6.4 that under a more inclusive condition (which is necessary and sufficient) almost every Walrasian prices for any gross substitutes have no overdemand, i.e. the market is perfectly coordinated.We also give a simple algorithm for computing those prices whenever they exist.Such necessary and sufficient conditions were given simultaneously and independently by Cohen-Addad, Eden, Feldman and Fiat [CEFF15] 2 .

Conclusion and Discussion
We provide in this paper the first polynomial-time algorithm for computing Walrasian prices with an aggregate demand oracle.Previous algorithms for this problem required either a value oracle or a per-buyer demand oracle, or both.We also gave the fastest (to the best of our knowledge) algorithm for computing a Walrasian equilibrium in economies with gross substitute valuations.En route, we showed necessary and sufficient conditions for the existence of robust Walrasian prices and provided an algorithm to compute them.
We also provide the fastest known algorithm for Walrasian equilibrium in the value oracle model.We believe the question of improving the running time is important because it leads to new algorithmic ideas and new structural insights.For example, the question of the existence of robust Walrasian prices (Theorem 6.4) arises as a step towards computing the Walrasian allocation from subgradients.Later we noticed this structural lemma also provided answer to a purely economic question of independent interest.A second example is that by seeking to improve the running time, we looked for algorithms that would perform very simple operations and this made us stumble upon algorithms that used only the aggregate demand oracle.
One of the salient features of our first result is that we compute Walrasian prices whenever they exist for any class of valuations.The reader might ask why this is interesting since Gul and Stachetti [GS99] show that gross substitutes are the largest class of valuations for which Walrasian equilibria exist.The confusion stems from the qualification in their result.What they show is if a class of valuation function is closed under summing an additive functions and for all vectors of valuations in this class there is Walrasian equilibrium, then it is contained in the class of gross substitutes.Such statement doesn't preclude existence of equilibrium for more general classes.For example, if there is a single buyer, then equilibrium exists no matter what his valuation is.Also, rich classes of valuation functions were shown to always have Walrasian equilibrium [CP14, COP15, BLN13, SY06].Of course, none of those classes are closed under summing an additive function.

Market equilibrium: prices, allocations and welfare
Following the classic model of Gul and Stachetti [GS99], we define a market of indivisible goods as a set [m] of buyers, a set [n] of items and a supply s j ∈ Z ≥0 of each item j.Each buyer i has a valuation function v i : Z n ≥0 → Z over the multisets of items with v i (0) = 0.For the first part of our paper, we make no further assumptions about the valuation function or the supply.
Given a price vector p ∈ R n , we define the utility of agent i for a bundle x ∈ [[s]] under price vector p as: u i (x; p) := v i (x) − p • x, where p • x refers to the standard dot product n j=1 p i x i .Notice also that we make no assumptions about the signs of v i and p.
An allocation x = (x (1) , x (2) , . . ., x (m) ) is simply an assignment of items to each player where i receives x (i) ∈ [[s]].An allocation x is valid if it forms a partition of the items, i.e. i x (i) j = s j for every j.The social welfare of a valid allocation x is defined as Sw(x) = i∈[m] v i (x (i) ).Finally, the optimal social welfare is simply the largest possible social welfare among all valid allocations.
In the following, we show the importance of prices in welfare economics, namely that if the market clears, then we achieve the optimal social welfare.
Given prices p ∈ R n , we would expect a rational agent to buy x such that his utility v i (x) − p • x is maximized.We call x the demand of i under p, as defined formally below.Note that there may be multiple utility-maximizing subsets.
Definition 2.1 (Demand set).Given prices p ∈ R n on each item, the demand set D(v, p) for a valuation function v is the collection of subsets for which the utility is maximized: If v is the valuation function v i of player i, we also use the shorthand D(i, p) as the demand set.
We are now ready to define competitive equilibrium.Definition 2.2 (Equilibrium).A Walrasian equilibrium (also called competitive equilibrium) consists of a price vector p ∈ R n and a valid allocation x = (x (1) , x (2) , . . ., x (m) ) such that x (i) ∈ D(i, p) for all i.We call p an equilibrium/Walrasian price and x an equilibrium/Walrasian allocation induced by p.
In other words, a competitive equilibrium describes a situation where items are sold in such a way that the total demand i x (i) j for each item precisely meets its supply s j , i.e. the market clears.The reason for the name competitive equilibrium is that its achieve the optimal social welfare.This is known as the first and second welfare theorems in economics and for completeness we provide a proof in the appendix.
Moreover, if p is any set of Walrasian prices and x is any optimal allocation, then the pair (p, x) form a Walrasian equilibrium.
This lemma nicely reduces social welfare maximization to finding competitive equilibrium whenever it exists.Note that the definition of social welfare has nothing to do with prices.In a way, this lemma shows that equilibrium prices act as a certificate which demonstrates the optimality of equilibrium allocation.

Oracles
To study market equilibrium computationally, we must clarify how the market is represented and how we can extract information about it.In this paper we consider three models that access the market in different scales:

Microscopic Scale: Value Oracle Model
In the value oracle model the algorithm has access to the value that each agent has for each bundle.This gives the algorithm very fine-grained information, but it requires potentially many calls for the algorithm to access any sort of macroscopic information about the market.
Definition 2.4 (Value oracle).The value oracle for player i ∈ [m] takes x ∈ [[s]] as input and outputs v i (x).We denote by T V the time spent by the value oracle to answer a query.

Agent Scale: Demand Oracle Model
In the demand oracle model the algorithm presents a price vector p to an agent and obtains how many units are demanded at that price.At any given price, the agent could be indifferent between various bundles.The demand oracle can return any arbitrary bundle.
Definition 2.5 (Demand oracle).The demand oracle for valuation agent i takes as input a price vector p ∈ R n and outputs a demand vector d i (p) ∈ D(i, p).We denote by T D the time spent by the demand oracle to answer a query.

Macroscopic (Market) Scale: Aggregate Demand Oracle Model
The aggregate demand oracle model presents a very macroscopic view of the market.In this model, the algorithm cannot observe individual agents but only the aggregate response of the market to any given price p.For example, a manufacturer deploying a product in the market is unable to observe each buyer's behavior, but only how many units were sold.
Definition 2.6 (Aggregate Demand oracle).The aggregate demand oracle takes as input a price vector p ∈ R n and outputs a demand vector d(p) ∈ Z ≥0 such that there exist bundles x (i) ∈ D(i, p) satisfying d(p) = i x (i) .We denote by T AD the time spent by the demand oracle to answer a query.

Convex analysis
As we tackle the problem of finding market equilibrium using convex minimization, we need a few basic facts about subgradients [Roc15].For differentiable functions, subgradients are just gradients.Throughout this section all functions are continuous, convex, real-valued, and defined over a convex subset of R n .
The set of subgradients at p is denoted by ∂f (p).Sometimes we abuse notation by denoting a subgradient simply as ∂f (p).
It is well-known that every continuous convex function has a subgradient everywhere.Subgradients are nice particularly because they provide a "separation oracle" in the following sense.Note that this is almost a tautology.
Lemma 2.8.Let g be a subgradient at By using g • (p ′ − p) ≤ 0 as a separating hyperplane, this is the basis on which subgradients allow us to solve convex minimization via the ellipsoid or cutting plane method in polynomial time.
We can identify a minimizer by looking at its subgradients.
Lemma 2.9.For convex f , p minimizes f iff 0 is a subgradient at p.
Finally, we will frequently take the subgradient of a function in the form h(p) = max i∈I h i (p).
Theorem 2.10 (Envelope Theorem).Let h(p) = max i∈I h i (p) where I is an index set and h i (p)'s are all convex.Then h is convex and ∂h(p) is the convex hull of the subgradient ∂h i (p) f or i ∈ arg max i∈I h i (p).In particular, any subgradient of h i (p) is a subgradient of h(p) whenever i ∈ arg max i∈I h i (p).
3 Walrasian equilibrium for General Valuations in Õ(n 2 • T AD + n 5 ) We show that in the aggregate demand oracle model, whenever a Walrasian equilibrium exists, it can be computed using Õ(n 2 ) aggregate demand oracles calls and Õ(n 2 • T AD + n 5 ) time.We want to emphasize that our result is in the aggregate demand oracle model -which is the typical information available to markets: which goods are under-and over-demanded by the population of buyers?Previous polynomial-time algorithms for computing Walrasian equilibria [BM97, NS06, Mur96c, MT03] require buyer-level demand oracles or value oracles.Previous algorithms that use only aggregate demand oracles (such as [KC82, GS99, AM02, PU02, dVSV07] and related methods based on ascending auctions) are pseudopolynomial since they depend linearly on the magnitude of the valuation functions.First we discuss a linear programming formulation for this problem and a corresponding convex programming formulation.The formulation itself is fairly standard and appears in various previous work.When we try to find an exact minimizer of this formulation in polynomial time using only aggregate demand oracles, we encounter a series of obstacles.The main ones are: (i) how to optimize a function we cannot evaluate; and (ii) how to find an exact minimizer using convex optimization.In both cases, we need to apply optimization algorithms in a non-black-box manner and exploit special structure of the problem.
Linear Programming Formulation We start from the formulation of Bikhchandani and Mamer [BM97] (also studied by Nisan and Segal [NS06]) of the Walrasian equilibrium problem as a linear program.Consider the following primal-dual pair: ).If a market equilibrium (p eq , x) exists iff the primal program has an integral solution.In such case, the set of equilibrium prices is the set of solutions to the dual LP projected to the p-coordinate.
We provide a proof of the previous lemma in the appendix for completeness.This lemma reduces the problem of finding a Walrasian equilibrium, whenever it exists, to the problem of solving the dual program.The approach in Nisan and Segal [NS06] is to use a (per buyer) demand oracle as a separation oracle for the dual program.Since we only have access to an aggregate demand oracle, we will consider a slightly different LP: given that we care only about the p variables, we can reformulate the dual as: It is simple to see that for every feasible vector (p, u) of the original dual, we can find a corresponding point (p, i u i ) of the transformed dual with the same value.Conversely, given a feasible point (p, u) of the transformed dual, we can come up with a point (p, u) of the original dual with equal or better value by setting Thus it suffices to find an optimal solution to the transformed dual program.The separation problem is now simpler: consider a point (p 0 , u 0 ) that is infeasible.If some constraint is violated, then it must be the constraint for is the output of the aggregate demand oracle.If on the other hand (p 0 , u 0 ) is feasible, we can use the objective function to find a separating hyperplane, since for any optimal solution (p, u) we know that u + p • s ≤ u 0 + p 0 • s.So we can separate it using: An Obstacle The main obstacle to this approach is that since the aggregate demand oracle has no access to the value of i v i (x (i) ), it offers no information of whether a vector (p 0 , u 0 ) is feasible or not, and so it is not clear which separation hyperplane to use.
Convex Programming Formulation One way to get around this obstacle is to further transform the dual program to get rid of utility variable u altogether.We do so by moving the constraints to the objective function in the form of penalties.The problem then becomes the problem of minimizing a convex function.The same function has appeared in [Aus06] as a potential function used to analyze a differential equation governing a price adjustment procedure and in [MSY13] as a potential function to measure the progress of a combinatorial algorithm.Given a market with supply s and agents with valuations v 1 , . . ., v m , we define the market potential function f : R n → R as: Since f is nothing more than the dual linear program with the constraints moved to the objective function, the set of minimizers of f is exactly the set of optimal solutions of the dual linear program (or more precisely, their projections to the p-variable).
One remarkable fact about f is that we can obtain a subgradient from the aggregate demand oracle: is a linear function in p, its gradient is simply −x (i) .So, for any x (i) in the arg max, the vector s − i x (i) is a subgradient o f f .In particular, s − d(p).
A useful fact in studying this function is that we have an initial bound on the set of minimizers: Lemma 3.3.If there exist a Walrasian equilibrium, then the set of minimizers Proof.Let p ∈ P be a vector of equilibrium prices and x an optimal allocation.Since the pair (p, x) constitute a Walrasian equilibrium, then for any item j, there is some x (i) j ≥ 1 and therefore, where 1 j is the unit vector in the j-th coordinate.This gives us: For the upper bound, If there is more than one buyer then p j must be larger than −2M , otherwise all the supply of item j will be demanded by all buyers and therefore p can't be Walrasian.
Lemma 3.4.The set of Walrasian prices is a polytope P whose vertices have coordinates of the form Proof.The vertices of P correspond to p-coordinates of the basic feasible solutions of the dual linear program.Given that the coefficients of the p variables in the linear program are integers from 0 to S. Solving the linear system using Cramer's rule (see Section 5 in [BGT81]) we get that every solution must be a fraction with denominator at most n! • S n ≤ (Sn) n .
Two More Obstacles The natural approach at this point is to try to apply convex optimization algorithms as a black box to optimize f .There are two issues with this approach.The first, which is easier to address, is that unlike algorithms for linear programming which are exact, algorithms for general convex optimization methods give only ǫ-approximation guarantees.We will get around this issue by exploiting the connection between f and the linear program from which it is derived.
A second more serious obstacle is the fact that we don't have access to the functional value of f , only to its subgradient.This is a problem for the following reasons.The way that traditional cutting plane methods work is that they keep in each iteration t a set G t called a localizer.The localizer is a subset of the domain which is guarantee to contain the optimal solution.We start with a large enough localizer set G 0 that is guaranteed to contain the solution.In each iteration t, a point p t ∈ G t−1 is queried for the subgradient ∂f (p t ).Now, if p * is an optimal solution we know that: where the first inequality comes from the fact p * is an optimal solution and the second inequality comes from the definition of the subgradient.This in particular means that any optimal solution must be contained in The method then updates G t to either H t or a superset thereof.The Ellipsoid Methods, for example, updates G t to the smallest ellipsoid containing H t .So far, all the steps depend only on the subgradient and not on the actual functional values of f (p t ).The guarantee of the method, however, is that after a sufficient number of steps, one of the iterates is close to the optimal, i.e., min t f (p t ) − f (p * ) ≤ ǫ.To find the approximate minimizer, however, we need to look at the actual functional values, which we have not access to.See Section 2.2 in Nemirovski's book [Nem05] for a complete discussion on the guarantees provided by cutting plane methods.
A special case : Walrasian prices with non-empty interior The set of Walrasian prices P forms a convex set, since it corresponds to the set of minimizers of the convex function f .If P has non-zero volume, it is possible to find a Walrasian equilibrium using the Ellipsoid Method without needing to know the functional value.If the set is large, the Ellipsoid method can't avoid querying a point in the interior of P for too long.And when a point in the interior of P is queried, the only subgradient is zero, or in market terms, each agent has an unique favorite bundle and those bundles clear the market.This means that the aggregate demand oracle returns exactly the supply.Next we make this discussion formal: Theorem 3.5.Assume that there the set of Walrasian prices P has non-zero volume, then in Õ(n3 ) iterations of the Ellipsoid method 3 is guaranteed to query a Walrasian price p * for which the aggregate demand oracle returns d(p * ) = s.
Proof.By Lemma 3.3, P ⊆ [−2M, 2M ] n , so we can take the initial set of localizers G 0 in the ellipsoid methods to be the ball of radius 2M √ n around 0, which has volume O(M ) n .The Ellipsoid guarantee (see Section 3 of [Nem05]) is that the volume of G t is at most e −t/2n of the initial volume.So if the method hasn't queries any point in the interior of P , then we must have G t containing P .To bound the volume of P we use the fact that is a polytope has vertices p 0 , p 1 , . . ., p n then the volume of the polytope is lower bounded by the volume of the convex hull of those vertices: where the last inequality follows from Lemma 3.4.
Therefore, if G t contains P then: O(M ) n e −t/2n ≥ Ω((Sn) −n 2 ) which implies that t ≤ O(n 3 log(Sn)+ n 2 log(M )) = Õ(n 3 ).So after so many iterations we are guaranteed to query a point in the interior of P .For a point p in the interior of p, there is a small ball around it for which f is flat, so zero must be the unique subgradient at that point.Therefore, the aggregate demand oracle has no choice but to return d(p) = s.
The main drawback of this method is that it strongly relies on the fact that P has non-empty interior.Some very simple and well-behaved markets have a set of Walrasian prices of zero volume.Consider for example a market with two items with supply one of each and three buyers, each having valuation v(0) = 0 and v(x) = 1 otherwise.The set of Walrasian prices is P = {(1, 1, 1)}.Even for p * = (1, 1, 1), the subgradient is not unique since the aggregate demand oracle can return any In this case even trying to modify the objective function is hopeless, since there is no point in the domain for which the aggregate demand oracle is guaranteed to return the supply vector.Since there is no point for which the subgradient oracle is guaranteed to return zero, there is no direct way to recognize a vector of Walrasian prices even if we see one!Approach for the general case Our approach for optimizing f is as follows: first we show how to obtain an ǫ-approximate minimizer of f in time O(n log(nM/ǫ)T AD + n 3 log O(1) (nM/ǫ)).In order to round the ǫ-approximate solution to the optimal solution, we exploit the fact that f came from an linear program and customize the traditional approach of Khachiyan [Kha80] for rounding approximate to exact solutions.
The idea is to use Lemma 3.4 to argue that if f has a unique minimizer, and we set ǫ small enough, then all ǫ-approximate solutions are in a small neighborhood of the exact optimal.Moreover, for small enough ǫ, there should be only one point in the format indicated by Lemma 3.4 in a small neighborhood of the approximate minimizer, so we can recognize this as the exact solution by rounding.
For this approach to work, we need f to have a unique minimizer.To achieve that, we perturbe the objective function f to f in such a way that f has a unique minimizer that this minimizer is still a minimizer of f .There are several ways to implement this approach, the simplest of which uses the isolation lemma (which, by the way, was not available to Khachiyan at the time so he had to resort to something more complicated).
A recent Cutting Plane Method without using functional values The first part of the algorithm consists in obtaining an ǫ-approximate minimizer of f without using its functional value.In order to do so, we use a recent technique introduced by Lee, Sidford and Wong [LSW15].The authors show an efficient algorithm which either identifies a point inside the desired convex set K or certifies that K contains no ball of radius ǫ.We show that their main theorem (Theorem 31) can be used to compute approximate minimizers of convex functions using only the subgradient.We note that in their paper also provides an application of Theorem 31 to minimizing convex functions (Theorem 42 in [LSW15]) but their proof relies on using functional values as they did not assume a separation oracle given by subgradients.
Theorem 3.6 (Lee, Sidford, Wong (Theorem 31 in [LSW15])).Let K ⊆ [−M, M ] n be a convex set and a separation oracle can be queries for every point in p ∈ [−M, M ] n will either return that p ∈ K or return a half-space H = {p ∈ R n ; a i • p ≤ b i } containing K. Then there exists an algorithm with running time O(nT log(nM/δ) + n 3 log O(1) (nM ) log 2 (nM/δ))4 that either produces a point p ∈ K or finds a polytope • The constraints a i • p ≤ b are either from the original box, p i ≤ M or p i ≥ −M or are constraints returned by the separation oracle normalized such that a i 2 = 1.
• The width of P is small, i.e., there is a vector a with a 2 = 1 such that • The algorithm produces a certificate of the previous fact in the form of a convex combination t 1 , . . ., t k with t i ≥ 0, k i=1 t i = 1 and k = O(1) such that: - Now, we now show that this result can be used to obtain a convex minimization algorithm that uses only subgradients: Theorem 3.7.Let f : R n → R be an L-Lipschitz convex function equipped with a subgradient oracle with running time Proof.Let K = arg min p f (p) and use the subgradient as the separation oracle, since if ∂f (p t ) is the subgradient at p t we know that for all p ∈ K, it holds that ∂f (p t ) • (p − p t ) ≤ 0. What we will do is to run the algorithm in Theorem 3.6 starting from a very large box [−M ′ , M ′ ] for M ′ = n O(1) M instead of starting from [−M, M ], which appears to be more natural.The reason we do that is to avoid having the constraints defining the bounding box added to P .
Either the algorithm will return a point p ∈ K, in which case we are done or will return a set P like in statement of the theorem.If we are lucky and all constraints added to P are of the type ∂f (p t ) • p ≤ ∂f (p t ) • p t , then we can use the certificate t 1 , . . ., t k to produce a point p = k i=1 t i p i .Now: gives us the desired result.To be done, we just need to worry about the case where some of the box constraints are present in P .In that case, we argue that the weight put by the coefficients t i on the box constraints must be tiny, so it is possible to remove those and rescale t.Formally, observe that This implies in particular that: . By choosing a very small δ, we guarantee that is B is the set of indices corresponding to box constraints, then . This allows us to define for i / ∈ B, t ′ i = t i / 1 − i∈B t i , so we have: Now we can repeat the argument in the beginning of the proof with p = i / ∈B t ′ i p i .
Perturbation, Approximation and Rounding The next step is to use the algorithm for finding an approximate solution to find an exact solution.This is impossible for generic convex programs, but since the function we are trying to optimize comes from a linear program, we can do that by exploiting this connection.As done for linear programs, we will do this in three steps: first we perturb the function to be optimized, then we find an approximate solution by Theorem 3.7 and finally we round it to an exact solution in the format of the optimal solution given by Lemma 3.4.We can perturb the objective of the dual linear program by changing it to: We want to specify the vector r in such a way that the optimal solution to this linear program is still the optimal solution to the original program, but also in a way that the optimal solution becomes unique.First we observe the following: then an optimal solution of the perturbed program is also an optimal solution to the original program.
Proof.Let C be the set of vertices (basic feasible solutions) of the dual LP.We know by Lemma 3.4 we know that the coordinates of those vertices must be of the form a i /b i for integers a i , b i such that 0 ≤ b i ≤ (nS) n .For any linear objective function, the optimal solution must be a point in C. Since the original objective has integral coefficients, when evaluated on any vertex, the objective is a fraction with denominator b i ≤ (nS) n .Therefore, the difference between the objective evaluated at an optimal vertex and the objective evaluated at a suboptimal one is at least 2n+1) , then its effect in the objective function is at most nS • (nS) −(2n+1) ≤ (nS) −2n , so it can't cause a suboptimal solution to the original program to become an optimal solution of the perturbed program.
Our final ingredient is a lemma by Klivans and Spielman [KS01] which is in the spirit of the Isolation Lemma of Mulmuley, Vazirani and Vazirani [MVV87].
Lemma 3.9 (Klivans and Spielman (Lemma 4 in [KS01])).Let C be a set of points in R n where all coordinates assume at most K distinct values.Then if r is a vector with coordinates sampled at random from {0, 1, . . ., Kn/ǫ}, then with probability 1 − ǫ, there is a unique p ∈ C minimizing r • p.
We note that although Lemma 4 in [KS01] is stated as C having coordinates in {0, 1, . . ., K − 1}, the proof only uses the fact that the coordinates of C assume at most K distinct values.
Lemma 3.10.If r j = z j / M n(nS) 2n+1 where z j is drawn uniformly from {0, . . ., nM (nS) 2n −1}, then with probability 1 2 , the dual program has an unique minimizer and this minimizer is a minimizer of the original program.
Now, Lemma 3.8 guarantees that the magnitude of the perturbation will prevent suboptimal vertices in the original program to become optimal vertices in the perturbed program.Lemma 3.9 guarantees that with half probability the vertex minimizing the objective is unique.
The perturbed dual program translates to the following perturbed objective function: Since the subgradient of f can be computed from the aggregate demand oracle ∂ f (p) = s + r − d(p) we can use Theorem 3.7 to find an ǫ-minimizer.
Lemma 3.11.For ǫ = (nM S) −O(n) , if p is an ǫ-approximation to the optimal value of f , i.e., f (p) − f (p * ) ≤ ǫ then the optimal solution is the only point p * such that p − p * 2 ≤ 1 (nM S) O(n)   and has coordinates of the form described in Lemma 3.4.
Proof.Let C be the set of vertices of the dual linear program, which are points of the form (u i , p i ) and let p be an ǫ-approximation to f .Now, if u = i (max x v i (x) − p • x) then (u, p) is feasible in the dual linear program, and in particular, it can be written as a convex combination of points in C, i.e., (u, p) = i t i (u i , p i ) for t i ≥ 0 and i t i = 1.There is only vector in C, call it (u * , p * ) for which the objective evaluate to f * .For all other vertices, the objective evaluate to at least M n(nS) 3n+1 due to Lemmas 3.4 and 3.10.Therefore, by evaluating (u, p) = i t i (u i , p i ) on the linear objective of the perturbed dual program, we get: where t * is the weight put on (u * , p * ) by the convex combination, therefore, if ǫ = (nM S) −O(n) then t * ≥ 1 − (nM S) −O(n) .In particular: Therefore, p * is in a ball of radius (nM S) −O(n) around p. Also, for any other point p ′ = p * with coordinates of the form a i /b i with b i ≤ (nS) n can be in this ball, since for two distinct points of this type differ in at least one coordinate by at least (nS) −n so their distance is at least that much.
Putting it all together: Theorem 3.12.There is an algorithm of running time O(n 2 T AD log(SM n) + n5 log O(1) (SM n)) to compute an exact vector of Walrasian prices whenever it exists using only access to an aggregate demand oracle.
Proof.From the potential function f of the market, use Lemma 3.10 to construct a perturbed potential function f .Then use Theorem 3.7 to optimize f with ǫ = (nM S) −O(n) .Finally, use the guarantee to argue that the exact optimal value is the only point in the format of Lemma 3.4 in the ball of radius (nM S) −O(n) around the ǫ-approximate minimizer.At this point, we can round the solution to the exact point by using the method of continuous fractions in Kozlov et al [KTK80] (see [Sch98] for a complete exposition of this and related methods of rounding).
4 Walrasian Equilibrium for Gross Substitutes in Õ(nT AD + n 3 ) In the previous section we discussed how Walrasian equilibria can be computed without any assumptions on the valuation function using only an aggregate demand oracle.The focus was to address various difficulties in applying optimization tools for this problem.
Here we remain in the aggregate demand oracle model and focus on computing Walrasian equilbria for markets typically studied in economics, which are those where buyers have gross substitute valuations.The development of the theory of gross substitute valuations is intertwined with the development of the theory of Walrasian equilibrium for markets with discrete goods.In particular, it is the largest class of valuation functions that is closed under perturbation by an additive function 5 for which Walrasian equilibria always exist.
Gross substitutes play a central role in economics.Hatfield and Milgrom [HM05] argue that most important examples of valuation functions arising in matching markets belong to the class of gross substitutes.Gross substitutes have been used to guarantee the convergence of salary adjustment processes in the job market [KC82], to guarantee the existence of stable matchings in a variety of settings [Rot84,KTY14], to show the stability of trading networks [HKN + 15], to design combinatorial auctions [AM02,MSY13] and even to analyze settings with complementarities [SY06,HK15].
The concept of gross substitutes has been re-discovered in different areas from different perspectives: Dress and Wenzel [DW92] propose the concept of valuated matroids as a generalization to the Grassmann-Plücker relations in p-adic analysis.Dress and Terhalle [DT95] define the concept of matroidal maps which are the exact class of functions that can be optimized by greedy algorithms.Murota [Mur96a] generalized the concept of convex functions to discrete lattices, which gave birth to the theory known as Discrete Convex Analysis.One of the central objects in the Discrete Convex Analysis are M -concave and M ♮ -concave functions (the latter class was introduced by Murota and Shioura [MS99]).
Surprisingly, gross substitutes, valuated matroids, matroidal maps and M ♮ -concave functions are all equivalent definitions -despite being originated from very different motivations.We refer to [PL] for a detailed historic description and a survey on their equivalence.Before presenting our algorithms, we first give a quick summary of the standard facts about gross substitutes that are needed.For a more comprehensive introduction, please see [PL].

A crash course on gross substitutes
First we define gross substitute valuations on the hypercube {0, 1} [n] and then we extend the defintion to [[s]] for any supply vector s.When talking about functions defined on the hypercube, we will often identify vectors x ∈ {0, 1} [n] with the set S = {i ∈ [n] : x i = 1}, so we write v(S) where S ⊆ [n] meaning v(1 S ) where 1 S is the indicator vector of S.
Next we define three classes of valuation functions.The reader which saw the spoilers in the previous subsection will already suspect that they are equivalent.
Definition 4.1.(Gross substitutes, Kelso and Crawford [KC82]) A function v : 2 [n] → Z is a gross substitute (GS) if for any price p ∈ R n and S ∈ D(v, p), any price p ′ ≥ p (entry-wise) has some S ′ ∈ D(v, p ′ ) satisfying S ∩ {j : p j = p ′ j } ⊆ S ′ .In other words, price increases for some items can't affect the purchasing decisions for the items whose price stayed the same.
The second definition concerns when the demand oracle problem max v(S) − p(S) can be solved efficiently: The third definition generalizes the concept of convexity and concavity to the hypercube.We can define convexity for continuous functions f : R n → R as being function such that for all vectors v ∈ R n , if x * is a local minimum of f (x) − v • x, then x * is also a global minimum.This definition generalizes naturally to the hypercube as follows: Discrete concave functions have two important properties: (i) the demand oracle has a succinct certificate of optimality and (ii) the function can be optimized via local search for any given prices.
Those definitions arose independently in different communities and, amazingly enough, those definitions turned out to be equivalent: Theorem 4.4 (Fujishige and Yang [FY03]).A valuation function is in gross substitutes iff it is a matroidal map and iff it is a discrete concave valuation.
The concept of gross substitutes generalizes naturally to multi-unit valuations: given any function v : [[s]] → Z we can translate it to a single-unit valuation function ṽ : 2 [ i s i ] → Z by treating each of the s i copies of item i as a single item.We say that a multi-unit valuation function v is gross substitutes if its corresponding single item version ṽ is in gross substitutes.We refer to the excellent survey by Shioura and Tamura [ST15] on gross substitutability for multi-unit valuations.
An important property of gross substitutes is: Theorem 4.5 (Kelso and Crawford [KC82]).If all buyers have gross substitute valuations, then a Walrasian equilibrium always exists.

Walrasian Prices form an integral polytope
By Theorem 4.5, the set of Walrasian prices is non-empty.We also know that is forms a convex set polyhedral set, since they are the set of minimzers of a convex function that comes from a linear program.Perhaps a more direct way to see it is that given an optimal allocation x, the set of Walrasian prices can be characterized by the following set of inequalities: Lemma 3.4 provided a good characterization of the vertices of this polytope in the general case.For gross substitutes, however, there is an even nicer characterization: Lemma 4.6.If buyer valuations are gross substitutes, then all the vertices of the feasible region of the dual program D (defined in Section 3) have integral coordinates.In particular, the set of Walrasian prices form an integral polytope.
Proof.Let (u, p) be a non-integral feasible point of the dual program D. We will write it as a convex combination of integral points.Let Now, we define a distribution over integral points in the following way: sample a random threshold θ ∈ i) .It is easy to see that (û, p) are integral and that E[(û, p)] = (u, p).We are only left to prove that (û, p) are feasible.
We know that û ≥ i v i (x (i) ) − p • x (i) since ŵ ≥ 0. If we show that x (i) ∈ arg max x v i (x) − p • x, then we are done, since it automatically implies that all other constraints in the dual program D are satisfied.To see this notice that since x (i) ∈ arg max v i (x) − p • x, then for all items j and k such that x (i) j < s j and x (i) k > 0 we have that: Since the valuations are integer valued, it is simple to check that rounding using a threshold won't violate any of the above inequalities.Thus: Therefore under price vector p, a buyer can't improve his utility from x (i) by adding, removing or swapping an item.Since gross substitutes are equivalent to discrete concavity (Definition 4.3), local optimality implies global optimality, i.e., x (i) ∈ arg max Another important property proved by Gul and Stachetti [GS99] is that the set of Walrasian prices forms a lattice.
Theorem 4.7 (Gul and Stachetti [GS99]).If buyer valuations are gross substitutes, then the set of Walrasian prices form a lattice, i.e., if p and p ′ then p and p are also Walrasian prices for pi = max(p i , p ′ i ) and p i = min(p i , p ′ i ).

A simpler and faster algorithm for gross substitutes
Using the fact that the set of Walrasian prices is an integral polytope with a lattice structure we simplify the algorithm described in the previous section and improve its running time.First, since we have a lattice structure we no longer need to randomly perturb the objective function to make the solution unique.A simple and deterministic perturbation suffices.Integrality also allows us to round to an optimal solution from an approximate solution of smaller accuracy (i.e.larger ǫ).
Lemma 4.8.If valuations are gross substitutes, then by taking r j = 1 2Sn in the perturbed dual program PD, its optimal solution is unique and also optimal for the original dual program D.
Proof.Since all the vertices of the polytope are integral and the coefficients are at most S, a perturbation of r j = 1 2Sn can't affect the objective by more than half.So it can't cause a suboptimal vertex to become optimal.Also, since the set of Walrasian prices form a lattice, there is a Walrasian price p such that p ≥ p for every Walrasian price p. Therefore this must be the unique optimal solution to the perturbed program.
The previous lemma allows us to prove a better version of Lemma 3.11: Lemma 4.9.For ǫ < 1/(4nM S), if p is an ǫ-approximation to the optimal value of f , i.e., f (p) − f (p * ) ≤ ǫ then the optimal solution is the only integral point p * such that p − p * 2 < 1 2 .
Proof.It follows exact the same proof of Lemma 3.11 when the better guarantees provided by Lemma 4.8 are used.
Putting it all together we have: Theorem 4.10.There is an algorithm of running time to compute an exact vector of Walrasian prices in a market where buyers have gross substitute valuations.
Proof.Same proof as in Theorem 3.12 with ǫ = 1/(5nM S).Also, since the optimal price vector is integral, instead of using the method of continuous fractions to round a solution, it is enough to round each component to the nearest integer.
5 Walrasian Equilibrium for Gross Substitutes in Õ((mn + n 3 ) • T V ) We now move from the macroscopic view of the market to a microscopic view.We assume access to the market via a value oracle, i.e, given a certain buyer i and a bundle S ⊆ [n] of goods, we can query the value of v i (S).We also assume from this point on that the supply of each good is one, or in other words, that the valuation functions are defined on the hypercube.The fact that the demand of each buyer for any given price can be computed by the greedy algorithm (Definition 4.2) lets us simulate the aggregate demand oracle by the value oracle model.
Lemma 5.1.The outcome of the aggregate demand oracle can be computed from in time O(mn 2 T V ), where T V is the running time of the value oracle.
Proof.The number of queries required for the greedy algorithm described in Definition 4.2 to compute Since there are m buyers, the total time to compute the demand of all buyers is O(mn 2 T V ).The aggregate demand oracle simply outputs d(p) where d j (p) = #{i : j ∈ S * i }.
Now we can plug Lemma 5.1 directly into Theorem 4.10 and obtain a running time of Õ(mn 3 T V ).In the rest of this section, we show how to improve this to Õ((mn + n 3 )T V ).

Faster Algorithm via regularization
The idea to improve the running time from Õ(mn 3 T V ) to Õ((mn + n 3 )T V ) is to regularize the objective function.As with the use of regularizers in other context in optimization, this is to penalize the algorithm for being too aggressive.The bound of O(mn 2 ) value oracle calls per iteration of the cutting plane algorithm is so costly precisely because we are trying to take an aggressively large step.
To provide some intuition, imagine that we have a price p that is very close to optimal and that S i are the set of items demanded by the buyers at price p. Intuitively, if p is close to a Walrasian price then the sets S 1 , . . ., S m should be almost disjoint, which means that the total cost of the greedy algorithm should be i n(|S i | + 1) ≈ mn + n 2 .So when the prices are good, oracle calls should be cheaper.This tells us that when prices are good, fewer calls to the value oracle suffice to compute the aggregate demand oracle.When prices are far from equilibrium, perhaps a more crude approximation to the aggregate demand oracle is enough.
Based on this idea we define the following regularized objective function: The regularization consists of taking the maximum over all sets (S 1 , . . ., S n ) such that i |S i | = n.Without this restriction, we have the original market potential function f .The new function f has three important properties: (i) it is still convex, since it is a maximum over linear functions in p and therefore we can minimize it easily; (ii) its set of minimizers is the same as the set of minimizers of f and (iii) subgradients are cheaper to compute.Intuitively, f is very close to f when p is close to equilibrium prices but only a crude estimate when p is far from equilibrium.Next we show those statements formally and present an algorithm for computing the subgradient of f .
We give an alternate form of f which is nicer to work with algorithmically.The next lemma shows that for some γ that depends on p (and the tiebreaking rule used by the greedy algorithm).Among other things, this formulation of f resembles common regularizers used in optimization better.One can think of it as if p is changed to Lemma 5.2.Suppose v i (j) are given and stored as n lists sorted in decreasing order With a running time of n 2 • T V + Õ(n 2 ) 6 , given price p, there is an algorithm, which we call All-Greedy, that finds 2. γ such that for all i, S * i ∈ D(i, p+γ •1 [n] ).Moreover, for any γ ′ > γ and 6 Assuming the cost of initializing S * i = ∅ is not needed.This is acceptable here because our algorithm would only use S * i to compute the subgradient which S * i = ∅ has no effect on.
Proof.First, we define the algorithm AllGreedy.The algorithm starts with a very large value of γ such that D(i, p + γ • 1 [n] ) = {∅} for all agents i.Then we gradually decrease γ keeping at each step a set ) that monotonically grow as γ decreases, in the sense that for γ 1 > γ 2 , S * i (γ 1 ) ⊆ S * i (γ 2 ).We stop the algorithm as i |S * i (γ)| reaches n.The algorithm is best visualized as a continuous process, although it admits a very efficient discrete implementation as we will see in a moment.Before, we note that we can use the Greedy algorithm to compute ) and if we fix the same tie breaking, the order in which we add the elements is the same for every γ, the only thing that changes is the stopping criteria (the larger γ is, the later we stop).
So this procedure can be implemented by running a greedy algorithm in parallel for each agent i. Initially γ is very large and all S * i (γ) = ∅.Then in any given moment, we can compute what is the largest value of γ for which it is possible to add one more item to the demanded set of i.This is simply the largest marginal of an i for the next item: We can decrease γ to this value and advance one of the agent's greedy algorithm one step further.We need to argue that it satisfies the three properties in the lemma and that it can be implemented in n 2 T V + O(n 2 ) time.For the running time, the algorithm can by updating lists L j such that in each iteration, it is a sorted list of v i (S * i ∪ j) − v i (S * i ).Since all sets start as the empty set, this is correct in the beginning of the algorithm.Now, in each iteration, we can scan all the lists to find the next largest marginal, taking O(n) to inspect the top of each list.This gives us the next value of γ and the pair i, j to update S * i ← S * i ∪ j.Now, after the update, we go through each list L k updating the value of the marginal of agent i for k, since S * i was updated.This takes O(log(m)) for each list, so in total, this process takes nT V + Õ(n).Since there are at most n iterations, the overall running time is n 2 T V + Õ(n 2 ).Now, for three properties in the lemma, property 2 is true by construction.For properties 1 and 3, consider the following chain of inequalities: Hence, all inequalities hold with equality, which means in particular that f (p Corollary 5.3.Suppose v i (j) are given and stored as n sorted lists {v i (j)} j each of which has m elements.Then the greedy algorithm computes a subgradient of f in n 2 • T V + Õ(n 2 ) time.
Proof.This follows directly from Lemma 5.2 as the gradient of m i=1 is an equilibrium price.Here γ is defined as in Lemma 5.2 with respect to p * .Conversely, any Walrasian price p eq is a minimizer of f .The proof of the previous corollary is given in the appendix.
Proof.Corollary 5.4 says that it is enough to find a minimizer of f .The exact same method used in Theorem 4.10 can be used to solve f approximately and then round it to an optimal solution.
To bound the overall running time, we note that: computing v i (j) and storing them as n sorted lists takes mn • T V + O(mn log m) time.By Corollary 5.3, the separation oracle for f can be implemented in

Robust Walrasian Prices, Market Coordination and Walrasian allocations
So far we focused on computing Walrasian prices.Now we turn to the other component of Walrasian equilibrium, which is to compute the optimal allocation.If we have only access to an aggregate demand oracle, then computing prices is all that we can hope for, since we have no per-buyer information (in fact, we don't even know the number of buyers).If we have access to a value oracle, computing the optimal allocation is possible.
To convince the reader that this is a non-trivial problem, we show that computing an optimal allocation from Walrasian prices is at least as hard as solving the Matroid Union Problem.In the Matroid Union problem we are given m matroids defined over the same ground set M i = ([n], B i ) and a promise that there exist basis B i ∈ B i such that [n] = ∪ i B i .The goal is to find those bases.Now, consider the following mapping to the problem of computing an optimal allocation: consider m agents with valuations over a set [n] of items such that v i = r M i , i.e. the rank of matroid M i (matroid rank functions are known to be gross substitute valuations [PL]).The price vector 1 is clearly a vector of Walrasian prices.Finding the optimal allocation, however, involves finding S = (S 1 , . . ., S m ) maximizing i r M i (S i ).
The previous paragraph hopefully convinced the reader that finding an allocation is not always a simple task even if we know the prices.One approach to solve this problem is based on a modification of standard matroid union algorithms.
The second approach, which we discuss here in details, is based on convex programming and reveals an important structural property of gross substitute valuations that might be of independent interest.Incidentally, this also answers an open question of Hsu et al. [HMR + 16] who asked what are the conditions for markets to be perfectly coordinated using prices.More precisely, they showed that under some genericity condition the minimal Walrasian price for a restricted class of gross substitutes induces an overdemand at most 1 for each item.On the other hand, our argument in this section says that under the same condition almost every Walrasian prices for any gross substitutes have no overdemand, i.e. the market is perfectly coordinated.This follows from the fact that the polytope of Walrasian prices have nonempty interior and that interior Walrasian price induces no overdemand (see section 6.2).
Next, we review two combinatorial lemmas that will be fundamental for the rest of this section and the next one:

Two combinatorial lemmas
One of the most useful (and largely unknown) facts about gross substitutes is the following analogue to the Unique Matching Theorem for matroids.The version of this theorem for gross substitutes is due to Murota [Mur96b,Mur96c] and it was originally proved in the context of valuated matroids, which are known to be equivalent to gross substitutes under a certain transformation.We refer the reader to Lemma 10.1 in [PL] for a proof of this lemma in the language of gross substitute valuations: Lastly, we state a purely combinatorial lemma that is commonly used in conjunction with the previous lemma.We present a sketch of the proof in the appendix and refer to [PL] for a complete proof.Lemma 6.2.Let G = (V, E, w) be a weighted directed graph without negative weight cycles.Let C be the cycle of minimum number of edges among the cycles with minimum weight.Let M := {(u 1 , v 1 ), . . ., (u t , v t )} be a set of non-consecutive edges in this cycle, U = {u 1 , . . ., u t } and V = {v 1 , . . ., v t }.Construct a bipartite graph G ′ with left set U , right set V and for each edge from u ∈ U to v ∈ V in the original graph, add an edge of the same weight to G ′ .Under those conditions, M forms a unique minimum matching in G ′ .The same result holds for a path P of minimum length among all the minimum weight paths between a pair of fixed nodes.

Robust Walrasian Prices and Market Coordination
Hsu et al. [HMR + 16] raise the following important question: when is it possible to find Walrasian prices that coordinate the market?A vector of Walrasian prices p is said to coordinate the market if each agent has a unique demanded bundle under p and those bundles clear the market.If this happens, we say that this vector is robust.Definition 6.3 (Robust Walrasian Prices).A price vector p is said to be a vector of robust Walrasian prices for a certain market if D(i, p) = {S i } and S = (S 1 , . . ., S m ) form a partition of the items.
Notice that by the Second Welfare Theorem (Lemma 2.3), if the optimal allocation is not unique, then no vector of Walrasian prices is robust, since each vector of Walrasian prices support all the allocations.If the optimal allocation is unique, on the other hand, then we show that a vector of robust Walrasian prices always exists.Moreover, the set of Walrasian prices forms a full-dimensional convex set in which all interior points are robust.Theorem 6.4.If there is a unique partition S = (S 1 , . . ., S m ) maximizing i v i (S i ), then there exist a vector p such for all p ′ ∈ j [p j − 1 2n , p j + 1 2n ] are Walrasian.In particular, the set of Walrasian prices is a full-dimensional convex set and all price vectors in its interior are robust Walrasian prices.
The proof involves the concept of the exchange graph, which was first introduced by Murota in [Mur96c] and it characterizes the set of all Walrasian prices as the dual variables of the shortest path polytope for a certain graph.Given an optimal allocation S = (S 1 , . . ., S m ), the Second Welfare Theorem (Lemma 2.3) combined with the characterization of gross substitute functions from Discrete Convex Analysis (Definition 4.3) tells us that the set of Walrasian prices can be characterized by: Which is clearly a convex set defined by A nice combinatorial interpretation of this polytope is that it corresponds to the set of potentials in a graph.
To make the construction nicer, augment the items with m dummy items, one for each buyer.The set of items becomes [n] ∪ [m], and the valuations are extended to the subsets of [n] ∪ [m] in a way that agents completely ignore the dummy items, i.e., for Also, augment S i to contain the dummy item for buyer i.Under this transformation we can simplify the definition of P to: since we can represent adding and removing an item as a swap with a dummy item.Under this transformation, construct a directed graph with one node for each item in [n].For each i ∈ [m], j ∈ S i and k / ∈ S i , add an edge (j, k) with weight w j,k = v i (S i ) − v i (S i ∪ k − j).Since the allocation S = (S 1 , . . ., S m ) is optimal, there exists at least one vector of Walrasian prices p ∈ P .This guarantees that the graph exchange graph has no negative cycles, since for any cycle C = {(j 1 , j 2 ), . . ., (j t , j 1 )}, we can bound the sum of weights by r w jr,j r+1 ≥ r p jr −p j r+1 = 0, where the inequality follows from the definition of P and the definition of the weights.Now we argue that the exchange graph can't contain any cycles of zero weight: Lemma 6.5.If S is the unique optimal allocation, then the exchange graph has no cycles of zero weight.
Proof.If there were cycles of zero weight, let C be the cycle of zero weight of minimum length.Now, let C i = {(j 1 , t 1 ), . . ., (j a , t a )} be the edges (j, t) in C with j ∈ S i and (consequently) t / ∈ S i .Now, define S ′ i = S i ∪ {t 1 , . . ., t a } − {j 1 , . . ., j a }.Notice that we performed the swaps prescribed by the cycle, so each item that moved was removed from one set and added to another and as a result, S ′ = (S ′ 1 , . . ., S ′ m ) is still a partition of the items.Using Lemmas 6.2 and 6.1 we get that: w jt therefore: and so S ′ = (S ′ 1 , . . ., S ′ m ) is an alternative optimal allocation, contradicting the uniqueness of S.
Now we are ready to prove the Theorem 6.4: Proof of Theorem 6.4.Since we know there are no zero weight cycles and all the edge weights are integral, all cycles have weight at least 1.Now perform the following operation: for each vertex j ∈ [n] in the directed graph, split it into j 1 and j 2 with an edge between j 1 and j 2 with weight − 1 n .Make all incoming edges to i be incoming to j 1 and all outgoing edges from j to be outgoing from j 2 .The resulting graph has again no cycles of negative weight, since the new edges can decrease each cycle by at most 1.Therefore, it is possible to find a potential in this graph.A potential of a weighted graph with edge weights w jt is a function φ from the nodes to R such that φ(t) ≤ φ(j) + w jt .It can be easily computed by running a shortest path algorithm from any fixed source node and taking the distance from source node to j as φ(j).For the particular case of the graph constructed, it is useful to take the source as one of the dummy nodes.
After computing a potential from the distance from a dummy node to each node, define the price of j as p j = φ(j 2 ).By the definition of the potential for each edge (j, t) in the graph: This means in particular that all inequalities that define P are valid with a slack of 1 n .Therefore, changing any price by at most 1 2n still results in a valid Walrasian equilibrium.This completes the proof of the first part of the theorem.
Since P contains a cube, then it must be a full-dimensional convex body.Finally, let's show that every price vector in the interior of P is a vector of robust Walrasian prices.By the second welfare theorem (Lemma 2.3), S i ∈ D(i, p) for all p ∈ P .Now, assume that for some point in the interior, there is S ′ i ∈ D(i, p), S ′ i = S i .Then either: (i) There is j ∈ S ′ i − S i .We decrease the price of j by ǫ so S ′ i becomes strictly better than S i , i.e. S i / ∈ D(i, p − ǫ1 j ), which contradicts the second welfare theorem since p − ǫ1 j ∈ P .(ii) There is j ∈ S i − S ′ i .We increase the price of j by ǫ so S ′ i becomes strictly better than S i , i.e. S i / ∈ D i (i, p + ǫ1 j ), which again contradicts the second welfare theorem since p + ǫ1 j ∈ P .

Computing Optimal Allocation
Theorem 6.4 guarantees that if the optimal allocation is unique, then the set of Walrasian prices has large volume.Since the set of Walrasian prices corresponds to the set of minimizers of the market potential f (p), then there is a large region where zero is the unique subgradient of f .In such situations, convex optimization algorithms are guaranteed to eventually query a point that has zero subgradient.The point p queried corresponds to a set of Walrasian prices and the optimal allocation can be inferred from the subgradient (recall Theorem 3.5).
Our strategy is to perturb the valuation functions in such a way that the optimal solution is unique and that it is still a solution of the original problem.It is important for the reader to notice that this is a different type of perturbation than the one used in previous sections.While previously we perturbed the objective of the dual program, here we are effectively perturbing the objective of the primal program.One major difference is that if we perturb the objective of the dual, we can still compute the subgradient of f in PC using the aggregate demand oracle.If we perturb the objective of the primal, we no longer can compute subgradients using the aggregate demand oracle.With value oracles, however, this is still possible to be done.
To perturb the primal objective function, we use the isolation lemma, a standard technique to guarantee a unique optimum for combinatorial problems.Lemma 6.6 (Isolation Lemma [MVV87]).Let w ∈ [N ] n be a random vector where each coordinate w i is choosen independently and uniformly over [N ].Then for any arbitrary family F ⊆ 2 [n] , the problem max S∈F i∈S w i has a unique optimum with probability at least 1 − n/N .
For our application, we would like a unique optimum to the problem of maximizing m i=1 v i (S i ) over the partition (S 1 , . . ., S m ).To achieve this, we first replace v i by ṽi (S) = Bv i (S) + w i (S) where B is some big number to be determined and w i (j) is set as in the isolation lemma (with N to be determined as well).Lemma 6.7.By setting B = 2nN , N = mn O(1) and sampling w i (j) uniformly from [N ] for each i ∈ [m] and j ∈ [n], then with probability 1 − 1/n O(1) , there is an unique partition (S 1 , . . ., S m ) maximizing m i=1 ṽi (S i ), for ṽi (S) = B • v i (S) + w i (S).
Proof.Let (S ′ 1 , . . ., S ′ m ) be an optimal solution w.r.t the original problem.We first show that any suboptimal partition (S 1 , . . ., S m ) cannot be optimal for the perturbed problem.Since v i assume integer values, we have which shows that a suboptimal solution to the original problem cannot be optimal for the perturbed one.Now, consider all partitions (S ′ 1 , . . ., S ′ m ) that are optimal for the original problem and identify each optimal partition with a subsets of [mn] = {(i, j); i ∈ [m], j ∈ [n]} in the natural way: add (i, j) to the subset if j ∈ S ′ i .This family of subsets corresponds to F ⊆ 2 [mn] in the statement of the Isolation Lemma and w i (j) corresponds to w.The result then follows from applying that lemma.
The strategy to find an optimal allocation is to perturb the valuation functions, then search for an interior point in the set of minimizers of the market potential function f .When we find such a point we can obtain a vector of Walrasian prices for the original market by rounding and the optimal allocation by inspecting the subgradient.To get the desired running time, we need to apply those ideas to the regularized potential function f (see RC in Section 5) instead of the original one.To apply this to the regularized potential we need an extra lemma: Lemma 6.8.Let p be an interior point of the set of minimizers of the regularized potential function f , then the allocation (S * 1 , . . ., S * m ) produced by the AllGreedy algorithm in Lemma 5.2 is an equilibrium allocation.
Proof.If (S * 1 , . . ., S * m ) is a partition over the items, then it is an optimal allocation by part 2 of Lemma 5.2.To show that it is a partition, observe that since (S * 1 , . . ., S * m ) is a maximizer of i v i (S i ) − p(S i ) subject to i |S i | = n, then we can use it to build a subgradient g of f such that g j = −1 + |{i; j ∈ S * i }|.Since p is an interior point of the set of minimizers, the subgradient must be zero and therefore |{i; j ∈ S * i }| = 1 for all j.
Proof.Use Lemma 6.7 to perturb the valuation functions and obtain ṽi which are still gross substitutes (since they are the sum of a gross substitute valuation and an additive valuation) and there is an unique optimal allocation.By Lemma 6.4, the set of minimizer of the market potential function f contains a box of width 1/n.Since the set of minimizers of the market potential f is contained in the set of minimizers of the regularized potential f , then its set of minimizers also contains a box of width 1/n.We also know that it is contained in the box [−M mn O(1) , M mn O(1) ] n since |ṽ i (S)| ≤ O(M mn O(1) ).
If we apply the algorithm in Theorem 3.6 with δ = O(1/n O(1) ) to optimize the regularized potential f then we are guaranteed to query a point in the interior of minimizers as otherwise the algorithm would certify that there is a with a 2 = 1 such that max p∈P a•p−min p∈P a•p ≤ 1/n O(1) , where P is the set of minimizers.
Finally, we can obtain the optimal allocation for the perturbed using Lemma 5.2, which is an optimal allocation to the original market according to Lemma 6.7.

Combinatorial approach to Walrasian Equilibrium for Gross Substitutes
In a sequence of two foundational papers [Mur96b,Mur96c], Murota shows that the assigment problem for valuated matroids, a class of functions introduced by Dress and Wenzel [DW90] can be solved in strongly polynomial time.We show how this algorithm can be used to obtain an Õ(nm + n 3 ) strongly polynomial time algorithm for problem of computing a Walrasian equilibrium for gross substitute valuations.Our contribution is two-fold: first we map the Walrasian equilibrium problem on gross substitute valuations to the assignment problem on valuated matroids and analyze its running time.The straightforward mapping allows us to obtain a strongly polynomial time algorithm with running time O(mn 3 log(m + n)).We note that a different way to reduce the Walrasian equilibrium problem to a standard problem in discrete convex analysis is to map it to the M -convex submodular flow problem as done in Murota and Tamura [MT03].We choose to reduce it to the assignment problem on valuated matroids since its running time is simpler to analyze.Inspired by our O(mn + n 3 ) algorithm, we revisit Murota's algorithm and propose two optimizations that bring the running time down to O((mn + n 3 ) log(m + n)).Murota's algorithm works by computing augmenting paths in a structure known as the exchange graph.First we show that for the Walrasian equilibrium problem, this graph admits a more succint representation.The we propose a data structure to amortize the cost of some operations across all iterations.
In section 7.1 we define valuated matroids and the assignment problem for valuated matroids.Then we describe Murota's algorithm for this problem.We also discuss the relation between the assignment problem for valuated matroids and the welfare problem for gross substitutes.The goal of subsection 7.1 is to provide the reader with the historical context for this result.
The reader insterested solely in the welfare problem is welcome to skip to Section 7.2 which can be read independently, without any mention to valuated matroids or the assignment problem.A complete proof is given in that section.

The assignment problem for valuated matroids
A valuated matroid is an assignment of weights to basis of a matroid respecting some valuated analogue of the exchange property.
Valuated matroids are related to gross substitutes by the following one-to-one correspondence.We refer the reader to Lemma 7.4 in [PL] for a proof.

Proposition 7.2. A valuation function
) is a valuated matroid defined over the basis of the n-uniform matroid on 2n elements.Now, we are ready to define the assignment problem for valuated matroids: where M is a subset of edges of E forming a matching and M 1 and M 2 are the sets of endpoints of M in V 1 and V 2 respectively.
Murota gives two strongly-polynomial time algorithms based on network flows for the problem above in [Mur96c] -the first based on cycle-cancellations and the second based on flowaugmentations.Although the running time is not formally analyzed in his paper, it is possible to see that his algorithm (more specifically the algorithm Augmenting algorithm with potentials in Section 3 of [Mur96c]) has running time Õ(rank First, we show a simple reduction from the welfare problem for gross substitutes to this problem.Given m gross substitute valuation functions v i : 2 [n] → R, define the following instance of the valuated matroid assignment problem: define the first matroid as [mn]   n i.e. the n-uniform matroid on mn elements.Interpret the elements of [nm] as "the allocation of item j to agent i" for each pair (i, j).Following this interpretation, each S ⊆ [nm] can be seen as S = ∪ m i=1 S i where S i are the elements assigned to agent i.This allows us to define for each S ∈ [mn]  n , ω 1 (S) = i v i (S i ).For the second matroid, let M 2 = ([n], 2 [n] ) and ω 2 (S) = 0 for all S. Finally, define the edges of E such that for each j ∈ [n], the j-th element of [n] are connected to the element (i, j) in [mn] for each i.
One needs to prove that ω 1 satisfies the properties defining a valuated matroid, but this can be done using the transformations described in [PL].We omit this proof since we are giving a self-contained description of the algorithm in the next section.
7.2 Gross substitutes welfare problem in Õ(nm + n 3 ) time In this section we give a self-contained description of a specialized version of Murota's algorithm for the gross substitutes welfare problem and show that the running time of Õ(m • n 3 ) can be improved to Õ(nm + n 3 ).Murota's algorithm for the case of generic valuated matroids can be quite complicated.Since the underlying matroids are simple (uniform matroids) and the functions being optimized have additional structure, it is possible to come up with a simpler algorithm.Our presentation also makes the algorithms accessible to the reader not familiar with discrete convex analysis and the theory of valuated matroids.
We consider the setting in which a set [n] of items needs to be allocated to m agents with monotone valuation functions v i : 2 [n] → R satisfying the gross substitutes condition.Consider the intermediary problem of computing the optimal allocation for the first k items (in some arbitrary order): max i v i (S i ) s.t.∪ i S i ⊆ [k] := {1, 2, . . ., k} and S i ∩ S j = ∅ for i = j (I k ) The central idea of the algorithm is to successively solve I 1 , I 2 , . . ., I n using the solution of I k to compute I k+1 .We will show how a solution to (I k+1 ) can be computed from a solution of (I k ) via a shortest path computation in a graph with Õ(m + n 2 ) edges.we add j in S i .Formally, let (t r , j r ) r=1..a be all the edges in P with t r ∈ S i or t r = φ i .Then we update S i to S i ∪ {j 1 , . . ., j a } − {t 1 , . . ., t a }.
The execution of Dijkstra also produces a certificate of optimality of the shortest path in the form of the minimum distance from some φ i to any given node.So, there is a distance function d such that d(φ i ) = 0, d(j) ≤ d(φ i ) + w φ i ,j , d(j) ≤ w t,j + d(t) Moreover, for all edges (t, j) and (φ i , j) in the shortest path P , this holds with equality, i.e.: d(j) = d(φ i ) + w φ i ,j and d(j) = w jt + d(t).Update the price of each item j from p j to p j − d(j).

Running time analysis
Before we show that each iteration produces an optimal pair of allocation S and prices p for problem (I k ) we analyze the running time.
The exchange graph for problem (I k ) as previously described has O(mk + k 2 ) edges.Running Dijkstra's algorithm on this graph has running time Õ(mk + k 2 ) for (I k ), which corresponds to Õ(mn 2 + n 3 ) time overall.
In order to get the overall running time down to Õ(mn + n 3 ) we need one extra observation.Since we want to compute the shortest path from any of the φ i nodes to k, we can collapse all φ i nodes to a single node φ.Now, for any given node j: Now, the graph is reduced to O(k 2 ) edges for problem (I k ).So, Dijkstra can be computed in Õ(k 2 ).We are only left with the task to compute w φ,j .Our task is to compute min i [v i (S i ) − v i (S i ∪ j)].This can be divided in two parts: 1. active agents: the minimum among the agents i for which S i = ∅.There are at most k of those, so we can iterate over all of them and compute the minimum explicitly; 2. inactive agents: the minimum over all agents with S i = ∅.In order to do so we maintain the following data structure: in the first iteration, i.e. in (I 1 ), we compute v i ({j}) for every i, j (which takes O(mn) time) and keep for each item j a sorted list L j in decreasing order of v i (j) for all i.
In the end of each iteration, whenever an innactive agent i becomes active (i.e.we allocate him an item), we remove them from L j for all j.This operation takes O(n) time to go over all lists.
Now, once we have this structure, we can simply compute the minimum among the innactive buyers min i [v i (S i ) − v i (S i ∪ j)] = − max i v i ({j}) we simply look the minimum element of the list L j .Therefore, even though we need to pay O(mn) time in (I 1 ).In each subsequent iteration we pay only O(n) to update lists L j and then we can make query the value of w φ,j in constant time.
This leads to a running time of O(mn) in (I 1 ) and Õ(n + k 2 ) in each subsequent iteration, leading to an overall running time of Õ(mn + n 3 ).We also note that for each edge we build of the graph, we query the value oracle once.So the oracle complexity is O(nm + n 3 ) value oracle calls.

Correctness
We are left to argue that the solution (S, p) produced by the algorithm is indeed a valid solution for problem (I k ).This can be done by checking that the price vector p obtained certifies the optimality of S. The main ingredients for the proof are Lemmas 6.1 and 6.2.We encourage the reader the revisit the statement of those lemmas before reading the proof of the following theorem.This means that under the price vector p k the bundles S k−1 i is still the demanded bundle by agent i (by Definition 4.3).This means in particular that for all S ′ ⊆ [k]: Now, let (t r , j r ) r=1..a be the set of edges in the path P outputted by Dijkstra such t r ∈ S k−1 i .Then S k i = S k−1 t ∪ {j 1 , . . ., j a } − {t 1 , . . ., t a }.Using Lemma 6.2, we note that (t 1 , r 1 ), . . ., (t a , r a ) is an unique minimum matching in the sense of Lemma 6.1.Therefore: Summing −p k (S k i ) + p k (S k+1 i ) on both sides, we get: wtr,jr = 0 Therefore:

Descending Auction View
One can reinterpret the procedure above as a descending auction.Initially all items very large price (say like the price set for p k in the beginning of phase k).Each shortest path computation produces a distance function d that dictates how each price should decrease.Indeed, they monotonically decrease until we reach a Walrasian equilibrium.
We note that it is important in this algorithm that we compute in each step both a primal and a dual solution.Without the dual solution (the price vector), it is still possible to carry out the shortest path computation, but since the edges in the path can have mixed signs, Dijkstra's algorithm is no longer available and one needs to pay an extra factor of n to run Bellman-Ford's algorithm.
Let M ′ be an alternative matching between U and V of weight at most the weight of M .If M ′ has smaller weight, replace M by M ′ and C ∪ M ′ − M is a collection of cycles with total weight smaller than the weight of C. Since all cycles have non-negative weight, one of the cycles must have weight less than C, contradicting the fact that C is a minimum weight cycle.Now, if M and M ′ have the same weight, consider the following family of cycles: for each edge e = (u ′ , v ′ ) ∈ M ′ , construct a cycle C e composed of edge e and the path from v ′ to u ′ in C (in other words, we use e to shortcut C).There is an integer k ≤ t such that the collection of cycles C e uses in total: one of each edge from M ′ , k − 1 of each edge from M and k of each edge from C − M .So the average weight is at most the weight of C. Since the C e cycles have strictly less edges than C, there should be a cycle with fewer edges than C and weight at most C, which again contradicts the choice of C.
The argument for paths is analogous.
Proof.Let C be the set of vertices (basic feasible solutions) of the dual linear program in [−M, M ] n .All the minimizers of the original dual program are guaranteed to be in this set because of Lemma 3.3.Lemmas 3.3 and 3.4 tell us that the coordinates of points in C are of the form a i /b i where a i and b i are integers such that 1 ≤ b i ≤ (nS) n and |a i | ≤ M b i .So there are at most Definition 4.2.[Matroidal Maps, Dress and Terhalle [DT95]]A function v : 2 [n] → Z is called matroidal if for any price p ∈ R n , the set S obtained by the following greedy algorithm solves max S⊆[n] v(S) − p(S): Greedy algorithm: Start with the empty set S = ∅.While |S| < n and there exists i / ∈ S such that v(S ∪ i) − p i − v(S) > 0, then update S ← S ∪ i * where i * = arg max i∈[n]−S v(S ∪ i) − p i − v(S) (break ties arbitrarily).

Definition 7. 1 (
Valuated matroid).Let B be the set of basis of a matroid M = (V, B).A valuated matroid is a function ω : B → R ∪ {±∞} such that for all B, B ′ ∈ B and u ∈ B − B ′ there exists v ∈ B ′ − B such that:

Theorem 7. 4 .
Let S k i , p k j be the solution of problem (I k ), then for all agent i and allS ′ ⊆ [k], v i (S k i ) − p k (S k i ) ≥ v i (S ′ ) − p k (S ′ ).Proof.Let S k−1 i , p k−1 jbe the solution of problem (I k−1 ) and let S k i , p k j be the solution of problem(I k ).If d(•) is the distance function returned by Dijkstra in (I k ), then p k j = p k−1 j − d(j)and we also know that wjt = w jt + d(t) − d(j) ≥ 0 and wφ i ,j = w φ i ,j − d(j) ≥ 0 by the observation in the end of the Section 7.2.2.This implies that for all i and j / ∈ S k−1 i , it holds that:wt,j = v i (S k−1 i ) − v i (S k−1 i ∪ j − t) + p k j − p k t ≥ 0 and wφ i ,j = v i (S k−1 i ) − v i (S k−1 i ∪ j) + p k j ≥ 0This means that properties Add and Swap are satisfied.To see that Remove is also satisfied forj < k since v i (S k−1 i ) ≥ v i (S k−1 i − j) + p k−1 j for all j ∈ S k−1 i .Since p k j ≤ p k−1 j, this condition must continue to hold.