You should check the dimensions of both your 'f' vector and your 'Aeq' matrix. Both of these values are multiplied with the vector to optimize, 'x', and accordingly, the dimensions must allow proper matrix multiplication.
First, check the length of 'f'
As you know, the length of 'f' dictates the number of variables to optimize in vector 'x'. As a result, we need to make sure that the dimensions of 'Aeq' make sense too:
The value of 'm' gives use the number of rows in 'Aeq' which tells us how many equality constraint equations that we are enforcing on this linear program. Conversely, 'n' tells use the number of columns in 'Aeq' which indicates the size of 'x'. As a result, the number of columns of 'Aeq' and the length of 'f' must be equivalent (which is the error message that you're receiving).
Two potential corrections:
- If 'm' equals the length of 'f', you may have transposed your 'Aeq' matrix. You could fix this by transposing your Aeq matrix (Aeq = Aeq').
- Your equations might not be consistent, and you should write them out to ensure your equations make sense.
Hope this helps!