help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] [Fwd: Ceil in minimize function -- invalid type error (mod f


From: Andrew Makhorin
Subject: [Help-glpk] [Fwd: Ceil in minimize function -- invalid type error (mod file in attachment)]
Date: Wed, 18 Jan 2017 10:19:23 +0300

-------- Forwarded Message --------
From: Piotr Kwas <address@hidden>
To: address@hidden
Subject: Ceil in minimize function -- invalid type error (mod file in
attachment)
Date: Wed, 18 Jan 2017 00:47:04 +0100

Hello,
It's my first time here, so please forgive me my mistakes.


I'm using stand-alone solver, version 4.54. Running by 
glpsol -m supp.mod
In attachment the whole file with model and data.


I'm trying to solve problem to pick suppliers for articles with minimum
global order value. 
Each article can be bought from different suppliers with different
price. When supplier don't have some article - the price is set to -1,
but there is constraint s.t. CorrectSupplier, which blocked order that
article from that supplier.
Each supplier have some maximum value (we can't order from him more than
the value).
Till here I have done it, and it works OK by the goal function:

minimize goal: sum{a in Art,s in Supp} OrdQty[a,s] * Prices[a,s];




The problem I have when I'm trying to add a delivery cost.
Delivery cost is defined by article package quantity (for example from
supplier X delivery cost for article A is 3$ for each 10 peaces). When I
define package quantity for each article (same for all suppliers), and
when I define delivery cost for each article package for each supplier
(different for each supplier), I have problem with calculating the goal
function.


When I define it like:

minimize goal: sum{a in Art,s in Supp} ((OrdQty[a,s] * Prices[a,s]) +
(ceil(OrdQty[a,s]/ArtPackQty[a])*DeliveryCost[a,s]);



the solver gives me error:
supp.mod:18: argument for ceil has invalid type
Context: ...[ a , s ] ) + ( ceil ( OrdQty [ a , s ] / ArtPackQty [ a ] )
MathProg model processing error


I'm not sure, if I can use function (ceil) with my var (OrdQty), but I
don't know, how to calculate it in another way.
I'd be very greatful for any help.


Piotr



Attachment: supp.mod
Description: MPEG movie


reply via email to

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