Need to consider more general case on `cost`. For now, the solver could allow linear functional form (constant marginal cost), and potentially the `k` parameter could be used to approximate quadratic form cost (linear mc). But if cost function goes higher order, solver could fail.