x21=0 , x22=0, x23=1 x24=0

And so on (I have attached my matrix figure)

def _build_problem(self): ''' builds the problem from provided data, i.e. adds constraints, defines obj func. etc. ''' if self.modelBuild: return self.modelBuild = True x = {} for i in self.taskList: x[i] = {} for k in self.workstationList: x[i][k] = LpVariable('x_'+i+','+k, 0, 1, LpBinary) t = LpVariable('T', None, None, LpContinuous) # add obj function self.__iadd__(t) #add task assignment constraint for i in self.taskList: taskAssignment = lpSum(x[i][k] for k in self.workstationList) self.__iadd__(taskAssignment==1) #add cycle time constraints for k in self.workstationList: cycleTimeC = lpSum(self.taskTime[i]*x[i][k] for i in self.taskList) self.__iadd__(t>=cycleTimeC) #add precedence constraints for i in self.taskList: if i in self.pred: for h in self.pred[i]: for k in self.workstationList: precedenceC = lpSum(x[h][str(j)] for j in range(1,int(k)+1)) precedenceC = precedenceC - x[i][k] self.__iadd__(precedenceC>=0)