Integer programming bi-indexed variables.
Many integer programming programs as the following needed for Kemeny ranking
minimiser∑i,j∈Aωi,jxi,j+ωj,ixj,isous les contraintesxi,j+xj,i=1,∀i≠jxi,j+xj,k+xk,i≥1,∀i≠j≠k≠i
I want to construct a function wich takes the vector or the list ω and return the solution. But to construct such a function iot will be safer for me not to be obliged to assign on variable with a index to all two indexed variables.
Is there a way ? My problem is in the enumeration of the constraints for high indexes.
Why not represent ω as a dict, where tuples (i,j) are mapped to the corresponding values? Or did I misunderstand your question?
You probably understand my question better than I. But I do not know how to do. A second possibility would be to create the matrices of zero and one associated with the constraints. But I do not know (even if I have a little idea how to construct them).
Can you give a specific toy example of what you want to achieve?
Hello, @Cyrille! What I understand that you want to achieve is to create a Sage function that will receive the constants ω and return the corresponding solution to the MILP you wrote above. Am I correct? What I didn't understand was the final part of your question where you talk about two-index variables. Could you clarify that? Perhaps I can help you with this problem.