Solved

# Transportation-Distribution problem of paints - Constraint Set

• 2 replies
• 115 views

• Explorer
Hey,

I have this Transportation-Distribution problem of paints and it says that in the 10th day the stock of paint of each color and each type has to be 1000L.

I created a constraint:

FinalStockConstraint
Index domain: (d,c,t) 'd - day; c - color; t - type'
Definition: sum[ds,DistributionSiteStock(ds,d,c,t)] + sum [p,ProductionSiteStock(p,d,c,t)] = 1000

Which means the sum of every paint (color and type) of all distribution sites + sum of every paint (color and type) of all productions sites has to 1000. But I just want this to apply to the 10th day. How should I do it only with linear maths?

You can store both in productions sites and distribution sites. ds - distribution sites; p - production sites
icon

Best answer by mohansx 11 October 2019, 00:33

You want this stock only on the 10th day, so you can enforce that using index domain conditions.

If you update the constraint as below, this will be applied only when d=10, and for all c and t. Note that '10' depends on how the days are specified in your set of day. My example code assumes that you have it as {'1', '2', '3', ... '10'}. If you have it as {'d-1', 'd-2', ..'d-10'}, then you should use (d,c,t)|d = 'd-10'

code:
`FinalStockConstraintIndex domain: (d,c,t)|d='10'Definition: sum[ds,DistributionSiteStock(ds,d,c,t)] + sum [p,ProductionSiteStock(p,d,c,t)] = 1000`

Hope this helps
View original

### 2 replies

Userlevel 5
+2

You want this stock only on the 10th day, so you can enforce that using index domain conditions.

If you update the constraint as below, this will be applied only when d=10, and for all c and t. Note that '10' depends on how the days are specified in your set of day. My example code assumes that you have it as {'1', '2', '3', ... '10'}. If you have it as {'d-1', 'd-2', ..'d-10'}, then you should use (d,c,t)|d = 'd-10'

code:
`FinalStockConstraintIndex domain: (d,c,t)|d='10'Definition: sum[ds,DistributionSiteStock(ds,d,c,t)] + sum [p,ProductionSiteStock(p,d,c,t)] = 1000`

Hope this helps
Thank you very much Mohan, it helped me!