Re: Linear optimization in SAS/IML

The key to this problem is understanding that the variables in your program need to be expressed as vectors, even though you are thinking of them as matrices,

Let's use a smaller matrix as an example. Instead of 3x30, consider a 3x4 matrix of probabilities called P. Then the binary solution vector X contains nrow(P)*ncol(P) elements. To make X into a vector, string out the elements of X rowwise, so that the first row comes first, then the second, then the third.

There are two linear constraints, the row constraints and the column constraints. The row constraints say that the sum of the i_th row of X is less than a specified b_i. The column constraints say that there is only one 1 in each column.

The following program solves a 3x4 example. I don't have time to explain it all, so study the MILP blog post and carefully study how I constructed the constraint matrices for rows and columns. If I wrote the program well and didn't make any errors, you should only need to input your probability matrix for P and specify the values of the B1 vector.

At the end of the program, the solution vector is reshaped into a matrix, for easy interpretation.

Re: Linear optimization in SAS/IML

The key to this problem is understanding that the variables in your program need to be expressed as vectors, even though you are thinking of them as matrices,

Let's use a smaller matrix as an example. Instead of 3x30, consider a 3x4 matrix of probabilities called P. Then the binary solution vector X contains nrow(P)*ncol(P) elements. To make X into a vector, string out the elements of X rowwise, so that the first row comes first, then the second, then the third.

There are two linear constraints, the row constraints and the column constraints. The row constraints say that the sum of the i_th row of X is less than a specified b_i. The column constraints say that there is only one 1 in each column.

The following program solves a 3x4 example. I don't have time to explain it all, so study the MILP blog post and carefully study how I constructed the constraint matrices for rows and columns. If I wrote the program well and didn't make any errors, you should only need to input your probability matrix for P and specify the values of the B1 vector.

At the end of the program, the solution vector is reshaped into a matrix, for easy interpretation.

Re: Linear optimization in SAS/IML

The documentation for the MILSOLVE call says "For complete functionality the SAS/OR product must also be installed, otherwise the maximum number of variables and maximum number of constraints is restricted to 500."