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.

Jeff

pallet to container
model<https://www3.nd.edu/~jeff/mathprog/mathprog.html?model=%0Aparam%20maxPallets%20%3A%3D%2011%3B%0Aparam%20maxContainers%20%3A%3D%2010%3B%0A%0Aparam%20nPallets%20%3A%3D%2035%3B%0A%0Aset%20CONTAINERS%20%3A%3D%201..maxContainers%3B%0Avar%20x%7BCONTAINERS%7D%20integer%2C%20%3E%3D%200%3B%0Avar%20b%7BCONTAINERS%7D%20binary%3B%0A%0As.t.%20A%3A%20sum%7Bc%20in%20CONTAINERS%7Dx%5Bc%5D%20%3D%20nPallets%3B%0As.t.%20B%20%7Bc%20in%20CONTAINERS%7D%3A%20x%5Bc%5D%20%3C%3D%20maxPallets*b%5Bc%5D%3B%0As.t.%20C%20%7Bc%20in%20CONTAINERS%7D%3A%20x%5Bc%5D%20%3E%3D%200.5*maxPallets*b%5Bc%5D%3B%0A%0Aminimize%20nContainers%3A%20sum%7Bc%20in%20CONTAINERS%7D%20b%5Bc%5D*c%3B%0A%0Asolve%3B%0Aend%3B%0A>




On Wed, Mar 6, 2013 at 11:26 AM, Andrew Makhorin <[email protected]> wrote:

> -------- Forwarded Message --------
> From: Guest276 <[email protected]>
> To: [email protected]
> Subject: [Help-glpk] No mod or round function available for variables
> Date: Wed, 6 Mar 2013 07:05:05 -0800 (PST)
>
> Hi,
>
> 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:
> http://old.nabble.com/No-mod-or-round-function-available-for-variables-tp35143735p35143735.html
> Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.
>
>
>
>
>
> _______________________________________________
> Help-glpk mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/help-glpk
>
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to