[Ipopt] Error message when using the matlab interface

Paul van Hoven paul.van.hoven at googlemail.com
Sat Feb 26 12:00:34 EST 2011


I downloaded Ipopt and got it compiled on a Linux 64 bit machine. I put 
the compiled Ipopt stuff into "~/Mex/Ipopt" which contains the following 
subdirectories:
bin  include  lib  share

Since I use matlab 7.9 (2009b 64Bit) I wanted to compile the matlab 
interface. The interface is located in 
$COINOPT/Ipopt/contrib/MatlabInterface/src.
Within that directory should be a Makefile but instead I only found a 
Makefile.in file which was completely useless since all variables in 
that file weren't set. Therefore I created a Makefile on my own. This is 
the Makefile:

[MAKEFILE]
MATLAB_HOME = /net/matlab/Matlab2009b
MEXSUFFIX   = mexa64
PATH_TO_IPOPT_COMPILATION=/homes/numerik/hoven/Mex/Ipopt
SRCDIR = /homes/numerik/hoven/CoinIpopt/Ipopt/contrib/MatlabInterface/src

###############################################################################################
DESTINATION_DIR = $(PATH_TO_IPOPT_COMPILATION)/MatlabInterface
MEX = $(MATLAB_HOME)/bin/mex
#Pay attention to add a by your matlab version supported g++
CXX         = /usr/site-local/bin/g++-4.2
CXXFLAGS    = -fPIC -DMX_COMPAT_32 -DMATLAB_MEX_FILE -DMWINDEXISINT

INCLUDES    = -I$(PATH_TO_IPOPT_COMPILATION)/include/coin 
-I$(MATLAB_HOME)/extern/include
#Static linking
MEXFLAGS    = -cxx CC='$(CXX)' CXX='$(CXX)' LD='$(CXX)' -lm 
-L$(PATH_TO_IPOPT_COMPILATION)/lib/coin -lipopt 
-L$(PATH_TO_IPOPT_COMPILATION)/lib/coin/ThirdParty -lcoinlapack 
-lcoinblas -lcoinhsl -lamplsolver \
                -L/usr/site-local/lib/gcc/x86_64-unknown-linux-gnu/4.2.4 
-lgfortran -ldl -largeArrayDims
#Dynamic linking
#MEXFLAGS    = -cxx CC='$(CXX)' CXX='$(CXX)' LD='$(CXX)' -lm 
-L$(PATH_TO_IPOPT_COMPILATION)/lib/coin -lipopt -largeArrayDims

TARGET = ipopt.$(MEXSUFFIX)
OBJS   = matlabjournal.o        \
         matlabexception.o      \
         matlabfunctionhandle.o \
         iterate.o              \
         ipoptoptions.o         \
         options.o              \
         sparsematrix.o         \
         callbackfunctions.o    \
         matlabinfo.o           \
         matlabprogram.o        \
         ipopt.o

all: $(TARGET)

install: $(TARGET)
        if test -d $(DESTINATION_DIR); then : ; else mkdir 
$(DESTINATION_DIR); fi
        cp $(SRCDIR)/../ipopt.m $(TARGET) $(DESTINATION_DIR)
        cp -r $(SRCDIR)/../examples $(DESTINATION_DIR)

uninstall:
        rm -f $(DESTINATION_DIR)/ipopt.m 
$(DESTINATION_DIR)/ipopt.$(MEXSUFFIX)

$(TARGET): $(OBJS)
        $(MEX) $(MEXFLAGS) -output $@ $^

%.o: %.cpp
        $(CXX) $(CXXFLAGS) $(INCLUDES) -o $@ -c $^

clean:
        rm -f $(OBJS) $(TARGET)

distclean: clean
[/MAKEFILE]

As you can see I used the setting static linking which I noticed makes 
no difference to dynamic linking in terms of the error I encounter when 
using matlab. Anyway the compilation process works fine and the matlab 
interface is placed in a custom directory called "MatlabInterface" 
underneth ~/Mex/Ipopt. The directory contents look like this:
~/Mex/Ipopt/MatlabInterface> ls
examples  ipopt.m  ipopt.mexa64

examples is a directory containing some matlab m-files for testing ipopt 
matlab interface.

Then I started matlab to run the test matlab program to check that the 
interface works. So I did the following

matlab -nodisplay(enter)

                                                                                             
< M A T L A B (R) >
                                                                                   
Copyright 1984-2009 The MathWorks, Inc.
                                                                                 
Version 7.9.0.529 (R2009b) 64-bit (glnxa64)
                                                                                               
August 12, 2009

 
  To get started, type one of these: helpwin, helpdesk, or demo.
  For product information, visit www.mathworks.com.
 
 >> cd ~/Mex/Ipopt/MatlabInterface/examples/
 >> pwd

ans =

/homes/numerik/hoven/Mex/Ipopt/MatlabInterface/examples

 >> addpath /homes/numerik/hoven/Mex/Ipopt/MatlabInterface
 >> examplelasso

******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear 
optimization.
 Ipopt is released as open source code under the Eclipse Public License 
(EPL).
         For more information visit http://projects.coin-or.org/Ipopt
******************************************************************************

This is Ipopt version 3.9.2, running with linear solver ma27.

Function "mxGetJc_700" is obsolete in file "compat32.cpp", line 292.
(64-bit mex files using sparse matrices must be rebuilt with the 
"-largeArrayDims" option.  See the R2006b release notes for more details.)
Exception of type: IpoptException in file "Unknown File" at line -1:
 Exception message: Unknown Exception caught in Ipopt
Solution:
     0
     0
     0
     0
     0
     0
     0
     0

 >>

I find this message quite strange since I added the "-largeArrayDims" 
option in the Mex compiler flags. Even so I get this error. Why?



More information about the Ipopt mailing list