Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Algorithm to find best price combination when ordering product

I have a product A at 200$ with some supplier X That same A product at 210$ with another supplier Y

I have product B at 100$ with supplier X and 150$ with supplier Y.

I need to order both A and B product.

Supplier X needs a minimum order amount of 100$ to do the delivery. Supplier Y needs a minimum order amount of 140$ to do the delivery.

In real case there is much more products and much more suppliers to take into account.

Some suppliers may not have the product we need (but there always be at least 1 supplier that does have it).

Considering the above problem, what kind of algorithm/combination of algorithms can solve it ? I'm not asking for an answer directly but instead a line of thought.

Thanks!!

like image 258
jav974 Avatar asked Sep 19 '25 03:09

jav974


1 Answers

You need to look into Linear Optimization algorithms. On most cases they are easy to implement. You need

Z function to optimize ~ This is the target function which value you want to either minimize or maximize. It is usually related to total cost (minimize), risk (minimize), resources wasted (minimize), profit (maximize), etc. In you case, it can be to minimize the overall cost.

Variables ~ This are the values that must be changed. In your case that would be Xij (Amount of items of product i ordered from provider j)

Restrictions ~ This help to define an answer for the Z function. In your case that would be putting into a formula the amount of each product that you need, and the minimum purchase needed by the vendors.

like image 97
Said Montiel Avatar answered Sep 20 '25 20:09

Said Montiel