[AMPL 2922] summation notation

View: New views
2 Messages — Rating Filter:   Alert me  

[AMPL 2922] summation notation

by Gulay Samatli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi all,
I wanna ask how many index can be used in one sum operator?
I have a sum operator with 4 indices and AMPL gives an error message indicating the 4th one. However, I can't see any error.
The original formulation is as follows:
VarPort - sum{i in 1..Stocks} weight[i]^2 * Q[i]- sum{i in 1..Stocks,j in 1..Stocks, f in 1..numberFactors, k in 1..numberFactors}
weight[i]*weight[j]*betas[i,f]* F[f,k]*betas[j,k]  = 0;


And the error message is:
Var.mod, line 102 (offset 3604):
        syntax error
context:  VarPort - sum{i in 1..Stocks} weight[i]^2 * Q[i]- sum{i in 1..Stocks, j in 1..Stocks, f in 1..numberFactors, k  >>> in  <<< 1..numberFactors}
weight[i]*weight[j]*betas[i,f]* F[f,k]*betas[j,k]  = 0;


Could you please help me,
Thanks a lot.

Gulay




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to ampl@...
To unsubscribe from this group, send email to ampl+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---


[AMPL 2923] Re: summation notation

by pietro belotti :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


If that is a constraint, does k appear anywhere else in that
constraint? Otherwise, is k already defined as a parameter somewhere
else?

Cheers,
Pietro

On Tue, Oct 27, 2009 at 11:30 AM, Gulay Samatli <gs89@...> wrote:

>
> Hi all,
> I wanna ask how many index can be used in one sum operator?
> I have a sum operator with 4 indices and AMPL gives an error message indicating the 4th one. However, I can't see any error.
> The original formulation is as follows:
> VarPort - sum{i in 1..Stocks} weight[i]^2 * Q[i]- sum{i in 1..Stocks,j in 1..Stocks, f in 1..numberFactors, k in 1..numberFactors}
> weight[i]*weight[j]*betas[i,f]* F[f,k]*betas[j,k]  = 0;
>
>
> And the error message is:
> Var.mod, line 102 (offset 3604):
>        syntax error
> context:  VarPort - sum{i in 1..Stocks} weight[i]^2 * Q[i]- sum{i in 1..Stocks, j in 1..Stocks, f in 1..numberFactors, k  >>> in  <<< 1..numberFactors}
> weight[i]*weight[j]*betas[i,f]* F[f,k]*betas[j,k]  = 0;
>
>
> Could you please help me,
> Thanks a lot.
>
> Gulay
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to ampl@...
To unsubscribe from this group, send email to ampl+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---