<HTML><HEAD>
<META content="text/html; charset=ISO-8859-1" http-equiv=content-type></HEAD>
<BODY dir=ltr bgColor=#ffffff text=#000000>
<DIV dir=ltr>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: 'Calibri'; COLOR: #000000">
<DIV>Yes I am pretty much the authority on this topic, but it’s always good to
email the Ipopt mailing list - I (and other knowledgeable subscribers) respond
to any messages there that I know how to answer, and other people who run into
the same problem can look up the discussion in the future by searching the
archives.</DIV>
<DIV> </DIV>
<DIV>What is most likely the case is that Matlab’s included copies of the
runtime libraries for libgfortran, libstdc++, libblas, and/or liblapack are not
compatible with the runtime libraries of the default compilers and system
libraries - in Ubuntu 14.04 it looks like the default compiler version is GCC
4.8.x. For Matlab 2012a, Mathworks recommends using gcc/g++ 4.4, and strangely
gfortran 4.3 (I’ve seen 4.4 has worked okay for people in the past though), see
<A title=http://www.mathworks.com/support/compilers/R2012a/glnxa64.html
href="http://www.mathworks.com/support/compilers/R2012a/glnxa64.html">http://www.mathworks.com/support/compilers/R2012a/glnxa64.html</A>
.</DIV>
<DIV> </DIV>
<DIV>You should be able to install the 4.4 compiler versions in Ubuntu with
`sudo apt-get install g++-4.4 gfortran-4.4`. Then you tell Ipopt configure to
use these with “CC=gcc-4.4 CXX=g++-4.4 F77=gfortran-4.4”. It is possible to use
newer compiler versions if you statically link the runtime libraries into the
mex file (that’s what I did for the binary download mex file here <A
title=http://www.coin-or.org/download/binary/Ipopt/Ipopt-3.11.0-linux64mac64win32win64-matlabmexfiles.zip
href="http://www.coin-or.org/download/binary/Ipopt/Ipopt-3.11.0-linux64mac64win32win64-matlabmexfiles.zip">http://www.coin-or.org/download/binary/Ipopt/Ipopt-3.11.0-linux64mac64win32win64-matlabmexfiles.zip</A>
, did you try that?), but you have to compile GCC itself using --with-pic which
isn’t the default setting. Not worth the time unless you’re trying to create a
single mex file that can be used across a variety of different Linux
distributions and Matlab versions.</DIV>
<DIV> </DIV>
<DIV>If your system has libblas and liblapack installed, then you’ll also need
to tell Ipopt to instead build static versions of the reference libraries with
“--disable-shared --with-pic --with-blas=BUILD --with-lapack=BUILD”.</DIV>
<DIV> </DIV>
<DIV>-Tony</DIV>
<DIV> </DIV>
<DIV
style='FONT-SIZE: small; TEXT-DECORATION: none; FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal; COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline'>
<DIV style="FONT: 10pt tahoma">
<DIV><FONT size=3 face=Calibri></FONT> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=edouard.oudet@imag.fr
href="mailto:edouard.oudet@imag.fr">Edouard Oudet</A> </DIV>
<DIV><B>Sent:</B> Tuesday, May 06, 2014 8:03 AM</DIV>
<DIV><B>To:</B> <A title=kelman@berkeley.edu
href="mailto:kelman@berkeley.edu">kelman@berkeley.edu</A> </DIV>
<DIV><B>Subject:</B> Pb Ipopt-Matlab</DIV></DIV></DIV>
<DIV> </DIV></DIV>
<DIV
style='FONT-SIZE: small; TEXT-DECORATION: none; FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal; COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline'>Dear
Tony,<BR><BR>I am trying to link matlab and the Ipopt library and I understood
from Internet that you are an expert in such a game... I am sure that you have a
lot of more interesting things to do but some comments/recommendations would be
great !<BR><BR>I am under ubuntu 14.04 linux 64b and matlab 2012a.<BR><BR>I
succeeded in compiling Ipopt. See the output of the example below and here my
configure options <BR><BR>./configure --prefix=${IPOPTDIR} ADD_CXXFLAGS="-fPIC
-fexceptions" ADD_CFLAGS="-fPIC -fexceptions" ADD_FFLAGS="-fPIC -fexceptions"
--with-matlab-home=${MATLAB_HOME}<BR><BR>Then I tried to compile the Matlab
interface based on the web page<BR><BR><A class=moz-txt-link-freetext
href="https://projects.coin-or.org/Ipopt/wiki/MatlabInterface">https://projects.coin-or.org/Ipopt/wiki/MatlabInterface</A><BR><BR>I
went to the /contrib/MatlabInterface/src and run make and obtained an
ipopt.mexa64 file (I encountered the warning below on the
-largeArrayDims option).<BR><BR>Finally I tried to call Ipopt by the provided
example <BR><BR>>>
examplehs051<BR><BR>******************************************************************************<BR>This
program contains Ipopt, a library for large-scale nonlinear
optimization.<BR>Ipopt is released as open source code under the Eclipse Public
License (EPL).<BR> For more
information visit <A class=moz-txt-link-freetext
href="http://projects.coin-or.org/Ipopt">http://projects.coin-or.org/Ipopt</A><BR>******************************************************************************<BR><BR>This
is Ipopt version 3.11.8, running with linear solver mumps.<BR>NOTE: Other linear
solvers might be more efficient (see Ipopt documentation).<BR><BR>Number of
nonzeros in equality constraint
Jacobian...: 7<BR>Number of nonzeros
in inequality constraint Jacobian.:
0<BR>Number of nonzeros in Lagrangian
Hessian.............:
0<BR><BR><BR>------------------------------------------------------------------------<BR>
Segmentation violation detected at Tue May 6 16:54:20
2014<BR>------------------------------------------------------------------------<BR><BR>....<BR><BR>Which
is not completely satisfactory.<BR>Do you have any idea of what could be the
source of the problem ?<BR>Thanks a lot for the time you spent reading my
email,<BR><BR>all the best,<BR><BR>Edouard
Oudet.<BR><BR><BR><BR><BR><BR><BR>//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<BR>**************************************************************************<BR>
Warning: Neither -compatibleArrayDims nor -largeArrayDims is selected.
<BR> Using
-compatibleArrayDims. In the future, MATLAB will
require<BR> the use
of -largeArrayDims and remove the
-compatibleArrayDims<BR>
option. For more information,
see:<BR> <A
class=moz-txt-link-freetext
href="http://www.mathworks.com/help/techdoc/matlab_external/bsflnue-1.html">http://www.mathworks.com/help/techdoc/matlab_external/bsflnue-1.html</A><BR>**************************************************************************<BR><BR>->
mexopts.sh sourced from directory (DIR = $MATLAB/bin)<BR> FILE =
/usr/local/matlab2012a/bin/mexopts.sh<BR>----------------------------------------------------------------<BR>->
MATLAB
= /usr/local/matlab2012a<BR>->
CC
= g++ <BR>-> CC
flags:<BR>
CFLAGS =
-ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer
-pthread<BR>
CDEBUGFLAGS =
-g<BR>
COPTIMFLAGS = -O3 -fPIC -fexceptions
-pipe -DNDEBUG -pedantic-errors -Wparentheses -Wreturn-type -Wcast-qual -Wall
-Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long
-fPIC -fexceptions -DIPOPT_BUILD -DMATLAB_MEXFILE
<BR>
CLIBS
= -Wl,-rpath-link,/usr/local/matlab2012a/bin/glnxa64
-L/usr/local/matlab2012a/bin/glnxa64 -lmx -lmex -lmat -lm
-lstdc++<BR>
arguments =
<BR>->
CXX
= g++ <BR>-> CXX
flags:<BR>
CXXFLAGS = -ansi
-D_GNU_SOURCE -fPIC -fno-omit-frame-pointer
-pthread<BR>
CXXDEBUGFLAGS =
-g<BR>
CXXOPTIMFLAGS = -O3 -fPIC -fexceptions -pipe
-DNDEBUG -pedantic-errors -Wparentheses -Wreturn-type -Wcast-qual -Wall
-Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long
-fPIC -fexceptions -DIPOPT_BUILD -DMATLAB_MEXFILE
<BR>
CXXLIBS =
-Wl,-rpath-link,/usr/local/matlab2012a/bin/glnxa64
-L/usr/local/matlab2012a/bin/glnxa64 -lmx -lmex -lmat
-lm<BR>
arguments =
<BR>->
FC
= gfortran<BR>-> FC
flags:<BR>
FFLAGS =
-fexceptions -fbackslash -fPIC
-fno-omit-frame-pointer<BR>
FDEBUGFLAGS =
-g<BR>
FOPTIMFLAGS =
-O<BR>
FLIBS
= -Wl,-rpath-link,/usr/local/matlab2012a/bin/glnxa64
-L/usr/local/matlab2012a/bin/glnxa64 -lmx -lmex -lmat
-lm<BR>
arguments =
<BR>->
LD
= g++<BR>-> Link
flags:<BR>
LDFLAGS =
-pthread -shared
-Wl,--version-script,/usr/local/matlab2012a/extern/lib/glnxa64/mexFunction.map
-Wl,--no-undefined<BR>
LDDEBUGFLAGS =
-g<BR>
LDOPTIMFLAGS = -O3 -fPIC -fexceptions -pipe
-DNDEBUG -pedantic-errors -Wparentheses -Wreturn-type -Wcast-qual -Wall
-Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long
-fPIC -fexceptions -DIPOPT_BUILD -DMATLAB_MEXFILE -Wl,--rpath
-Wl,/home/oudet/C++/Ipopt-3.11.8/lib
<BR>
LDEXTENSION =
.mexa64<BR>
arguments =
-L/home/oudet/C++/Ipopt-3.11.8/lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8
-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib -L/lib/../lib
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.. -lipopt -llapack
-ldl -lcoinmumps -lblas -lgfortran -lm -lquadmath
-lcoinmetis<BR>->
LDCXX
= <BR>-> Link
flags:<BR>
LDCXXFLAGS =
<BR>
LDCXXDEBUGFLAGS =
<BR>
LDCXXOPTIMFLAGS =
<BR>
LDCXXEXTENSION =
<BR>
arguments =
-L/home/oudet/C++/Ipopt-3.11.8/lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8
-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib -L/lib/../lib
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.. -lipopt -llapack
-ldl -lcoinmumps -lblas -lgfortran -lm -lquadmath
-lcoinmetis<BR>----------------------------------------------------------------<BR><BR><BR><BR><BR><BR><BR>/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<BR>./hs071_c
<BR><BR>******************************************************************************<BR>This
program contains Ipopt, a library for large-scale nonlinear
optimization.<BR>Ipopt is released as open source code under the Eclipse Public
License (EPL).<BR> For more
information visit <A class=moz-txt-link-freetext
href="http://projects.coin-or.org/Ipopt">http://projects.coin-or.org/Ipopt</A><BR>******************************************************************************<BR><BR>This
is Ipopt version 3.11.8, running with linear solver mumps.<BR>NOTE: Other linear
solvers might be more efficient (see Ipopt documentation).<BR><BR>Number of
nonzeros in equality constraint
Jacobian...: 4<BR>Number of nonzeros
in inequality constraint Jacobian.:
4<BR>Number of nonzeros in Lagrangian
Hessian.............: 10<BR><BR>Total number
of
variables............................:
4<BR>
variables with only lower bounds:
0<BR>
variables with lower and upper bounds:
4<BR>
variables with only upper bounds:
0<BR>Total number of equality
constraints.................:
1<BR>Total number of inequality
constraints...............:
1<BR> inequality constraints with only
lower bounds: 1<BR>
inequality constraints with lower and upper
bounds:
0<BR> inequality constraints with only
upper bounds:
0<BR><BR>iter objective inf_pr
inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr
ls<BR> 0 1.6109693e+01 1.12e+01 5.28e-01 0.0
0.00e+00 - 0.00e+00 0.00e+00
0<BR> 1 1.7410406e+01 7.49e-01 2.25e+01 -0.3
7.97e-01 - 3.19e-01 1.00e+00f 1<BR>
2 1.8001613e+01 7.52e-03 4.96e+00 -0.3 5.60e-02 2.0
9.97e-01 1.00e+00h 1<BR> 3 1.7199482e+01 4.00e-02
4.24e-01 -1.0 9.91e-01 - 9.98e-01 1.00e+00f
1<BR> 4 1.6940955e+01 1.59e-01 4.58e-02 -1.4
2.88e-01 - 9.66e-01 1.00e+00h 1<BR>
5 1.7003411e+01 2.16e-02 8.42e-03 -2.9 7.03e-02
- 9.68e-01 1.00e+00h 1<BR> 6 1.7013974e+01
2.03e-04 8.65e-05 -4.5 6.22e-03 - 1.00e+00
1.00e+00h 1<BR> 7 1.7014017e+01 2.76e-07 2.18e-07 -10.3
1.43e-04 - 9.99e-01 1.00e+00h 1<BR>
8 1.7014017e+01 3.55e-14 2.23e-14 -11.0 1.04e-07 -
1.00e+00 1.00e+00h 1<BR><BR>Number of Iterations....:
8<BR><BR>
(scaled)
(unscaled)<BR>Objective...............:
1.7014017140224134e+01 1.7014017140224134e+01<BR>Dual
infeasibility......: 2.2261967499857942e-14
2.2261967499857942e-14<BR>Constraint violation....:
3.5527136788005009e-14
3.5527136788005009e-14<BR>Complementarity.........:
1.0023967333275307e-11 1.0023967333275307e-11<BR>Overall NLP
error.......: 1.0023967333275307e-11
1.0023967333275307e-11<BR><BR><BR>Number of objective function
evaluations
= 9<BR>Number of objective gradient
evaluations
= 9<BR>Number of equality constraint
evaluations =
9<BR>Number of inequality constraint
evaluations = 9<BR>Number
of equality constraint Jacobian evaluations = 9<BR>Number of
inequality constraint Jacobian evaluations = 9<BR>Number of Lagrangian Hessian
evaluations
= 8<BR>Total CPU secs in IPOPT (w/o function evaluations)
= 0.005<BR>Total CPU secs in NLP function
evaluations
= 0.000<BR><BR>EXIT: Optimal Solution
Found.<BR><BR><BR>Solution of the primal variables, x<BR>x[0] =
1.000000e+00<BR>x[1] = 4.743000e+00<BR>x[2] = 3.821150e+00<BR>x[3] =
1.379408e+00<BR><BR><BR>Solution of the ccnstraint multipliers,
lambda<BR>lambda[0] = -5.522937e-01<BR>lambda[1] =
1.614686e-01<BR><BR><BR>Solution of the bound multipliers, z_L and z_U<BR>z_L[0]
= 1.087871e+00<BR>z_L[1] = 2.671608e-12<BR>z_L[2] = 3.544911e-12<BR>z_L[3] =
2.635449e-11<BR>z_U[0] = 2.499943e-12<BR>z_U[1] = 3.896984e-11<BR>z_U[2] =
8.482036e-12<BR>z_U[3] = 2.762163e-12<BR><BR><BR>Objective value<BR>f(x*) =
1.701402e+01<BR>This is Ipopt version 3.11.8, running with linear solver
mumps.<BR>NOTE: Other linear solvers might be more efficient (see Ipopt
documentation).<BR><BR>Number of nonzeros in equality constraint
Jacobian...: 4<BR>Number of nonzeros
in inequality constraint Jacobian.:
4<BR>Number of nonzeros in Lagrangian
Hessian.............: 10<BR><BR>Total number
of
variables............................:
4<BR>
variables with only lower bounds:
0<BR>
variables with lower and upper bounds:
4<BR>
variables with only upper bounds:
0<BR>Total number of equality
constraints.................:
1<BR>Total number of inequality
constraints...............:
1<BR> inequality constraints with only
lower bounds: 1<BR>
inequality constraints with lower and upper
bounds:
0<BR> inequality constraints with only
upper bounds:
0<BR><BR>iter objective inf_pr
inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr
ls<BR> 0 1.7014163e+01 2.00e-05 1.03e-03 0.0
0.00e+00 - 0.00e+00 0.00e+00
0<BR> 1 1.6904734e+01 1.84e-04 1.25e-04 -3.9
2.00e-01 - 1.00e+00 9.92e-01f 1<BR>
2 1.6903619e+01 3.03e-07 2.65e-07 -9.7 2.00e-03
- 9.99e-01 9.99e-01h 1<BR> 3 1.6903618e+01
2.98e-13 3.15e-13 -11.0 2.21e-06 - 1.00e+00
1.00e+00h 1<BR><BR>Number of Iterations....:
3<BR><BR>
(scaled)
(unscaled)<BR>Objective...............:
1.6903617923661113e+01 1.6903617923661113e+01<BR>Dual
infeasibility......: 3.1514426168633523e-13
3.1514426168633523e-13<BR>Constraint violation....:
2.9842794901924208e-13
2.9842794901924208e-13<BR>Complementarity.........:
1.0321836080683101e-11 1.0321836080683101e-11<BR>Overall NLP
error.......: 1.0321836080683101e-11
1.0321836080683101e-11<BR><BR><BR>Number of objective function
evaluations
= 4<BR>Number of objective gradient
evaluations
= 4<BR>Number of equality constraint
evaluations =
4<BR>Number of inequality constraint
evaluations = 5<BR>Number
of equality constraint Jacobian evaluations = 4<BR>Number of
inequality constraint Jacobian evaluations = 4<BR>Number of Lagrangian Hessian
evaluations
= 3<BR>Total CPU secs in IPOPT (w/o function evaluations)
= 0.002<BR>Total CPU secs in NLP function
evaluations
= 0.000<BR><BR>EXIT: Optimal Solution
Found.<BR><BR><BR>Solution of the primal variables, x<BR>x[0] =
1.000000e+00<BR>x[1] = 4.749269e+00<BR>x[2] = 3.817510e+00<BR>x[3] =
1.367870e+00<BR><BR><BR>Solution of the ccnstraint multipliers,
lambda<BR>lambda[0] = -5.517016e-01<BR>lambda[1] =
1.592915e-01<BR><BR><BR>Solution of the bound multipliers, z_L and z_U<BR>z_L[0]
= 1.090362e+00<BR>z_L[1] = 2.664877e-12<BR>z_L[2] = 3.556758e-12<BR>z_L[3] =
2.693832e-11<BR>z_U[0] = 2.498100e-12<BR>z_U[1] = 4.074104e-11<BR>z_U[2] =
8.423997e-12<BR>z_U[3] = 2.755724e-12<BR><BR><BR>Objective value<BR>f(x*) =
1.690362e+01<BR><BR><BR><BR><BR><PRE class=moz-signature cols="72">--
Edouard Oudet : <A class=moz-txt-link-freetext href="http://www-ljk.imag.fr/membres/Edouard.Oudet/">http://www-ljk.imag.fr/membres/Edouard.Oudet/</A>
Bureau 51
LJK, UMR 5224, Université Joseph Fourier
Tour IRMA, BP 53
51, rue des Mathématiques
F-38041 Grenoble Cedex 9
+33 (0)4 76 51 46 75 (office LJK)
+33 (0)4 76 51 40 30 (office UFR)
+33 (0)4 79 75 87 65 (office LAMA)
+33 (0)4 79 68 82 06 (home)
</PRE></DIV></DIV></DIV></BODY></HTML>