Round down to the next integer

Problems with syntax of GAMS
yanzhiping
User
User
Posts: 85
Joined: 8 months ago

Round down to the next integer

Postby yanzhiping » 8 months ago

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?

Manassaldi
User
User
Posts: 44
Joined: 9 months ago
Location: Rosario - Argentina

Re: Round down to the next integer

Postby Manassaldi » 8 months ago

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

yanzhiping
User
User
Posts: 85
Joined: 8 months ago

Re: Round down to the next integer

Postby yanzhiping » 8 months ago

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.

Manassaldi
User
User
Posts: 44
Joined: 9 months ago
Location: Rosario - Argentina

Re: Round down to the next integer

Postby Manassaldi » 8 months ago

ceil(x) returns the smallest integer number greater than or equal to x.
Bye


Who is online

Users browsing this forum: No registered users and 1 guest