Using Optimization Variables as index of another optimization variable

Dear all,
I am currently trying to replicate the MILP described in
  1. A. S. Manne, «On the job-shop scheduling problem,» Operations Research 8, n° %12, pp. 219-223, 1960.
To schedule n jobs on m machin in a job-shop by minimizing Cmax
To achieve this I have defined several optimization variables as follow :
optim_X = optimvar('optim_X',i,m,...
'LowerBound',0); %Integer variable >=0 / starting date of job j on machine j
optim_sigma_h = optimvar('optim_sigma_h',j,i,...
'Type','integer','LowerBound',1,'UpperBound',i); %Integer Variable >=1 / i^th operation of job j
One of my constraints is
for j = J
for h=2:m
cont_1(nb_const(ii))= optim_X(optim_sigma_h(h,j),j)>=...
optim_X(optim_sigma_h(h-1,j),j)+p(optim_sigma_h(h-1,j));
nb_const(ii)=nb_const(ii)+1;
end
end
As you can see I am using an optimization variable as an index of another optimization variable (line 3). It seems that Matlab is not liking it because I have the following error :
%Error using MILP (line 53)
%Array indices must either be real positive
%integers, logicals, character arrays, or
%strings.
I have tried to remove the index's part with the variable and the error dissapear...
Do any of you know how to solve this issue ?
I have added my complete code if it is of any help..
Thanks a lot for all the help you can provide
PS: this is my first answer in our cumminity
be kind pls :-)

Answers (0)

Asked:

on 21 Nov 2020

Edited:

on 21 Nov 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!