Hi ,
I've been stuck on what may be a very simple problem with syntax. Would appreciate any help on the following:
Now, I'm trying to solve a linear optimisation homework problem So I have this matrix of decision variables:
x = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}
What I'm trying to do is add constraints:
That all X(i,j) are integers between 0 and 5
That the sum of the first column is less than 50
The sum of the 3rd row is exactly 30
The diagonals X(i,i) are all zero.
My problem is that I just can't figure out how to use indexing and iterations to apply these constraints in the Minimize function.
I tried using Thread, apply, Forall, but nothign seems to work.
What woud be ideal is if I can do something like this:
X(i,j) < some condition> where i=1,2,... n
If I can figure out how to do this, then i think I'll be able to proceed.