[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] [Fwd: No mod or round function available for variables]

From: Jeffrey Kantor
Subject: Re: [Help-glpk] [Fwd: No mod or round function available for variables]
Date: Wed, 6 Mar 2013 12:51:42 -0500

Assuming that x must be an integer, wouldn't 

param maxPallets := 11;
var x integer, <= maxPallets;
s.t. x >= maxPallets/2;

do the job? Having said this, I'm wondering about the overall formulation of this problem. It would seem that you want x to be an integer that is either 0, or greater than 50% of the container capacity. That's an example of a semicontinuous (semi-integer?) variable.  Below is a link to a simple model allocating pallets to containers subject to this type of constraint.


pallet to container model

On Wed, Mar 6, 2013 at 11:26 AM, Andrew Makhorin <address@hidden> wrote:
-------- Forwarded Message --------
From: Guest276 <address@hidden>
To: address@hidden
Subject: [Help-glpk] No mod or round function available for variables
Date: Wed, 6 Mar 2013 07:05:05 -0800 (PST)


I am trying to solve the following problem:
I have an LP with a max objective function and some constraints. It is a
logistical problem. x is my variable that tells me how many pallets I should
ship on a certain route. 11 pallets can go in one 20-foot-container. I want
to add a restriction that forces the minimum number of pallets in a
container to be 6 or that the container should be 50% full.
I tried to do this like that:
(x mod 11)/11 >= 0.5
This did not work, since mod is only available for parameters or numbers but
not for variables.
I tried the following:
x/11 - round(x/11) >= 0.5.
The same problem.

Has anyone an idea how I can model this without using mod or round?

Please help!!
Guest 276
View this message in context:
Sent from the Gnu - GLPK - Help mailing list archive at

Help-glpk mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]