i want to mix a different fertilizers available in the market to create a new fertilizer WITH MY DESIRED AMOUNT OF NPK(Nitrogen, Phosphate, Potassium)...

i can do that in so many ways but i want to get the mixture with cheapest cost.

here is an example,

------------------N-P-K Numbers------------COST(Peso)
Fertilizer 1-----(24-2-8)---------------------100/bag
Fertilizer 2-----(20-20-20) ------------------50/bag
Fertilizer 3 -----(10-0-0)---------------------75/bag
Fertilizer 4----- (10-20-30)------------------20/bag


i want to mix some, if not all fertilizers with these NPK values with the cheapest price

INPUT--------------------(Desired NPK Mixture)
Nitrogen = 40
Phosphate = 30
Potassium = 50


OUTPUT-------------------
____________________Percentage per Bag--------COST
Fertilizer 1---------------____-----------------------____
Fertilizer 2---------------____-----------------------____
Fertilizer 3---------------____-----------------------____
Fertilizer 4---------------____-----------------------____

------------------------------------ TOTAL COST = ____

I want to know how many amount of each fertilizer per bag is to be added in my mixture in order for come up with the NPK values above, and with the least Cost...


Please help...you dont have to code it, i just need the concept of it....thank you for reading...

God Rocks!!!! ______\m/__________

Recommended Answers

All 8 Replies

Whew! That is going to be a tough no matter how you look at it and as I look at it more it just may be impossible with the numbers you have given...

Lets take the four different mixtures to begin with and for arguements sake, they are all bags of equal weight.

Bag #1 24% Nitrogen, 2% Phosphate, 8% Potassium leaving 66% Filler
Bag #2 20% N, 20% P, 20% K, 40% Filler
Bag #3 10% N, 00% P, 00% K, 90% Filler
Bag #4 10% N, 20% P, 30% K, 40% Filler

and you want to get a mixture of
40% N, 30% P, 50% K, -20% Filler

The numbers just don't add up

Unless I am looking at this all wrong, I don't see a way this can be solved. I hope someone can come along with a different viewpoint or perhaps you could set me strait...

Good Luck

it doesn't have to arrive at the exact values that you want the the mixture to arrive at desired NPK values...the closest NPK result values to that NPK desired values can do, or may be a plus 5% or minus 5% of the NPK values... i think that should/could be tolerable.

thanks for taking the time to look at it though...
good luck!
coachD

Whew! That is going to be a tough no matter how you look at it and as I look at it more it just may be impossible with the numbers you have given...

Lets take the four different mixtures to begin with and for arguements sake, they are all bags of equal weight.

Bag #1 24% Nitrogen, 2% Phosphate, 8% Potassium leaving 66% Filler
Bag #2 20% N, 20% P, 20% K, 40% Filler
Bag #3 10% N, 00% P, 00% K, 90% Filler
Bag #4 10% N, 20% P, 30% K, 40% Filler

and you want to get a mixture of
40% N, 30% P, 50% K, -20% Filler

The numbers just don't add up

Unless I am looking at this all wrong, I don't see a way this can be solved. I hope someone can come along with a different viewpoint or perhaps you could set me strait...

Good Luck

sorry, my bad!
I inputted an impossible NPK values for a fertilizer mixture..

How should i address you, Sir or Madam?

I just wanted to arrive at the desired NPK values for my new fertilizer mixture using the given set of fertilizers, with the least cost.....

:-)

Enter new values that perhaps make sense and perhaps we can help you.

Sir BTW.

Good Luck

OK, let say
I want to have N = 50, P = 15, K = 15..

the output mixture could have
N = + or - 5% of 50
P = + or - 5% of 15
K = + or - 5% of 15

so, a possible output is
N = 55
P = 14
K = 17
I think this should be as good as the inputted value above

Okay, four approaches to solve your problem...

50,15,15 + 5% 52.5 (53), 16, 16 - 5% 47.5 (47), 14, 14

Fertilizer 1-----(24-2-8)---------------------100/bag
Fertilizer 2-----(20-20-20) ------------------50/bag
Fertilizer 3 -----(10-0-0)---------------------75/bag
Fertilizer 4----- (10-20-30)------------------20/bag

Start with cheapest price
(20/bag) X
(50/bag) X
(75/bag) OK (x5=50/0/0=not quite)
(100/bag) OK (x2=48/4/16=2/3 close)

Bags 1 and 2 disQ'ed because intiial mixtures 2 & 3 too high
Bag 3 does good for 1st but not 2 & 3
Bag 4 comes close 2 of 3 fall into requirements

(BTW 5% of 50 is 2.5 not 5)

Next method is opposite of above starting at most expensive

After that methods are by mixture.

Select highest quantity and figure out (like from cheapest) what it would take to fall in between +/- values starting at highest value of ingredient per bag, then test next highest to see if it is within and if not then back out 1 of what you used to come to your acceptable value for ingredient 1. Now pick highest value for two and add.... and so on until all three or best of 2 out of 3 works.

Last is reverse of above.

Good Luck

OK, thanks!

i'll try to figure out your suggested solutions to my problem.

i'll be trying to go back to my thread as soon as possible..

thanks again,
coachD

GOD rocks! __\m/__

what you need is linear programing it can be done with MS Excel using Solver, or you can download a trial version from my site.
the fertilizers are named as ingredients and the composition NPK as nutrients individualy for each ingredient. or you can search for least cost formulation,this is the link http://www.rationmix.com is in spanish but it can be a good tool for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.