linear programming

Librairie C++ de calcul formel/ C++ symbolic computation library

Modérateur : xcasadmin

parisse
Messages : 5112
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: linear programming

Message par parisse » mer. nov. 22, 2017 9:23 am

Then RAND_MAX is the same as INT_MAX, it's the largest value that you can get with int rand(), i.e. the largest signed integer.
About abi compatibility, I'm using an old debian with gcc 4 to build the deb packages, that explains the problem. Thanks for the explanation, it might be useful for other people trying to link with giac.

parisse
Messages : 5112
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: linear programming

Message par parisse » mer. nov. 22, 2017 6:31 pm

I made a change in lpsolve.cc/.h, HAVE_GLPK -> HAVE_LIBGLPK
(autoconf creates by default this define if glpk is detected).

lukamar
Messages : 296
Inscription : ven. juin 30, 2017 9:55 am
Localisation : Zagreb, Croatia

Re: linear programming

Message par lukamar » jeu. nov. 23, 2017 1:22 pm

Thanks, I've mirrored your changes. I also fixed one small bug, lp_maximize=true and lp_verbose=true were not recognized as valid options, only lp_maximize and lp_verbose (without "=true"). Now both alternatives work as expected.
lpsolve.h hasn't actually changed, so you may leave the current version of that file.
Pièces jointes
lpsolve-fix7.zip
(17.95 Kio) Téléchargé 97 fois

parisse
Messages : 5112
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: linear programming

Message par parisse » jeu. nov. 23, 2017 7:19 pm

I had to update lpsolve.h, because there are new defines. I also had to replace INT_MAX by RAND_MAX. Then it compiles!

lukamar
Messages : 296
Inscription : ven. juin 30, 2017 9:55 am
Localisation : Zagreb, Croatia

Re: linear programming

Message par lukamar » jeu. nov. 23, 2017 11:17 pm

I've deleted a confusing comment paragraph starting on line 254, it originated from an intermediate version of the code...
Pièces jointes
lpsolve-fix8.zip
(15.49 Kio) Téléchargé 102 fois

parisse
Messages : 5112
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: linear programming

Message par parisse » ven. nov. 24, 2017 8:57 am

DBL_MAX is not defined when compiling with emscripten, I have added at the beginning of lpsolve.cc:

Code : Tout sélectionner

#ifndef DBL_MAX
#define DBL_MAX 1.79769313486e+308
#endif

parisse
Messages : 5112
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: linear programming

Message par parisse » ven. nov. 24, 2017 9:42 am

I have updated the web version, it should contain GLPK code (since numeric is well supported by emscripten, I think it is worth having it in the web version). Let me know if it's ok.

lukamar
Messages : 296
Inscription : ven. juin 30, 2017 9:55 am
Localisation : Zagreb, Croatia

Re: linear programming

Message par lukamar » ven. nov. 24, 2017 1:33 pm

Thank you. In my Firefox, lpsolve performs well and fast :)

lukamar
Messages : 296
Inscription : ven. juin 30, 2017 9:55 am
Localisation : Zagreb, Croatia

Re: linear programming

Message par lukamar » ven. déc. 01, 2017 1:37 am

lpsolve works in Xcas FLTK GUI as well, but messages and progress reports are not printed for some reason... In the code I was using cout to output the messages, and they do show up in Firefox interface.

parisse
Messages : 5112
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: linear programming

Message par parisse » ven. déc. 01, 2017 6:31 am

If you replace cout/cerr by *logptr(contextptr) you will get the output in green in xcas native, otherwise the output is written to the terminal that has launched xcas.

lukamar
Messages : 296
Inscription : ven. juin 30, 2017 9:55 am
Localisation : Zagreb, Croatia

Re: linear programming

Message par lukamar » ven. déc. 01, 2017 9:37 am

Thanks, I've updated the code accordingly, only one line had to be changed in lp_problem::message routine.
Pièces jointes
lpsolve-fix9.zip
(17.46 Kio) Téléchargé 104 fois

lukamar
Messages : 296
Inscription : ven. juin 30, 2017 9:55 am
Localisation : Zagreb, Croatia

Re: linear programming

Message par lukamar » sam. déc. 09, 2017 12:09 am

The latest version of Giac/Xcas contains up-to-date version of the code, but the documentation entry is still referring to the old version. Could you please update it? I've sent you the TeX file in message from November 20 (on the previous page).
Thanks!

parisse
Messages : 5112
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: linear programming

Message par parisse » sam. déc. 09, 2017 3:08 pm

Indeed, I missed it, it will be in the next update.

lukamar
Messages : 296
Inscription : ven. juin 30, 2017 9:55 am
Localisation : Zagreb, Croatia

Re: linear programming

Message par lukamar » lun. janv. 22, 2018 3:42 pm

I have a small update for lpsolve, now "maximize" can be used instead of "lp_maximize", since the keyword exists in Giac. Also, list of symbolic variables gathered from the input problem is now sorted, so the output is more readable (now we have x,y,z,... instead of, e.g. z,x,y,.. and the order in which variables appear in the input expressions does not affect the output of the solution). Finally, a result from lpsolve is now a vector with subtype list, like in the solve command (the new command nlpsolve in optimization.cc follows the same principle).
Documentation is also slightly altered to mention "maximize" as an alias for "lp_maximize".
Pièces jointes
lpsolve-fix10.zip
(25.11 Kio) Téléchargé 97 fois

parisse
Messages : 5112
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: linear programming

Message par parisse » mar. janv. 23, 2018 9:51 am

I made a few changes in order to compile with clang: add in lpsolve.cc #include "optimization.h" for at_maximize, and in optimization.cc replaced 5 times delete by delete [] for arrays allocated with new.

Répondre