GAMS Support Wiki

Site Tools

gams:model_permutations

Differences

This shows you the differences between two versions of the page.

 gams:model_permutations [2007/08/10 11:04]127.0.0.1 external edit gams:model_permutations [2020/05/20 12:02] (current)Frederik Fiand 2020/05/20 12:02 Frederik Fiand 2007/08/10 11:04 external edit 2020/05/20 12:02 Frederik Fiand 2007/08/10 11:04 external edit Line 1: Line 1: ====== Modeling permutations ====== ====== Modeling permutations ====== + Q: //How can I model a vector of integer variables x(i) that can assume values 1,​2,​...,​card(i),​ and each x(i)  should be different, i.e. ''​x(i) <> x(j) for all i <> j''​ ?// - How can I model in GAMS the following restriction?​ A vector of integer variables x(i) can assume values 1,​2,​...,​card(i),​ and each x(i)  should be different, i.e. + This looks like we need the help of a permutation matrix ​''​P=p(i,​j)''​, - + - x(i) <> x(j) for all i <> j + - + - This looks like we need the help of a permutation matrix P=pij, + where there is exactly one 1 in each row and column, and the other where there is exactly one 1 in each row and column, and the other elements are zero. The identity matrix is a trivial example of a elements are zero. The identity matrix is a trivial example of a