Reputation: 105
I have a GAMS model where I have
Set i / 1*6 /;
Alias (i,ip,il) ;
Variables
x(i,ip) ;
And I want to generate equations which operates on the scalar products of all vectors in x, excluding the product of the same vector. Something like:
scalarProduct(i)..
sum(ip,x(i,ip)x(i,il)) =e= someConstant;
However this does not exclude the product of identical vectors. How to add this? Can I do it with a dollar statement somehow? There's probably a few bugs in that statement anyway, I didn't try it because I think the exclusion I want is missing.
Upvotes: 1
Views: 414
Reputation: 105
so what I wanted to do is this:
Sets
i / 1*13 /
ii(i,i) diagonal elements / #i:#i /
ij(i,i) all elements / #i.#i /
ij_wo_ii(i,i);
get all combinations without the diagonal elements:
ij_wo_ii(i,j) = ij(i,j) - ii(i,j);
and then I use it in an equation like this:
equation(j,k)..
sum(i,x(i,j)*x(i,k)$ij_wo_ii(j,k)) =l= 1;
This does something similar to orthogonality, except that the product of vectors in a matrix must be smaller than some value and not necessarily 0. don't know if there is a term for this. Hope it will be of use to someone else as well.
Upvotes: 1