STACK - packages simplex and to_poly_solve

STACK - packages simplex and to_poly_solve

by Markus Smole -
Number of replies: 9

Hi,

I want to load the packages simplex and to_poly_solve. However, I get an error:

FAILED

The following package is not supported: simplex

Any idea where to start to solve this error?


Average of ratings: -
In reply to Markus Smole

Re: STACK - packages simplex and to_poly_solve

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Markus,

I know this looks odd, but a number of 3rd party providers have asked me to confirm that to the best of my knowledge the libraries we import only have very restricted read/write access to the server file system.  For this reason, the master branch of the code base will always have some restrictions on the libraries stack "supports", and this will be on the basis of a list of "allowed" libraries.

I'm really not trying to be difficult.  It is your business what you do on your server, of course!  If you want to change this you can edit this line:

https://github.com/maths/moodle-qtype_stack/blob/master/stack/cas/installhelper.class.php#L34

In the next version of STACK, I'm very likely to load to_poly_solver myself by default anyway.  It has lots of useful stuff.

If you find other things you want, I'm very happy to review them.  I'll often add them to the master branch, but note that some maxima libraries are very slow to load and other cause namespace clashes with functions, or alter the behaviour of functions.  They do need careful review, especially if we add them to master.

Chris


In reply to Christopher Sangwin

Re: STACK - packages simplex and to_poly_solve

by Markus Smole -

Chris,

thank you for this hack. The simplex - package gets loaded by default (using the settings of the STACK - questiontype, checked by the CAS - testing script). But if I try to use a command, I get this error: 

Unsupported keyword: maximize_lp.

My code:

zf:x+y;
u1:x>=0;
u2:y>=0;
u3:3*x+2*y<=12;
u4:3*x+8*y<24;
NB:[u1,u2,u3,u4];
tans:maximize_lp(zf,NB);

Is it necessary to load the simplex.mac using the stackmaxima - file?

Thank you!

Markus


In reply to Christopher Sangwin

Re: STACK - packages simplex and to_poly_solve

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Markus,

I've added more comprehensive documentation on how to add support for packages, rather then just loading them on an ad-hoc basis.

https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/Developer/Maxima_packages.md

This line is why your question doesn't work

https://github.com/maths/moodle-qtype_stack/blob/master/stack/cas/casstring.class.php#L216

The reason for this is explained in the docs.

Colleagues here (Edinburgh) were asking about simplex, so I've created a branch here.

https://github.com/maths/moodle-qtype_stack/tree/simplex

Note, that loading this package does cause a performance reduction in Maxima.  Not catastrophic, but I did notice about a 10% increase in the time taken by the unit tests.

Chris

In reply to Christopher Sangwin

Re: STACK - packages simplex and to_poly_solve

by Markus Smole -

Chris,

unfortunately, after spending some hours of troubleshooting it does not work... What I have done:

... Changed the two files on the server
... Reinstalled the qtype_stack_simplex - Plugin (Administration -> Plugin -> ZIP - File)

The result:

It does not complain about maximize_lp, but this command does not get evaluated

I know:

... We are using the Maxima - version 5.37.2 which is buggy (we are waiting for the server migration ...)

... There is an error in the Test script:

Maxima 5.37.2 http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.12
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) define: warning: redefining the built-in function intervalp
define: warning: redefining the built-in function texnumformat
Compiling /tmp/gazonk_13910_0.lsp.
End of Pass 1.  
End of Pass 2.  
loadfile: failed to load /usr/share/maxima/5.37.2/share/draw/draw.lisp
 -- an error. To debug this try: debugmode(true);

... checked, if this command is working in the shell - maxima (OK)

Thank you for your assistance!

Markus


Attachment maxima_lp_not_eval.png
In reply to Markus Smole

Re: STACK - packages simplex and to_poly_solve

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Argh, yes

loadfile: failed to load /usr/share/maxima/5.37.2/share/draw/draw.lisp
indicates that your version of Maxima doesn't have the draw packages compiled in.  This is called by "distributive".

In the "Load optional Maxima libraries" (qtype_stack | maximalibraries) on the stack settings page, you should only have "simplex". 

The fact some distributions do or don't have these packages is why we added in (qtype_stack | maximalibraries) so individual packages can be loaded on a server by server basis.  Now simplex is on this list, users shouldn't need to mess about with the code, but you do need to figure out which packages are actually available to you.

I've checked with only the simplex package loaded, and the commands above execute.


In reply to Christopher Sangwin

Re: STACK - packages simplex and to_poly_solve

by Markus Smole -

Thank you, simplex is working know!

Markus

In reply to Markus Smole

Re: STACK - packages simplex and to_poly_solve

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Just as a followup, simplex is now supported in the core of STACK.  It will make its way into the next official release (in time for Jan teaching), and is in the "master" branch.

Chris

In reply to Markus Smole

Re: STACK - packages simplex and to_poly_solve

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Argh, yes

loadfile: failed to load /usr/share/maxima/5.37.2/share/draw/draw.lisp
indicates that your version of Maxima doesn't have the draw packages compiled in.  This is called by "distributive".

In the "Load optional Maxima libraries" (qtype_stack | maximalibraries) on the stack settings page, you should only have "simplex". 

The fact some distributions do or don't have these packages is why we added in (qtype_stack | maximalibraries) so individual packages can be loaded on a server by server basis.  Now simplex is on this list, users shouldn't need to mess about with the code, but you do need to figure out which packages are actually available to you.

I've checked with only the simplex package loaded, and the commands above execute.