Hello!

I am still trying to solve a problem based on Minimum Cost Flow Problem.

In short, there are four suppliers (L1,L2,L3 and L4), supplier L1 has 2 products (PN1 and PN2), the other one has only one product PN3. For each supplier the product can either go through packaging plant and then to production plant or be directly transported to plant from supplier. The decision which way the product goes is based on transportation (TrCosts) and packaging costs (CrossDock or Repack) as well as on capacity restriction for direct supply arc. It means that direct supply is only allowed when product volume from supplier is big enough. It means that model in the first step model checks whether direct supply costs are lower than transportation costs through packaging plant. If the answer is "yes" then model checks whether supplier sends enough volume to satisfy minimum capacity restriction.

Problem looks the foolowing way:

declarations**!Sets**

PartNumber: set of string

nArc: integer

Node: set of string

Arc: set of integer

**!Parameters **

Origin: array (Arc) of string

Destination: array (Arc) of string

Demand: array (Node,PartNumber) of real

CrossDockCosts: array (Arc,PartNumber) of real

TrCosts: array (Arc,PartNumber) of real

Repack: array (Arc,PartNumber) of real

MinCap: array (Arc) of real !minimum capasity restiction on each arc

**!Decision variables**

flow: array (Arc,PartNumber) of mpvar !flow on each arc

end-declarations

forall(a in Arc, p in PartNumber) create(flow(a,p))

assert(sum(j in Node, p in PartNumber) Demand(j,p)=0) !check whether supply equals demand

**!Flow conservation constraint**

forall(j in Node, p in PartNumber)

ctrFlow(j,p):=sum(a in Arc | Origin(a)=j)flow(a,p)-sum(a in Arc | Destination(a)=j)flow(a,p)=Demand(j,p)

**!Minimum capacity constraint**

forall(a in Arc)

sum(p in PartNumber)flow(a,p)>=MinCap(a)

There are two problems with capacity constraint:

1. When transportation costs through packaging plant are lower than direct supply costs, everything (for example 80 cbm) should be sent through packaging plant. However model decides to sent 50 through direct arc and 30 through packaging plant. So I guess capacity constraint here is binding.

2. When direct supply costs are smaller than transportation through packaging plant, however supplier has less volume than allowed for direct supply, everything should be sent through packagiing plant. However, instead model is infeasible.

Could you please tell me what am I doing wrong? I amnew by Xpress.

Your minimum capacity constraints do not allow arcs to remain unused since they always enforce the minimum value. I assume that what you really want to state is "if this arc is used, then apply the minimum capacity limit". There are various ways of stating this, for example by using semi-continuous variables representing the total arc flow:

declarations

arcflow: array(Arc) of mpvar

end-declarations

!Minimum capacity constraint

forall(a in Arc) do

arcflow(a) is_semcont MinCap(a)

sum(p in Parts)flow(a,p)=arcflow(a)

end-do

Another remark: in your model extract above you use "create" on the flow variables, but the array is not defined as explicitly "dynamic": I would assume that you really only want to create arcs that have an associated cost? In which case you should work with a dynamic array and apply the corresponding condition(s) to the creation of these varaibles.