Problem on parameter

Hello,

I have the following problem; I want to scan a table and if I find a value of less than 1, then all the elements of that collumn to be divided by a very small number.

I have done the following:

Data(j,r)$(Data(j,r)<1)=(Data(,jr))/(1E-5);

but it is not right as only some elements are divided by a very small number and not all the collumn.

Can you please provide me with some feedback?

Best regards,

Kostas


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 Kostas,

You can use a double loop as follows:

scalar flag /0/;

Loop(r,
Loop(j$(flag =0),
flag$(Data(j,r) wrote:

Hello,

I have the following problem; I want to scan a table and if I find a value of less than 1, then all the elements of that collumn to be divided by a very small number.

I have done the following:

Data(j,r)$(Data(j,r)<1)=(Data(,jr))/(1E-5);

but it is not right as only some elements are divided by a very small number and not all the collumn.

Can you please provide me with some feedback?

Best regards,

Kostas


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.


\

PEDRO JAVIER RAMÍREZ TORREALBA
Ingeniero Civil Eléctrico PUC
MSc en Ingeniería Eléctrica PUC
Londres, REINO UNIDO

Celular: +44-(0)75-8069-3119


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 Kostas



You could use the smin function in Gams:



set r /r1r3/, c /c1c3/;



parameter tbl(r,c);



tbl(r,c) = uniform(0,10);



display tbl;



alias(r,ar);



tbl(r,c)$(smin(ar,tbl(ar,c)) < 1) = tbl(r,c)*1E-5;



display tbl;



with the following output:



---- 9 PARAMETER tbl



c1 c2 c3



r1 1.717 8.433 5.504

r2 3.011 2.922 2.241

r3 3.498 8.563 0.671





---- 16 PARAMETER tbl



c1 c2 c3



r1 1.717 8.433 5.503754E-5

r2 3.011 2.922 2.240529E-5

r3 3.498 8.563 6.711372E-6



Cheers



Renger






\


Modelworks

Gewerbestrasse 15

3600 Thun – Switzerland

+41 79 818 53 73

Info@modelworks.ch

blog.modelworks.ch







From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of ???sta?t??? ?et??d??
Sent: Monday, November 24, 2014 22:05
To: gamsworld@googlegroups.com
Subject: Problem on parameter



Hello,



I have the following problem; I want to scan a table and if I find a value of less than 1, then all the elements of that collumn to be divided by a very small number.



I have done the following:



Data(j,r)$(Data(j,r)<1)=(Data(,jr))/(1E-5);



but it is not right as only some elements are divided by a very small number and not all the collumn.



Can you please provide me with some feedback?



Best regards,



Kostas


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.

Dear Renger and Pedro,

thank you for your very helpful responses.

Best regards,

Kostas

Τη Δευτέρα, 24 Νοεμβρίου 2014 9:04:34 μ.μ. UTC, ο χρήστης Κωνσταντίνος Πετρίδης έγραψε:

Hello,

I have the following problem; I want to scan a table and if I find a value of less than 1, then all the elements of that collumn to be divided by a very small number.

I have done the following:

Data(j,r)$(Data(j,r)<1)=(Data(,jr))/(1E-5);

but it is not right as only some elements are divided by a very small number and not all the collumn.

Can you please provide me with some feedback?

Best regards,

Kostas


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.