我正在尝试为非线性问题开发松弛处理程序。我想采用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,看起来事情有效,但是在运行时有问题。而现在我迷失了。
致电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
说它应该做的是什么:
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)确保野牛和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脚本,并在开发时运行它。
这个
答案 0 :(得分:1)
从我所看到的,您已经设法使用IPOPT构建TSP示例,因为它在启动交互式shell时在第三方代码列表中占据显着位置。
应用程序中的分段错误是sciptsp
隐式期望读取TSP数据的结果(有关此示例,请参阅“tspdata”目录),因为该示例的某些其他插件需要问题数据完全符合该形状,并且在您的情况下以其他格式(例如“.pip”)读取的问题将失败。
所以我在这里看到两个选项,取决于你是想基于SCIP创建几个不同的应用程序,还是只是通过一个额外的启发式扩展默认的SCIP:
我知道这个答案对你来说很晚,但也许为别人节省了时间。