z = Array[Subscript[y, ##] &, {3, 2}]
f = {2, 5, 1}
z*f
Total[Flatten[ z*f]]
Minimize[{Total[Flatten[ z*f]],
Total[z] == 10 && NonNegative[Min[z]]}, z, Integers]
The above code works for one-dimensional matrix z, But when z is two-dimensional, this error occurs:
Minimize::ivar: {Subscript[y, 1,1],Subscript[y, 1,2]} is not a valid variable. >>
Anyone have any idea why this happens?
Thanks