Warehouse location

From: Jesper Hansen <jesperh_at_skydebanen.net>
Date: Fri 03 Jan 2003 05:23:23 PM GMT
Message-ID: <3E15C70B.7060304@skydebanen.net>
Hi eclipsers

I made this small warehouse location model based on the CLP one in the 
ECLiPSe example section (I snipped the cost matrix). I tried to solve it 
with the XRESS version included in 5.5, but it aborts with too many B&B 
nodes. If the commented out constraint is readded it takes 0.2 sec. I 
also tried another formulation where the xij =< yj are aggregated, which 
is a weaker formulation shown below the ***** line. It solves the 
problem in less than 0.1 sec!
Does anyone have any idea why this is? I haven't access to CPLEX. 
Perhaps someone could try to see if it is an XPRESS problem?

Thanks

Jesper

:- lib(ic).
:- lib(ic_eplex_cplex).
:- eplex_instance(eplex).

solve(SupplyMatrix, BuiltWarehouses, Cost) :-
       lp_set(result_channel, +output),
       lp_set(log_channel, +log_output),

    % get the data
    setup_cost(SetupCost),
        get_capacity(WareHouseCapacity),
    supply_cost_matrix(SupplyCostMatrix),
    dim(SupplyCostMatrix, [NCustomers, NWareHouses]),
   
    % model
        length(BuiltWarehouses,NWareHouses),
        BuiltWarehouses :: 0..1,
        eplex: (integers(BuiltWarehouses)),
        dim(SupplyMatrix, [NCustomers, NWareHouses]),
        SupplyMatrix[1..NCustomers,1..NWareHouses] :: 0..1,
%        eplex: (sum(BuiltWarehouses) >= NCustomers//WareHouseCapacity+1),
        (
            for(CustomerId, 1, NCustomers),
            foreach(CustCost, CustCosts),
            param(BuiltWarehouses,SupplyCostMatrix,NWareHouses,SupplyMatrix)
        do
            SupplyVars is SupplyMatrix[CustomerId, 1..NWareHouses],
            eplex: (sum(SupplyVars) =:= 1),
            eplex: (integers(SupplyVars)),
            CostTable is SupplyCostMatrix[CustomerId, 1..NWareHouses],
            (
                foreach(BW,BuiltWarehouses),
                foreach(SV,SupplyVars),
                foreach(SC,CostTable),
                foreach(CC,CustCost)
            do
                CC = SV*SC,
                eplex: (SV =< BW)
            )
        ),
        (
            for(WareHouseID,1,NWareHouses),
            param(SupplyMatrix,NCustomers,WareHouseCapacity) do
                SupplyVars is SupplyMatrix[1..NCustomers, WareHouseID],
                eplex: (sum(SupplyVars) =< WareHouseCapacity)
        ),
    % objective
       flatten(CustCosts,CCosts),
    Objective = sum(BuiltWarehouses)*SetupCost + sum(CCosts),

    % search
        optimize(min(Objective),Cost).

setup_cost(50000).

get_capacity(2).

****************************************

  (
            for(CustomerId, 1, NCustomers),
            foreach(CustCost, CustCosts),
            param(SupplyCostMatrix,NWareHouses,SupplyMatrix)
        do
            SupplyVars is SupplyMatrix[CustomerId, 1..NWareHouses],
            eplex: (sum(SupplyVars) =:= 1),
%            eplex: (integers(SupplyVars)),
            CostTable is SupplyCostMatrix[CustomerId, 1..NWareHouses],
            (
                foreach(SV,SupplyVars),
                foreach(SC,CostTable),
                foreach(CC,CustCost)
            do
                CC = SV*SC
            )
        ),
        (
            for(WareHouseID,1,NWareHouses),
            foreach(BW,BuiltWarehouses),
            param(SupplyMatrix,NCustomers,WareHouseCapacity) do
                SupplyVars is SupplyMatrix[1..NCustomers, WareHouseID],
                eplex: (sum(SupplyVars) =< WareHouseCapacity*BW)
        ),

-- 
_______________________________________
Jesper Hansen         
Ph.D. student         
Telephone: (+45) 45 25 33 88 
Telefax.:  (+45) 45 25 26 73
E-mail: mailto:jha@imm.dtu.dk 
Homepage: http://www.imm.dtu.dk/~jha/
Department of Mathematical Modelling 
Building 305                      
Technical University of Denmark
DK-2800 Lyngby
Received on Fri Jan 03 16:28:14 2003

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:20 PM GMT GMT