I am new to Julia and JuMP, and I am learning to solve SOCP with integer constraint.
The only example I can find online shows I should add the constraint in the following way.
@constraint(m, norm(2x[i] - i for i=1:n if c[i] == 1) <= 1)
Is there a way to call
norm function with out a looping of iterator with in it ? For example, in my problem, a segment of code would be
for t in 1:n for i in 0:t for j in ( t + 1 ):( n + 1 ) # add socp constraint here @constraint( model , dd[ k , i , j , t , 1 ] == sqrt( generationCostA( k , t ) ) * x[ k , i , j , t ] ) @constraint( model , dd[ k , i , j , t , 2 ] == 0.5 * ( d[ k , i , j , t ] - y[ k , i , j ] ) ) @constraint( model , norm( dd[ k , i , j , t , kk ] for kk in 1:2 ) <= 0.5 * ( y[ k , i , j ] + d[ k , i , j , t ] ) ) end end end
the vector within
norm function has dimension 2. I tried to use
norm([ x , y ]) , but it does not work. So I have to create dummy variables
dd , and then I can use iterator within
Can I do it without introduce the dummy variables? Thanks for your time of reading, and much appreciated if you can help me on this!