-3

I am trying to develop relaxation handler for a nonlinear problem. I want to take the TSP example and modify it. So first, I want to build the TSP problem with ipopt.

I downloaded scipoptsuite 3.1.0 and Ipopt 3.11.9. I have build scip with ipopt, and I have also build the TSP example from its standard makefile. However, the standard makefile for the TSP example does not build it with ipopt support.

How do I build the TSP example with IPOPT support?

Thank you

Update Oct 31, 2014:

So I have tried IPOPT=true, and it looks like things work, but there is a problem at run-time. And now I am lost.

Calling Make:

bedutra@logic:~/scipoptsuite-3.1.0/scip-3.1.0/examples/TSP$ make clean
rm -f obj/O.linux.x86_64.gnu.opt/*.o
rmdir obj/O.linux.x86_64.gnu.opt
rm -f bin/sciptsp.linux.x86_64.gnu.opt.spx
bedutra@logic:~/scipoptsuite-3.1.0/scip-3.1.0/examples/TSP$ make -j10 IPOPT=true
-> compiling obj/O.linux.x86_64.gnu.opt/cppmain.o
-> compiling obj/O.linux.x86_64.gnu.opt/ConshdlrSubtour.o
-> compiling obj/O.linux.x86_64.gnu.opt/ProbDataTSP.o
-> compiling obj/O.linux.x86_64.gnu.opt/ReaderTSP.o
-> compiling obj/O.linux.x86_64.gnu.opt/GomoryHuTree.o
-> compiling obj/O.linux.x86_64.gnu.opt/EventhdlrNewSol.o
-> compiling obj/O.linux.x86_64.gnu.opt/HeurFarthestInsert.o
-> compiling obj/O.linux.x86_64.gnu.opt/HeurFrats.o
-> compiling obj/O.linux.x86_64.gnu.opt/Heur2opt.o
-> linking bin/sciptsp.linux.x86_64.gnu.opt.spx
bedutra@logic:~/scipoptsuite-3.1.0/scip-3.1.0/examples/TSP$ ./bin/sciptsp -f ../../bin/t.pip 
SCIP version 3.1.0 [precision: 8 byte] [memory: block] [mode: optimized] [LP solver: SoPlex 2.0.0] [GitHash: 577ee45]
Copyright (c) 2002-2014 Konrad-Zuse-Zentrum fuer Informationstechnik Berlin (ZIB)

External codes: 
  Readline 6.3         GNU library for command line editing (gnu.org/s/readline)
  SoPlex 2.0.0         Linear Programming Solver developed at Zuse Institute Berlin (soplex.zib.de) [GitHash: 568f354]
  cppad-20140000.1     Algorithmic Differentiation of C++ algorithms developed by B. Bell (www.coin-or.org/CppAD)
  ZLIB 1.2.8           General purpose compression library by J. Gailly and M. Adler (zlib.net)
  GMP 5.1.3            GNU Multiple Precision Arithmetic Library developed by T. Granlund (gmplib.org)
  ZIMPL 3.3.2          Zuse Institute Mathematical Programming Language developed by T. Koch (zimpl.zib.de)
  Ipopt 3.11.9         Interior Point Optimizer developed by A. Waechter et.al. (www.coin-or.org/Ipopt)

reading user parameter file <sciptsp.set>

read problem <../../bin/t.pip>
============

original problem has 6 variables (0 bin, 5 int, 0 impl, 1 cont) and 1 constraints

solve problem
=============

Segmentation fault

bedutra@logic:~/scipoptsuite-3.1.0/scip-3.1.0/examples/TSP$ cat bin/t.pip 
Maximize
obj: x1^3*x2^5*x3^3*x4^3 + x4*x5^2 - x3^4*x4^2*x1^3 - x4^5
Bounds
1 <= x1 <= 10
1 <= x2 <= 10
1 <= x3 <= 10
1 <= x4 <= 10
1 <= x5 <= 10
Integers
x1
x2
x3
x4
x5
End

What make says it should be doing:

bedutra@logic:~/scipoptsuite-3.1.0/scip-3.1.0/examples/TSP$ make clean
rm -f obj/O.linux.x86_64.gnu.opt/*.o
rmdir obj/O.linux.x86_64.gnu.opt
rm -f bin/sciptsp.linux.x86_64.gnu.opt.spx
bedutra@logic:~/scipoptsuite-3.1.0/scip-3.1.0/examples/TSP$ make -j10 IPOPT=true -n
mkdir -p obj/O.linux.x86_64.gnu.opt
echo "-> compiling obj/O.linux.x86_64.gnu.opt/cppmain.o"
g++ -Isrc -DWITH_SCIPDEF -I../../src -DNDEBUG -DROUNDING_FE  -DNPARASCIP -DWITH_ZLIB  -DWITH_GMP  -DWITH_READLINE  -Ilib/ipopt.linux.x86_64.gnu.opt/include/coin   -O3 -fomit-frame-pointer -mtune=native     -std=c++0x -pedantic -Wno-long-long -Wall -W -Wpointer-arith -Wcast-align -Wwrite-strings -Wshadow -Wno-unknown-pragmas -Wno-unused-parameter -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Woverloaded-virtual -Wsign-promo -Wsynth -Wcast-qual -Wno-unused-parameter -Wno-strict-overflow  -Wno-strict-aliasing  -m64  -c src/cppmain.cpp -o obj/O.linux.x86_64.gnu.opt/cppmain.o
echo "-> compiling obj/O.linux.x86_64.gnu.opt/ConshdlrSubtour.o"
g++ -Isrc -DWITH_SCIPDEF -I../../src -DNDEBUG -DROUNDING_FE  -DNPARASCIP -DWITH_ZLIB  -DWITH_GMP  -DWITH_READLINE  -Ilib/ipopt.linux.x86_64.gnu.opt/include/coin   -O3 -fomit-frame-pointer -mtune=native     -std=c++0x -pedantic -Wno-long-long -Wall -W -Wpointer-arith -Wcast-align -Wwrite-strings -Wshadow -Wno-unknown-pragmas -Wno-unused-parameter -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Woverloaded-virtual -Wsign-promo -Wsynth -Wcast-qual -Wno-unused-parameter -Wno-strict-overflow  -Wno-strict-aliasing  -m64  -c src/ConshdlrSubtour.cpp -o obj/O.linux.x86_64.gnu.opt/ConshdlrSubtour.o
echo "-> compiling obj/O.linux.x86_64.gnu.opt/ProbDataTSP.o"
g++ -Isrc -DWITH_SCIPDEF -I../../src -DNDEBUG -DROUNDING_FE  -DNPARASCIP -DWITH_ZLIB  -DWITH_GMP  -DWITH_READLINE  -Ilib/ipopt.linux.x86_64.gnu.opt/include/coin   -O3 -fomit-frame-pointer -mtune=native     -std=c++0x -pedantic -Wno-long-long -Wall -W -Wpointer-arith -Wcast-align -Wwrite-strings -Wshadow -Wno-unknown-pragmas -Wno-unused-parameter -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Woverloaded-virtual -Wsign-promo -Wsynth -Wcast-qual -Wno-unused-parameter -Wno-strict-overflow  -Wno-strict-aliasing  -m64  -c src/ProbDataTSP.cpp -o obj/O.linux.x86_64.gnu.opt/ProbDataTSP.o
echo "-> compiling obj/O.linux.x86_64.gnu.opt/ReaderTSP.o"
g++ -Isrc -DWITH_SCIPDEF -I../../src -DNDEBUG -DROUNDING_FE  -DNPARASCIP -DWITH_ZLIB  -DWITH_GMP  -DWITH_READLINE  -Ilib/ipopt.linux.x86_64.gnu.opt/include/coin   -O3 -fomit-frame-pointer -mtune=native     -std=c++0x -pedantic -Wno-long-long -Wall -W -Wpointer-arith -Wcast-align -Wwrite-strings -Wshadow -Wno-unknown-pragmas -Wno-unused-parameter -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Woverloaded-virtual -Wsign-promo -Wsynth -Wcast-qual -Wno-unused-parameter -Wno-strict-overflow  -Wno-strict-aliasing  -m64  -c src/ReaderTSP.cpp -o obj/O.linux.x86_64.gnu.opt/ReaderTSP.o
echo "-> compiling obj/O.linux.x86_64.gnu.opt/GomoryHuTree.o"
g++ -Isrc -DWITH_SCIPDEF -I../../src -DNDEBUG -DROUNDING_FE  -DNPARASCIP -DWITH_ZLIB  -DWITH_GMP  -DWITH_READLINE  -Ilib/ipopt.linux.x86_64.gnu.opt/include/coin   -O3 -fomit-frame-pointer -mtune=native     -std=c++0x -pedantic -Wno-long-long -Wall -W -Wpointer-arith -Wcast-align -Wwrite-strings -Wshadow -Wno-unknown-pragmas -Wno-unused-parameter -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Woverloaded-virtual -Wsign-promo -Wsynth -Wcast-qual -Wno-unused-parameter -Wno-strict-overflow  -Wno-strict-aliasing  -m64  -c src/GomoryHuTree.cpp -o obj/O.linux.x86_64.gnu.opt/GomoryHuTree.o
echo "-> compiling obj/O.linux.x86_64.gnu.opt/EventhdlrNewSol.o"
g++ -Isrc -DWITH_SCIPDEF -I../../src -DNDEBUG -DROUNDING_FE  -DNPARASCIP -DWITH_ZLIB  -DWITH_GMP  -DWITH_READLINE  -Ilib/ipopt.linux.x86_64.gnu.opt/include/coin   -O3 -fomit-frame-pointer -mtune=native     -std=c++0x -pedantic -Wno-long-long -Wall -W -Wpointer-arith -Wcast-align -Wwrite-strings -Wshadow -Wno-unknown-pragmas -Wno-unused-parameter -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Woverloaded-virtual -Wsign-promo -Wsynth -Wcast-qual -Wno-unused-parameter -Wno-strict-overflow  -Wno-strict-aliasing  -m64  -c src/EventhdlrNewSol.cpp -o obj/O.linux.x86_64.gnu.opt/EventhdlrNewSol.o
echo "-> compiling obj/O.linux.x86_64.gnu.opt/HeurFarthestInsert.o"
g++ -Isrc -DWITH_SCIPDEF -I../../src -DNDEBUG -DROUNDING_FE  -DNPARASCIP -DWITH_ZLIB  -DWITH_GMP  -DWITH_READLINE  -Ilib/ipopt.linux.x86_64.gnu.opt/include/coin   -O3 -fomit-frame-pointer -mtune=native     -std=c++0x -pedantic -Wno-long-long -Wall -W -Wpointer-arith -Wcast-align -Wwrite-strings -Wshadow -Wno-unknown-pragmas -Wno-unused-parameter -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Woverloaded-virtual -Wsign-promo -Wsynth -Wcast-qual -Wno-unused-parameter -Wno-strict-overflow  -Wno-strict-aliasing  -m64  -c src/HeurFarthestInsert.cpp -o obj/O.linux.x86_64.gnu.opt/HeurFarthestInsert.o
echo "-> compiling obj/O.linux.x86_64.gnu.opt/HeurFrats.o"
g++ -Isrc -DWITH_SCIPDEF -I../../src -DNDEBUG -DROUNDING_FE  -DNPARASCIP -DWITH_ZLIB  -DWITH_GMP  -DWITH_READLINE  -Ilib/ipopt.linux.x86_64.gnu.opt/include/coin   -O3 -fomit-frame-pointer -mtune=native     -std=c++0x -pedantic -Wno-long-long -Wall -W -Wpointer-arith -Wcast-align -Wwrite-strings -Wshadow -Wno-unknown-pragmas -Wno-unused-parameter -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Woverloaded-virtual -Wsign-promo -Wsynth -Wcast-qual -Wno-unused-parameter -Wno-strict-overflow  -Wno-strict-aliasing  -m64  -c src/HeurFrats.cpp -o obj/O.linux.x86_64.gnu.opt/HeurFrats.o
echo "-> compiling obj/O.linux.x86_64.gnu.opt/Heur2opt.o"
g++ -Isrc -DWITH_SCIPDEF -I../../src -DNDEBUG -DROUNDING_FE  -DNPARASCIP -DWITH_ZLIB  -DWITH_GMP  -DWITH_READLINE  -Ilib/ipopt.linux.x86_64.gnu.opt/include/coin   -O3 -fomit-frame-pointer -mtune=native     -std=c++0x -pedantic -Wno-long-long -Wall -W -Wpointer-arith -Wcast-align -Wwrite-strings -Wshadow -Wno-unknown-pragmas -Wno-unused-parameter -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Woverloaded-virtual -Wsign-promo -Wsynth -Wcast-qual -Wno-unused-parameter -Wno-strict-overflow  -Wno-strict-aliasing  -m64  -c src/Heur2opt.cpp -o obj/O.linux.x86_64.gnu.opt/Heur2opt.o
echo "-> linking bin/sciptsp.linux.x86_64.gnu.opt.spx"
g++ obj/O.linux.x86_64.gnu.opt/cppmain.o obj/O.linux.x86_64.gnu.opt/ConshdlrSubtour.o obj/O.linux.x86_64.gnu.opt/ProbDataTSP.o obj/O.linux.x86_64.gnu.opt/ReaderTSP.o obj/O.linux.x86_64.gnu.opt/GomoryHuTree.o obj/O.linux.x86_64.gnu.opt/EventhdlrNewSol.o obj/O.linux.x86_64.gnu.opt/HeurFarthestInsert.o obj/O.linux.x86_64.gnu.opt/HeurFrats.o obj/O.linux.x86_64.gnu.opt/Heur2opt.o \
        -L../../lib -lscip.linux.x86_64.gnu.opt \
                -lobjscip.linux.x86_64.gnu.opt -llpispx.linux.x86_64.gnu.opt -lnlpi.cppad.ipopt.linux.x86_64.gnu.opt \
                 -O3 -fomit-frame-pointer -mtune=native    -lsoplex.linux.x86_64.gnu.opt \
        -L/homes/home03/b/bedutra/installDir/lib  -lm -Wl,--no-as-needed -m64  -lz -lzimpl.linux.x86_64.gnu.opt  -lgmp -lreadline -lncurses -L/homes/home03/b/bedutra/software/Ipopt-3.11.9/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 -ldl -lcoinmumps -lcoinlapack -lblas -lgfortran -lm -lquadmath -lcoinmetis   -Wl,-rpath,/homes/home03/b/bedutra/software/Ipopt-3.11.9/lib -Wl,-rpath,/homes/home03/b/bedutra/scipoptsuite-3.1.0/scip-3.1.0/lib -o bin/sciptsp.linux.x86_64.gnu.opt.spx
rm -f bin/sciptsp
cd bin/ && ln -s sciptsp.linux.x86_64.gnu.opt.spx sciptsp

Update Nov 4th, 2014:

So I never figured out how to build TSP with IPOPT. My goal was to add a plugin that uses IPOT. I found out that it is easier to start with a clean example folder than to start with TSP code. I still have not figured out how I can get the TSP makefile to build with IPOP. The scip makefile system is hard to understand.

How I am adding a plugin that uses IPOPT: 0) make sure bison and yacc are in your path 1) in scipoptsuite-3.1.0, run make READLINE=false IPOPT=true ZIMPL=false VERBOSE=true 3) Save the output. Take note of how the o-files are built and how the main exe file is built. 4) Save/modify these g++ commands into a bash script in scip-3.1.0 and just run this as you develop.

This

BeDutra
  • 125
  • 5
  • Welcome to StackOverflow. We tend to prefer questions that have prior effort. I suggest you give this one a shot for yourself, maybe looking online for examples of what other people have done (With a Google search, not asking here), and ask us if you have a *specific* problem – Jason Baker Oct 30 '14 at 22:21
  • @BeDutra Have you set `IPOPT=true` when compiling the TSP-example? You can also set `VERBOSE=true` to see which libraries are linked, and you should see IPOPT somewhere in there... – Gregor Oct 31 '14 at 10:37

1 Answers1

1

From what I can see, you have already managed to build the TSP-example with IPOPT, since it figures prominently in the list of 3rd-party-code when starting the interactive shell.

The segmentation fault in your application is the result of sciptsp implicitly expecting TSP-data to read (see the "tspdata"-directory for examples of this), because some of the additional plugins of the example require that the problem data is exactly in that shape, and will fail on problems read in other formats such as ".pip" in your case.

So I see two options here, depending on whether you would like to create several different applications based on SCIP, or just extend default SCIP by an additional heuristic:

  1. The first one can be achieved quickest by cloning the MIP solver example of SCIP and customizing it with additional plugins by including them together with the default plugins in a custom cppmain.cpp.
  2. The latter goal is even easier: Read the How-To's on your desired plugin type, e.g., primal heuristics in the SCIP documentation, write the code, include into the Makefile and at the appropriate places in src/scip/scipdefplugins.[ch]. Recompiling SCIP then allows you to use the plugin from the default interactive shell. The NLPI-heuristic (src/scip/heur_nlpi.c) makes use of the corresponding parts of the Nonlinear Interface of SCIP (which, in turn, calls IPOPT) and is worth looking at in your case.

I know this answer comes late for you, but maybe saves time for others.

Gregor
  • 1,333
  • 9
  • 16