  We consider the problem of learning how to optimally allocate treatments
whose cost is uncertain and can vary with pre-treatment covariates. This
setting may arise in medicine if we need to prioritize access to a scarce
resource that different patients would use for different amounts of time, or in
marketing if we want to target discounts whose cost to the company depends on
how much the discounts are used. Here, we derive the form of the optimal
treatment allocation rule under budget constraints, and propose a practical
random forest based method for learning a treatment rule using data from a
randomized trial or, more broadly, unconfounded data. Our approach leverages a
statistical connection between our problem and that of learning heterogeneous
treatment effects under endogeneity using an instrumental variable. We find our
method to exhibit promising empirical performance both in simulations and in a
marketing application.
