Thank you Rob, As the rest of ,my program has a slightly different structure, I get the following invalid array message now. 4610 /* Assign[p,b] = 1, if product p is assigned to bin b */; 4611 var Assign {j in JOBS, TECHS_j[j]} binary; 4612 4613 /* UseBin[b] = 1, if bin b is used */ 4614 var UseBin {TECHS} binary; 4615 4616 /* minimize number of bins used */ 4617 min Objective = sum {t in TECHS} UseBin[t]; 4618 4619 /* assign each product to exactly one bin */ 4620 con Assignment {j in JOBS}: 4621 sum {t in TECHS_j[j]} Assign[j,t] = 1; 4622 4626 4627 /* Capacity constraint on each bin (and definition of UseBin) */ 4628 con Capacity {t in TECHS}: 4629 sum {j in JOBS} length[j] * Assign[j,t] <= binsize * UseBin[t]; 4630 4631 /* decompose by bin (subproblem is a knapsack problem) */ 4632 for {t in TECHS} Capacity[t].block = t; 4633 4634 /* solve using decomp (aggregate formulation) */ 4635 solve with milp / decomp; NOTE: Problem generation will use 4 threads. ERROR: The array subscript 'Assign[t9qe9c,1]' is invalid at line 4629 column 39. ERROR: The array subscript 'Assign[t9qe9c,2]' is invalid at line 4629 column 39. ERROR: The array subscript 'Assign[t9qe9c,3]' is invalid at line 4629 column 39. ERROR: The array subscript 'Assign[t9qe9c,4]' is invalid at line 4629 column 39. NOTE: Unable to create problem instance due to previous errors. 4636 4637 /* create a map from arbitrary bin number to sequential bin number */ 4638 num binId init 1; 4639 num binMap {TECHS}; 4640 for {t in TECHS: UseBin[t].sol > 0.5} do; 4641 binMap[t] = binId; 4642 binId = binId + 1; 4643 end; 4644 4645 /* create map of product to bin from solution */ 4646 num bin {JOBS}; 4647 for {j in JOBS} do; 4648 for {t in TECHS_j[j]: Assign[j,t].sol > 0.5} do; 4649 bin[j] = binMap[t]; 4650 leave; 4651 end; 4652 end; 4653 4654 /* create solution data */ 4655 create data jobAssignments from [product] bin length skills_required; NOTE: The data set WORK.JOBASSIGNMENTS has 124 observations and 4 variables. 4656 4657 /*print bin length;*/ 4658 quit; Out of the error message, I can see that the mistake lies in line 4629 (the bin capacity constraint). I guess that the '{t in TECHS}' in the previous line causes this. But how do I correctly formulate this?
... View more