I want to do some simple calculation like
0/6=0,1/6 = 0, 2/6=0, 3/6=0, 4/6=0, 5/6=0,
6/6=1,7/6=1,8/6=1,9/6=1, 10/6=1, 11/6=1,
12/6=2,...
In MATLAB there is a floor function which can do this.
floor(3.5) = 3.
Does anyone how to do that in GAMS?
Round down to the next integer

 User
 Posts: 10
 Joined: 5 months ago
 Location: Rosario  Argentina
Re: Round down to the next integer
Hi,
you can use the same command, this function is valid only for DNLP models
floor(x) returns the greatest integer number less than or equal to x
best regards
you can use the same command, this function is valid only for DNLP models
floor(x) returns the greatest integer number less than or equal to x
best regards

 User
 Posts: 63
 Joined: 4 months ago
Re: Round down to the next integer
Thanks. How about round up to the nearest integer.
For example, 1/6=1, 7/6=2...
I am not going to do that on variables, so it will still be linear.
For example, 1/6=1, 7/6=2...
I am not going to do that on variables, so it will still be linear.

 User
 Posts: 10
 Joined: 5 months ago
 Location: Rosario  Argentina
Re: Round down to the next integer
ceil(x) returns the smallest integer number greater than or equal to x.
Bye
Bye
Who is online
Users browsing this forum: No registered users and 1 guest