Hi Andrew,
There are a couple of ways to make this work. The first is to construct x
such that it is indexed by the tuples (1,2) and (3,4):
@defVar(m, x[con_values] >= 0)
@addConstraint(m, t == sum{param[i,j]*x[(i,j)], (i,j)=con_values})
The second is to unpack the tuples and construct x indexed
Also note that by placing @defVar in a loop, you are overwriting the Julia
variable x in every pass through the loop. New variables will be added to
the JuMP model with every call to @defVar, but the only one accessible to
the user will be the last one created (in this case, x[3,4]). I can't see
This is exactly what I was looking for:
> @defVar(m, x[con_values] >= 0)
> @addConstraint(m, t == sum{param[i,j]*x[(i,j)], (i,j)=con_values})
>
>
Also good to know about overwriting variables and where to direct future
questions.
Thanks Joey!
and thank you Andrew for using JuMP!
On Saturday, May 10, 2014 1:40:22 PM UTC-4, Andrew B. Martin wrote:
>
> This is exactly what I was looking for:
>
>
>> @defVar(m, x[con_values] >= 0)
>> @addConstraint(m, t == sum{param[i,j]*x[(i,j)], (i,j)=con_values})
>>
>>
> Also good to know about overwri