Thanks for your time.
I have a linear program and no idea how I could express a form of constraint and even if it's possible. Maybe someone here know a solution.
A company assembly and sells a mixture which is composed of 3 ingredients, a, b and c, with a = b = c.
Each ingredients can come from 2 factories : f1 and f2.
The cost of each ingredients are fluctuating all day and are different between each factories.
Each factory provide the costs for each ingredients in the form of a list of couples : (cost, availableAmount).
The constraint I want to express (without impacting the existing objective function) and I don't know how to it is :
Avoid to choose manufacting costs that are greater that my selling price.
For example at time t, the costs could be :
- for ingredient a :
f1 : (10$, 5.1), (11$, 10.2), (13$, 20.5)
f2 : (11$, 1.), (12$, 15.2), (13$, 6.9)
- for ingredient b :
f1 : (15$, 8.3), (16$, 20.), (18$, 10.7)
f2 : (15$, 4.2), (16$, 15.1), (18$, 19.3)
- for ingredient c :
f1 : (31$, 2.), (34$, 3.5), (37$, 14.9)
f2 : (30$, 4.7), (32$, 9.2), (35$, 12.4)
I would like to get the best repartition for two input constants which are : maximumAllowedQuantity and maximumAllowedCost.
But currently I only handle maximumAllowedQuantity and I would like to also handle maximumAllowedCost (this is the purpose of my question).
The resulting solution composed of amounts for each costs will be in the output variables :
amountAF1_1, amountAF1_2, amountAF1_3
amountAF2_1, amountAF2_2, amountAF2_3
amountBF1_1, amountBF1_2, amountBF1_3
amountBF2_1, amountBF2_2, amountBF2_3
amountCF1_1, amountCF1_2, amountCF1_3
amountCF2_1, amountCF2_2, amountCF2_3
For example using the example data provided, and for the input maximumAllowedQuantity = 15 (without maximumAllowedCost constraint cause I don't know how to formulate it and this is what I ask), based on some objectives of the moment (for example : I prefer to divide equitably the amounts between factories for the same total cost and not favour one factory),
I could get :
amountAF1_1 = 5.1, amountAF1_2 = 4.9, amountAF1_3 = 0.
amountAF2_1 = 0., amountAF2_2 = 5., amountAF2_3 = 0.
amountBF1_1 = 5., amountBF1_2 = 0., amountBF1_3 = 0.
amountBF2_1 = 4.2, amountBF2_2 = 5.8, amountBF2_3 = 0.
amountCF1_1 = 2., amountCF1_2 = 3.5, amountCF1_3 = 2.
amountCF2_1 = 4.7, amountCF2_2 = 2.8, amountCF2_3 = 0.
Which I can summarise cost-wise to :
5.1a at 10$, 4.9a at 11$, 5.0a at 12$,
9.2b at 15$, 5.8b at 16$,
4.7c at 30$, 2.0c at 31$, 2.8c at 32$, 3.5c at 34$, 2.0c at 37$
If we decompose the resulting mixtures by cost we get :
4.7 mixtures at 10 + 15 + 30 = 55$,
0.4 mixtures at 10 + 15 + 31 = 56$,
1.6 mixtures at 11 + 15 + 31 = 57$,
2.5 mixtures at 11 + 15 + 32 = 58$,
0.3 mixtures at 11 + 16 + 32 = 59$,
0.5 mixtures at 11 + 16 + 34 = 61$,
3.0 mixtures at 12 + 16 + 34 = 62$,
2.0 mixtures at 12 + 16 + 37 = 65$,
Here the maximum cost is 65$.
But if my selling price is 60$, in order to avoid loosing money :
How can I add the constraint maximumAllowedCost = 60$ ?
nb : we cannot simply take the previous result (without maximumAllowedCost constraint) and remove the amounts at costs > 60$, cause my objective function will give another repartition for quantities at costs <= 60 if the total quantity is smaller : here 9.5 (15 - 0.5 - 3.0 - 2.0) instead of 15 before.
...
Thanks