[Scip] ZIMPL: error when accessing variable in function
Jan Vaillant
jv at zalf.de
Wed Sep 17 11:48:11 CEST 2014
Dear Matthias,
thank you. Good to know. Anyway, this is not a big limitation. I worked around
it and I find ZIMPL very useful!
Yes, you are right the example wasn't correct.
Bye,
Jan
> Matthias Miltenberger <miltenberger at zib.de> hat am 16. September 2014 um 11:56
> geschrieben:
>
>
> Dear Jan,
>
> unfortunately, there is an error in the documentation. Sorry about that.
> You cannot use variables in functions.
> Also, the return value in your example is a variable although defnumb
> specifies the return type to be a number.
>
> All the best
> Matthias
>
> On 09/05/14 10:24, Jan Vaillant wrote:
> > Dear list,
> >
> > I try to access a variable from within a function definition but get a 800
> > error
> > (unexpected VARSYM). Page 14 (4.7) in the ZIMPL documentation states "The
> > arguments of a function can only be numbers or strings, but within the
> > function
> > definition it is possible to access all otherwise declared sets, parameters
> > and
> > variables." Am I misunderstanding something?
> >
> > Thank you
> > Jan
> >
> > example:
> >
> > set A := { 1, 2 };
> > param a_data[A] := <1> "a", <2> "b";
> > var a_vars[A];
> > defnumb func1(x) := a_data[x];
> > do print func1(1);
> > defnumb func2(x) := a_vars[x];
> >
> > output:
> >
> > [jv at localhost PMR]$ scip -f test.zpl
> > SCIP version 3.1.0 [precision: 8 byte] [memory: block] [mode: optimized] [LP
> > solver: SoPlex 2.0.0] [GitHash: 577ee45]
> > Copyright (c) 2002-2014 Konrad-Zuse-Zentrum fuer Informationstechnik Berlin
> > (ZIB)
> >
> > External codes:
> > Readline 6.2 GNU library for command line editing
> >(gnu.org/s/readline)
> > SoPlex 2.0.0 Linear Programming Solver developed at Zuse
> >Institute
> > Berlin (soplex.zib.de) [GitHash: 568f354]
> > cppad-20140000.1 Algorithmic Differentiation of C++ algorithms
> >developed
> > by B. Bell (www.coin-or.org/CppAD)
> > ZLIB 1.2.8 General purpose compression library by J. Gailly and
> >M.
> > Adler (zlib.net)
> > GMP 5.0.2 GNU Multiple Precision Arithmetic Library developed
> >by T.
> > Granlund (gmplib.org)
> > ZIMPL 3.3.2 Zuse Institute Mathematical Programming Language
> > developed by T. Koch (zimpl.zib.de)
> > Ipopt 3.11.9 Interior Point Optimizer developed by A. Waechter
> >et.al.
> > (www.coin-or.org/Ipopt)
> >
> > user parameter file not found - using default parameters
> >
> > read problem
> > ============
> >
> >
> > base directory for ZIMPL parsing: </home/jv/Desktop/PMR>
> >
> > a
> > *** Error 800: File test.zpl Line 6 : syntax error, unexpected VARSYM
> > *** defnumb func2(x) := a_vars[x];
> > *** ^^^
> > Segmentation fault
> >
> > _______________________________________________
> > Scip mailing list
> > Scip at zib.de
> > http://listserv.zib.de/mailman/listinfo/scip
>
> --
> \__________________
>
> Matthias Miltenberger
> Zuse Institute Berlin
> Takustr. 7, 14195 Berlin
> www.zib.de/miltenberger
> miltenberger at zib.de
> +49 (30) 841 85-245
>
>
More information about the Scip
mailing list