[Help-glpk] [Fwd: conditional assignment in glpk]

2017-01-18 Thread Andrew Makhorin
 Forwarded Message 
From: Ahmed Abdelkhalek 
To: help-glpk@gnu.org
Subject: conditional assignment in glpk
Date: Wed, 18 Jan 2017 13:59:05 -0500

Hi,

 

I see that we have conditional expressions in glpk but what about
conditional assignment?

 

For example, suppose I have 8 binary variables y1 up to y8 whose values
depend on another 8 binary variables x1 up to x8.

So if x1...x8 = 10010010 then y1...y8 can be one of {00110011,
0100110110, 01100110}.

Can we model this conditional assignment using the conditional
expressions?

Thanks,

Ahmed





___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] Patch for pseudocost branching with product score

2017-01-18 Thread Chris Matrakidis
Hi Andrew,

> At first I'd like to finish the dual simplex routines (including your
> patch from May 2016), and then inspect and implement your improvements
> related to the mip solver.

This patch is orthogonal to any changes in the simplex solver, and
shouldn't affect the default behaviour. So, if you are worried that it
will be hard to evaluate the changes to the simplex solver between the
releases, I think it is safe.


> BTW, how did you implement bfd_copy? I missed that.

I'm re-sending the relevant patch, which adds a copy operation in each
factorisation driver and the bfd_copy function that uses them. The
copy operations reuse existing allocations in the destination when
possible.


Best Regards,

Chris Matrakidis


pcost2.patch
Description: Binary data
___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] Patch for pseudocost branching with product score

2017-01-18 Thread Andrew Makhorin
Hi Chris,

> This patch adds the option to select the branching variable using
> pseudocosts with product score, as described in Tobias Achterberg's
> thesis [1]. This is selected with a new br_tech option (GLP_BR_PMH)
> and a new option in glpsol (--pcostmul), so the old default behaviour
> is preserved. The patch also updates the manual accordingly.
> 
> The patch is on top of the three initial patches I sent for
> speeding-up pseudocost initialisation, but should apply even without
> them.

Thank you very much for your contribution.

I think to make no changes in the mip solver at least in a next release.
At first I'd like to finish the dual simplex routines (including your
patch from May 2016), and then inspect and implement your improvements
related to the mip solver.

BTW, how did you implement bfd_copy? I missed that.

Best regards,

Andrew Makhorin


___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] TLS example

2017-01-18 Thread Andrew Makhorin
Hi Heinrich,

> 
> I suggest to rename
>   examples/tls
> to
>   examples/multithreading.
> 
> This will make it more obvious what can be found here.
> 

I renamed examples/tls to examples/threads (by analogy to "threads.h"
header which is standard in C11).


Andrew Makhorin


___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] [Fwd: Ceil in minimize function -- invalid type error (mod file in attachment)]

2017-01-18 Thread Andrew Makhorin
> 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.
> 

In constraints you cannot use variables as arguments to ceil function,
because this leads to non-linear constraints not allowed by glpk.

There are two ways to model fixed costs:

1. Use approximate delivery cost, i.e. use just y rather than ceil(y).
   If y is expected to be quite large in the optimal solution, the
   approximation error will be insignificant.

2. Introduce auxiliary *integer* variables. For example,

  z >= y;

   allows modeling z = ceil(y), where z >= 0 is an auxiliary integer
   variable (assuming that you minimize the overall delivery cost).



___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk