Forum Discussion
FICO
5 years agoCommunity Manager
Hi, I am in the process of developing a simple optimization model for a supply chain. Two of the constraints relate to suppliers and the kitting facility.
The two constraints are:
1) Only one kitting facility can be chosen
2) Only one (or a variable number) of suppliers of one ingredient needs to be chosen.
Why don't the constraints expressed on line 57-64 and line 69 achieve my goal of the two constraints above?
When I output the result, I can get zeros for all kfs which conflict with line 69.
Output:
Supplier to Kitting Facility Solutions:
Supplier 1 to Kitting Facility 1 = 0
Supplier 1 to Kitting Facility 2 = 0
Supplier 2 to Kitting Facility 1 = 0
Supplier 2 to Kitting Facility 2 = 0
Supplier 3 to Kitting Facility 1 = 0
Supplier 3 to Kitting Facility 2 = 0
Supplier 4 to Kitting Facility 1 = 0
Supplier 4 to Kitting Facility 2 = 0
Supplier 5 to Kitting Facility 1 = 0
Supplier 5 to Kitting Facility 2 = 0
Supplier 6 to Kitting Facility 1 = 0
Supplier 6 to Kitting Facility 2 = 0
Supplier 7 to Kitting Facility 1 = 0
Supplier 7 to Kitting Facility 2 = 0
Supplier 8 to Kitting Facility 1 = 0
Supplier 8 to Kitting Facility 2 = 0
Supplier 9 to Kitting Facility 1 = 0
Supplier 9 to Kitting Facility 2 = 0
Supplier 10 to Kitting Facility 1 = 0
Supplier 10 to Kitting Facility 2 = 0
Note that the dat file with the code is attached. It contains no proprietary information.
Please let me know if anything needs any further clarification.
Thank you in advance,
Kibrom
27 Replies
- FICOCommunity Manager
Hi Kibrom,
thanks for your question. Could you please double check that you uploaded the correct model? It only seems to contain 40 lines with all constraints commented out?
- FICOCommunity Manager
Thanks for letting me know.
I mistakenly uploaded the wrong file last night.
- FICOCommunity Manager
I have now uploaded the correct file
- FICOCommunity Manager
Hi Kibrom,
the problem seems to be that you set n and m in lines 54 and 55 outside your for loop over all factories, which leads to no "supplier constraints" being generated for the second facility, which is why that one gets chosen in the end without any suppliers for it. If I move those inside the for loop, the solution changes to the first facility with suppliers getting chosen.
- FICOCommunity Manager
Hi Tristan,
Thank you for your response. A classmate of one recognized the error in the logic and it is working fine now. Replacing kf(k) with 1 on the right-hand side of the constraint in the loop solved the issue.
- FICOCommunity Manager
Is there a way for me to check this post as resolved?
- FICOCommunity Manager
I think it should be possible for you to accept an answer.
- FICOCommunity Manager
Further to the previous answer, it would also be possible to simplify the loop defining these constraints as follows:
forall(k in Potential_kf) do m:=0 forall(j in Ingredients) sum(i in test_Supplier_sites(j), m as counter) supplier_kf(m,k)= kf(k) end-door possibly this form that uses the actual data values from the test_Supplier_sites list as index values:
forall(k in Potential_kf) do forall(j in Ingredients) sum(i in test_Supplier_sites(j)) supplier_kf(i,k)= kf(k) end-do - FICOCommunity Manager
Hi Kibrom,
and as another suggestion, after further looking into this problem, it might be helpful in this case to replace the quadratic equality constraint by the two corresponding inequalities and replace mmxnlp by mmnl, since then it will trigger a presolve reduction that gets rid of the non-convexities so that it can be solved by our MIP solver (that particular reduction is currently not applied for equalities, but we will look into extending it).
- FICOCommunity Manager
Hi Tristan,
Are you referring to line 73?
forall(j in Copackers) sum(i in Potential_kf) kf_copacker(i,j)*kf(i) = 1...
I ended up replacing the line with
forall(i in Potential_kf) sum(j in Copackers) kf_copacker(i,j) = getsize(Copackers)*kf(i)Are you making the suggestion to replace the quadratic inequality statement to decrease the computational time?

