## Round variable up to the next whole number (integer)

Problems with modeling
keatzaii
User
Posts: 11
Joined: 1 year ago

### Round variable up to the next whole number (integer)

Hi,

My variable is the number of plant (i.e. 3.2 plants) and I would like to round it up to the next integer (i.e. 4 plants). This is to calculate the capital cost (number of plant x capital cost per plant) as we cannot build 3.2 plants.

At the same time, this variable need to keep as decimal point for the next equation that calculate the operating cost (number of plant x capacity per plant x operating cost per capacity) as some plant can run without in full capacity.

Hope someone can help.

Many thanks,
Jun Keat

abhosekar
Moderator
Posts: 14
Joined: 3 weeks ago

### Re: Round variable up to the next whole number (integer)

If the number of plants is in the objective function and the problem structure naturally favors minimizing it, you can define an integer variable p and add a constraint p =g= number_of_plants;
This way, if the number of plants is 3.2, p will be 4; if the number of plants is 3, p will be 3.

keatzaii
User
Posts: 11
Joined: 1 year ago

### Re: Round variable up to the next whole number (integer)

Thanks for your solution. I'm really appreciate it.