I am writing a software as small project in TypeScript/JavaScript and got to a problem i cant solve: A Company makes a new contract with a customer and wants to order materials. There are serval suppliers with fix delivery costs. Each supplier can offer some of the materials with different pack sizes and prices. What is the best approach to get the materials for the lowest price? I wanted my App to automatically suggest the best order.
* You can order at multiple suppliers; You can order more materials than needed *
Further explanation: I know what materials needed for the contract, for Example (Input):
750 of Material 1 250 of Material 2 500 of Material 4 50 of Material 5
I know the delivery Costs and material costs of each supplier. Delivery costs are only paid once for each supplier. I want to get the best solution to order the materials (cheapest).
Output should be a list like: Ammount - Product of supplier - Supplier
Example:
Material 1
1 x 500Q,P40 from Supplier 1 2 x 125Q,P12 from Supplier 3
Material 2
1 x 250Q,P60 from Supplier 3
....