Geometric means implementation

I need to implements a geometric mean for each row in a matrix

I used the following code:

n(j) =e= sum(i, x(i,j)); //calculate the number of active links at each row
prod((i,j), x(i,j))=g= 0; //discard the zeros at the product
rpower (prod(i, C(i,j)*x(i,j)), 1/n(j)) //implements the geometric mean

X(i,j) is a binary variable, that represents one link in a graph
C(i,j) is a matrix with a cost values

the error that appears is division by zero.

someone could help me?


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Hi
Just raise the geometry mean on the lhs and the power expression to the power n.
Geommean**n =e= prod (i, c (i, j)*x (i,j));
Cheers
Renger



Sent from my Samsung Note 4


-------- Original message --------
From: Carlos Andrés Lozano Garzón
Date: 10/28/2015 06:42 (GMT+01:00)
To: gamsworld
Subject: Geometric means implementation

I need to implements a geometric mean for each row in a matrix

I used the following code:

n(j) =e= sum(i, x(i,j)); //calculate the number of active links at each row
prod((i,j), x(i,j))=g= 0; //discard the zeros at the product
rpower (prod(i, C(i,j)*x(i,j)), 1/n(j)) //implements the geometric mean

X(i,j) is a binary variable, that represents one link in a graph
C(i,j) is a matrix with a cost values

the error that appears is division by zero.

someone could help me?


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.