MILP: how to work a for loop into a constraint
6 views (last 30 days)
Show older comments
I am trying to add a Constraint to my optimization (linear programming), that ensures, that a resource only works on one task at every given time (it's logical, that a resource/human cannot work on two screwing jobs at the same time).
My optimization variable is a boolean 3D array x[task, resource, time] which is 1 if at the time a task is started by the resource; 0 otherwise.
Time is considered in seconds of unit 1.
processing_time(task, ress) is a matrix with the indivudal times a ressource needs for every job there is.
I managed to build the for loops, that should be help up, but how do I combine it with/into a constraint for my optimization?
Explanation of the loops: I am looking at every processing time window for the jobs and and the sum over them are not allowed to be higher than 1 (so in the time window (processing time) of a task there is only the one (1) start of this one given task in the 3D array).
Mainly the "sum <= 1" is my Constraint.
So how do I get this to work in my optimization problem?
for ress = 1:nR
for time = 1:nPT
for task = 1:nT
if (time-processing_time(task,ress) >0)
sum (x(task,ress,(time-processing_time(task,ress)):time)<=1)
end
end
end
end
Thanks ahead!
0 Comments
Answers (0)
See Also
Categories
Find more on Surrogate Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!