Linear Programming/Simplex Algorithm

Hi,

I’m looking for a way, to solve a linear optimization within ruby. I
already tried this gem:

http://rglpk.rubyforge.org/rglpk/

but wasn’t able to get it to work, because I have Windows and somehow
the gem doesn’t seem to work with the winversion of GLPK (or, more
likely, I’m too dense to get it to work). I “installed” winglpk (its
working, I tested it via command line), but whenever I try to install
the gem, it says, it couldn’t find the GLPK Library Installation. (I
included the error message at the end of the post.)

Could someone help me please, either with the rglpk gem or with another
solution? All I really need is a working simplex algorithm to solve my
LP, all the other stuff GLPK does isn’t relevant for me.

Thanks in advance,

taura


Error Message, when trying to install rglpk:

Building native extensions. This could take a while…
ERROR: Error installing rglpk:
ERROR: Failed to build gem native extension.

C:/Programme/Ruby/bin/ruby.exe extconf.rb
checking for main() in -lglpk… no

ERROR: Cannot find the GLPK library, aborting.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=C:/Programme/Ruby/bin/ruby
–with-glpk-dir
–without-glpk-dir
–with-glpk-include
–without-glpk-include=${glpk-dir}/include
–with-glpk-lib
–without-glpk-lib=${glpk-dir}/lib
–with-glpklib
–without-glpklib

Gem files will remain installed in
C:/Programme/Ruby/lib/ruby/gems/1.8/gems/rglpk-0.1.1 for inspection.
Results logged to
C:/Programme/Ruby/lib/ruby/gems/1.8/gems/rglpk-0.1.1/ext/gem_make.out


Contents of mkmf.log:
have_library: checking for main() in -lglpk… -------------------- no

"gcc -o conftest -I. -IC:/Programme/Ruby/lib/ruby/1.8/i386-mingw32 -I.
-g -O2 -DFD_SETSIZE=256 conftest.c -L. -LC:/Programme/Ruby/lib -L.
-lmsvcrt-ruby18-static -lglpk -lshell32 -lws2_32 "
c:\Programme\Ruby\devkit\gcc\3.4.5\bin…\lib\gcc\mingw32\3.4.5…\mingw32\bin\ld.exe:
cannot find -lglpk
collect2: ld returned 1 exit status
checked program was:
/* begin /
1: #include <ws2tcpip.h>
2: #include <winsock2.h>
3: #include <windows.h>
4:
5: /top/
6: int main() { return 0; }
7: int t() { void ((volatile p)()); p = (void (()()))main; return 0; }
/
end */

"gcc -o conftest -I. -IC:/Programme/Ruby/lib/ruby/1.8/i386-mingw32 -I.
-g -O2 -DFD_SETSIZE=256 conftest.c -L. -LC:/Programme/Ruby/lib -L.
-lmsvcrt-ruby18-static -lglpk -lshell32 -lws2_32 "
c:\Programme\Ruby\devkit\gcc\3.4.5\bin…\lib\gcc\mingw32\3.4.5…\mingw32\bin\ld.exe:
cannot find -lglpk
collect2: ld returned 1 exit status
checked program was:
/* begin /
1: /top/
2: int main() { return 0; }
3: int t() { main(); return 0; }
/
end */


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs