Originally posted by: SystemAdmin
[ArushGadkar said:]
Hello all,
I have the following problem and would appreciate any suggestions on it.
I have a a variable matrix A[5][2] declared as an IloNumVarArray and a variable vector say U[5]. What i want to do is this:
Lets say for example A= [1 0]
[1 0]
[0 1]
[0 1]
[1 0]
then for every column of A I want to perform the following procedure:
add the index to a vector S (C++) if the value is 1. i.e in the first step it will take the first column of A and add to S the numbers 1,2,5 (since it is 1 at that position)
The procedure( some function) will add constraints to the model (for example in the form U1 + U2 <=100, U5 <30... so on)<br />
then it takes the second column and i want to add 3, 4 to S and repeat the procedure.
I am having difficulties adding these indices to S.
I tried the following pseudocode
for(all j = 1 to 2)
{
for(all i= 1 to 5)
{if(A[i][j] = = 1)
S.push_back(i)
}
call procedure to add constraints.
}
this wont work as it says cannot use if to IloNumVar.
Could you help me out with this problem. your help is greatly appreciated.
Thanks
Arush
#CPLEXOptimizers#DecisionOptimization