Here is my code, thank you: Proc optmodel; Set bus={"1","2","3","4","5","6","7","8","9","10","11","12"}; /*bus available*/ Set dep={"C","BS","LT","HS","HX","KTX","TL","NT","HP","TĐ","TL","TN"}; /*departure*/ Number cap{bus}=[45 45 45 45 45 45 45 45 29 29 29 29]; /*bus seats*/ Number dem{dep}=[19 1 50 86 28 116 17 8 31 8 15 4]; /*passengers per route*/ Number cost{bus, dep}=[30 43 32 42 11 38 40 42 35 19 30 38 /*cost of each route when assigned to 45-seat bus*/ 30 43 32 42 11 38 40 42 35 19 30 38 30 43 32 42 11 38 40 42 35 19 30 38 30 43 32 42 11 38 40 42 35 19 30 38 30 43 32 42 11 38 40 42 35 19 30 38 30 43 32 42 11 38 40 42 35 19 30 38 30 43 32 42 11 38 40 42 35 19 30 38 30 43 32 42 11 38 40 42 35 19 30 38 20 29 21 28 7 25 27 28 23 13 20 25 /*cost of each route when assigned to 29-seat bus*/ 20 29 21 28 7 25 27 28 23 13 20 25 20 29 21 28 7 25 27 28 23 13 20 25 20 29 21 28 7 25 27 28 23 13 20 25]; Var x{I in bus, j in dep}>=0; /*passengers on bus i for route j*/ Var y{I in bus, j in dep} binary; /*y=1 if bus i is chosen for route j*/ Min totalcost=sum{i in bus,j in dep}cost[I,j]*Y[i,j]; /*problem is here*/ Constraint demsum{j in dep}:sum{I in bus}X[I,j]>=dem[j]; Constraint caplimit{I in bus}:sum{j in dep}X[I,j]<=cap[I]; constraint nolink{i in bus, j in dep}:X[i,j]-cap[i]*Y[i,j]<=0; Solve; Print X; Print Y;
... View more