[Fwd: Ceil in minimize function -- invalid type error (mod file in attachment)]
Andrew Makhorin <[email protected]>
| Newsgroups | gmane.comp.gnu.glpk |
|---|---|
| Message-ID | <1484723963.5681.0.camel@corvax> |
-------- Forwarded Message -------- From: Piotr Kwas <[email protected]> To: [email protected] 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 _______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
supp.mod
(video/mpeg, 1.5 KB) - not displayed