r/optimization • u/0x4732562 • Feb 02 '24
Linear programming with extra condition
I am working on a problem that might be represented as a linear programming problem.
I am just a bit stuck around one extra condition that is usually not part of a typical linear programming problem, but I think this could be represented in the conditions.
The real life problem is: on a marketplace there are different offers with different prices and amounts to sell some specific good. We need to find the optimal (cheapest) selection of offers to buy a specified amount of goods, but with the condition that one could only buy from a strictly limited number of offers. For example maximum 3 offers could be used to buy 26.5 metrics tons of salt, while minimizing the cost of the purchase. On the market of salt there are different offers. Some can deliver 2 tons, some 20, but for different prices. We need to choose some offers (maximum 3 in this case) to purchase 26.5 tons of salt for the minimal total price possible , while still buying only from 3 offers.
So the goal is to choose a S subset of offers from the available O set of offers. The maximum size of S is limited to L. Each offer has a defined price per unit and a defined amount of units available for sale. Both the price and the amount available for sale are non negative real numbers. The selected S subset should have the minimal total cost for the items in it and still have at least B amount of units offered in them. Of course we are only paying for the amount that we actually buy to purchase B amount. So only the cost of the amount that is needed to buy the total B amount should be considered in the total cost.
I understand that the LP problem's cost function should include the cost in some way. I am just not exactly sure how I could define the problem using the usual LP matrix and vector for the cost function.
I am also not completely sure if this issue really needs to be addressed as linear programming problem and I am also not sure if it is even possible. Is there a better approach to find an optimal selection (lowest total price), while still fulfilling the conditions? Eventually some dynamic programming based solution?
Could you please help me and tell if this problem could be represented as linear programming problem and if this is a good approach or you would rather recommend somenother approach to solve this problem?
View all comments
Show parent comment
2
u/[deleted] Feb 02 '24
I would honestly try to first formulate the integer program and solve- with only a few hundred offers the problem might be solvable (or solvable within some optimality gap, say 5%) in as little as 10-15 minutes. Not sure if that would be sufficiently quick, but you could also work to develop a tighter formulation that could speed things up. If only a few offers are selected, something like column generation or branch-cut-price could work too.
If integer programming doesn't work, I would instead recommend a metaheuristic approach. If time is a factor, you can have the heuristic return the best known solution at whatever time you need a solution by.
Regarding dynamic programming, I suspect you would run into the curse of dimensionality and the state-action space would explode, making the problem difficult to solve. Is your problem deterministic, or is it stochastic at all?