-3

我正在尝试为非线性问题开发松弛处理程序。我想以 TSP 为例并对其进行修改。所以首先,我想用 ipopt 构建 TSP 问题。

我下载了 scipoptsuite 3.1.0 和 Ipopt 3.11.9。我已经用 ipopt 构建了 scip,并且我还从它的标准 makefile 构建了 TSP 示例。但是,TSP 示例的标准 makefile 不使用 ipopt 支持构建它。

如何构建具有 IPOPT 支持的 TSP 示例?

谢谢

2014 年 10 月 31 日更新:

所以我尝试了 IPOPT=true,看起来一切正常,但运行时出现问题。现在我迷路了。

调用制作:

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

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 -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

2014 年 11 月 4 日更新:

所以我从来没有想过如何用 IPOPT 构建 TSP。我的目标是添加一个使用 IPOT 的插件。我发现从一个干净的示例文件夹开始比从 TSP 代码开始更容易。我还没有弄清楚如何使用 IPOP 构建 TSP makefile。scip makefile 系统很难理解。

我如何添加使用 IPOPT 的插件:0)确保 bison 和 yacc 在您的路径中 1)在 scipoptsuite-3.1.0 中,运行 make READLINE=false IPOPT=true ZIMPL=false VERBOSE=true 3)保存输出。记下 o 文件是如何构建的,以及主 exe 文件是如何构建的。4) 将这些 g++ 命令保存/修改到 scip-3.1.0 中的 bash 脚本中,并在开发时运行它。

这个

4

1 回答 1

1

从我所见,您已经设法使用 IPOPT 构建了 TSP 示例,因为它在启动交互式 shell 时在 3rd-party-code 列表中占据显着位置。

您的应用程序中的分段错误是sciptsp隐式期望读取 TSP 数据的结果(有关此示例,请参见“tspdata”目录),因为该示例的一些附加插件要求问题数据完全符合该形状,并且在您的情况下以其他格式(例如“.pip”)读取的问题将失败。

所以我在这里看到两个选项,这取决于您是想基于 SCIP 创建几个不同的应用程序,还是只是通过额外的启发式扩展默认 SCIP:

  1. 第一个可以通过克隆 SCIP 的MIP 求解器示例并通过将它们与默认插件一起包含在自定义 cppmain.cpp 中来使用其他插件对其进行自定义来最快地实现。
  2. 后一个目标更容易:阅读有关所需插件类型的操作指南,例如SCIP 文档中的原始启发式,编写代码,包含到 Makefile 和 src/scip/scipdefplugins.[ch] 中的适当位置. 重新编译 SCIP 然后允许您使用默认交互式 shell 中的插件。NLPI 启发式 (src/scip/heur_nlpi.c) 使用 SCIP 的非线性接口的相应部分(反过来,调用 IPOPT),在您的情况下值得一看。

我知道这个答案对你来说来晚了,但可能会为其他人节省时间。

于 2014-11-11T15:32:55.423 回答