Integer programming bi-indexed variables.

asked 4 years ago

Cyrille gravatar image

updated 4 years ago

Many integer programming programs as the following needed for Kemeny ranking

minimiseri,jAωi,jxi,j+ωj,ixj,isous les contraintesxi,j+xj,i=1,ijxi,j+xj,k+xk,i1,ijki

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.

Preview: (hide)

Comments

Why not represent ω as a dict, where tuples (i,j) are mapped to the corresponding values? Or did I misunderstand your question?

Max Alekseyev gravatar imageMax Alekseyev ( 4 years ago )

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).

Cyrille gravatar imageCyrille ( 4 years ago )

Can you give a specific toy example of what you want to achieve?

Max Alekseyev gravatar imageMax Alekseyev ( 4 years ago )

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.

dsejas gravatar imagedsejas ( 4 years ago )