bug-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-glpk] expression following = has invalid type


From: Andrew Makhorin
Subject: Re: [Bug-glpk] expression following = has invalid type
Date: Sun, 11 Jun 2017 09:22:51 +0300

On Sun, 2017-06-11 at 04:41 +0200, Ahmed Shahein wrote:
> Dear Madam/Sir,
> 
> 
> I have tried to compile the attached AMPL model using the GLPK solver
> however, it gave me the following error message:
> 
> 
> GLPSOL: GLPK LP/MIP Solver, v4.55
> Parameter(s) specified in the command line:
>  --model fir.mod
> Reading model section from fir.mod...
> fir.mod:20: expression following = has invalid type
> Context:  0 ] + sum { k in 1 .. n - 1 } 2 * r [ k ] * cos ( k * o ) ;
> MathProg model processing error
> 
> 
> 
> 
> 
> When I posted the code at the AMPL forum I received a reply that they
> managed to compile the code using another solver.
> 
> 
> The AMPL fourms link is:
> https://groups.google.com/forum/#!topic/ampl/1HpbT3Rfi1U
> 
> 
> Is this a bug, or a limited feature? 

The latter. Not all AMPL features are implemented in GNU MathProg.

> Do you have any suggestion(s) to overcome this issue?

You may replace the statement

var R {o in OMEGA} = r[0] + sum{k in 1..n-1} 2*r[k]*cos(k*o);

which is incorrect in MathProg, with the following ones:

var R {o in OMEGA};
s.t. foo{o in OMEGA}: R[o] = r[0] + sum{k in 1..n-1} 2*r[k]*cos(k*o);

> 
> 
> Thanks in advance.
> 
> 
> Regards.
> 
> 
> Ahmed.
> 
> 
> -- 
> Ahmed Shahein
> 
> HW Design Engineer
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]