[Lemon-user] Problem with GLPK
Alpar Juttner
alpar at cs.elte.hu
Fri Sep 30 08:22:29 CEST 2016
Hi,
LEMON itself does not provide an LP/MIP solver just an interface
existing third party solvers. It's GLPK in your case. Thus,
1. you must have GLPK installed on your system
2. you must link it together with your code:
g++ -lglpk lp_demo.cc
In addition, using LEMON, it is of crucial importance to turn on
compiler optimization, whenever running time matters(*). So, you are
better of compiling with
g++ -O3 -lglpk lp_demo.cc
Regards,
Alpar
(*) In fact, it is true for everything written in C++, especially if it uses STL.
On Fri, 2016-09-30 at 05:14 +0000, Kaveh Azizian (Dr) wrote:
> Hi,
> I have installed lemon and I could compile and run hello_world
> sample, which means Lemon installed correctly. However, when I wan to
> compile lp and MIP examples I encounter with the following error:
>
> kaveh at kaveh-K501UX:/media/kaveh/DATA/lemon-1.3.1$ g++ lp_demo.cc
> /tmp/ccd0qUUn.o: In function `main':
> lp_demo.cc:(.text+0x26): undefined reference to
> `lemon::GlpkLp::GlpkLp()'
> /tmp/ccd0qUUn.o: In function `lemon::LpBase::Constr::lowerBounded()
> const':
> lp_demo.cc:(.text._ZNK5lemon6LpBase6Constr12lowerBoundedEv[_ZNK5lemon
> 6LpBase6Constr12lowerBoundedEv]+0x19): undefined reference to
> `lemon::LpBase::INF'
> /tmp/ccd0qUUn.o: In function `lemon::LpBase::Constr::upperBounded()
> const':
> lp_demo.cc:(.text._ZNK5lemon6LpBase6Constr12upperBoundedEv[_ZNK5lemon
> 6LpBase6Constr12upperBoundedEv]+0x19): undefined reference to
> `lemon::LpBase::INF'
> /tmp/ccd0qUUn.o: In function
> `lemon::LpBase::addRow(lemon::LpBase::Constr const&)':
> lp_demo.cc:(.text._ZN5lemon6LpBase6addRowERKNS0_6ConstrE[_ZN5lemon6Lp
> Base6addRowERKNS0_6ConstrE]+0xd4): undefined reference to
> `lemon::LpBase::INF'
> lp_demo.cc:(.text._ZN5lemon6LpBase6addRowERKNS0_6ConstrE[_ZN5lemon6Lp
> Base6addRowERKNS0_6ConstrE]+0x1b7): undefined reference to
> `lemon::LpBase::INF'
> /tmp/ccd0qUUn.o: In function `lemon::operator<=(lemon::LpBase::Expr
> const&, lemon::LpBase::Expr const&)':
> lp_demo.cc:(.text._ZN5lemonleERKNS_6LpBase4ExprES3_[_ZN5lemonleERKNS_
> 6LpBase4ExprES3_]+0x27): undefined reference to `lemon::LpBase::NaN'
> /tmp/ccd0qUUn.o: In function `lemon::operator<=(double const&,
> lemon::LpBase::Expr const&)':
> lp_demo.cc:(.text._ZN5lemonleERKdRKNS_6LpBase4ExprE[_ZN5lemonleERKdRK
> NS_6LpBase4ExprE]+0x17): undefined reference to `lemon::LpBase::NaN'
> /tmp/ccd0qUUn.o: In function `lemon::GlpkLp::~GlpkLp()':
> lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0xe):
> undefined reference to `vtable for lemon::GlpkLp'
> lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x26):
> undefined reference to `vtable for lemon::GlpkLp'
> lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x2e):
> undefined reference to `vtable for lemon::GlpkLp'
> lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x5b):
> undefined reference to `VTT for lemon::GlpkLp'
> lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x6e):
> undefined reference to `lemon::GlpkBase::~GlpkBase()'
> lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0x73):
> undefined reference to `VTT for lemon::GlpkLp'
> lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0xd3):
> undefined reference to `VTT for lemon::GlpkLp'
> lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0xe6):
> undefined reference to `lemon::GlpkBase::~GlpkBase()'
> lp_demo.cc:(.text._ZN5lemon6GlpkLpD1Ev[_ZN5lemon6GlpkLpD1Ev]+0xf0):
> undefined reference to `VTT for lemon::GlpkLp'
> collect2: error: ld returned 1 exit status
>
>
>
> Any help, advice?
> Thanks in advance.
> ________________________________
> CONFIDENTIALITY: This email is intended solely for the person(s)
> named and may be confidential and/or privileged. If you are not the
> intended recipient, please delete it, notify us and do not copy, use,
> or disclose its contents.
> Towards a sustainable earth: Print only when necessary. Thank you.
> _______________________________________________
> Lemon-user mailing list
> Lemon-user at lemon.cs.elte.hu
> http://lemon.cs.elte.hu/mailman/listinfo/lemon-user
>
More information about the Lemon-user
mailing list