Solved

# Capacity constraint in an assignment problem

• 2 replies
• 236 views

• Newcomer
• 0 replies
I have a model that describes the optimal relocations of stock in a situation where the total inventory is sometimes larger than the in-house warehouse capacity. I defined the set 'products' and 'flows' with indices (respectively) i and j. The decision variable(Xij) is the (integer) amount of products to assign to each flow, minimizing the cost involved.

I am currently struggling with implementing one of the constraints: for each i in flow j=3, the value of Xi3 should be some integer (say 0 to 10) times the flowcapacity (=45). After some searching on this forum, I figured I should try adding a parameter Flowcapacity(j), make Flowcapacity(3)=45 and all other Flowcapacity(j=/=3)=0. Then, in the constraint, include an if statement: "if Flowcapacity(j)>0 then X(ij)=Flowcapacity(j)*{0,1,2,3,4,5,6,7,8,9,10}".

The program seems to accept the reference to the parameter, but not the subset of integers (which was a long shot). How should I formulate this constraint?
icon

Best answer by mohansx 27 July 2019, 01:34

View original

### 2 replies

Userlevel 5 +2
@StudentWouter

Create another variable IV with range as integers {0..10}.

Now modify your original constraint as

if Flowcapacity(j) >0 then X(ij) = FlowCapacity(j) * IV endif

IV will take one of the integer values as you want.
Userlevel 6 +6
Hi @StudentWouter just checking if this worked for you, or maybe you found another way? Please let us know how it worked out in case others have a similar problem. Thanks!