├── src ├── OsiCpx │ ├── config_osicpx.h.in │ ├── format-source.sh │ ├── osi-cplex.pc.in │ ├── Makefile.am │ └── OsiCpxConfig.h ├── OsiGrb │ ├── config_osigrb.h.in │ ├── format-source.sh │ ├── osi-gurobi.pc.in │ ├── Makefile.am │ └── OsiGrbConfig.h ├── OsiMsk │ ├── config_osimsk.h.in │ ├── osi-mosek.pc.in │ ├── Makefile.am │ └── OsiMskConfig.h ├── OsiSpx │ ├── config_osispx.h.in │ ├── osi-soplex.pc.in │ ├── Makefile.am │ └── OsiSpxConfig.h ├── OsiXpr │ ├── config_osixpr.h.in │ ├── format-source.sh │ ├── osi-xpress.pc.in │ ├── Makefile.am │ └── OsiXprConfig.h ├── OsiGlpk │ ├── config_osiglpk.h.in │ ├── format-source.sh │ ├── osi-glpk.pc.in │ ├── Makefile.am │ └── OsiGlpkConfig.h ├── OsiCommonTest │ ├── config_osicommontest.h.in │ ├── Makefile.am │ ├── OsiUnitTestsConfig.h │ └── OsiRowCutDebuggerTest.cpp └── Osi │ ├── config_osi.h.in │ ├── configall_system.h │ ├── format-source.sh │ ├── config_osi_default.h │ ├── OsiCollections.hpp │ ├── config_default.h │ ├── OsiConfig.h │ ├── OsiCut.cpp │ ├── Makefile.am │ ├── OsiColCut.cpp │ ├── config.h.in │ ├── .ycm_extra_conf.py │ ├── configall_system_msc.h │ ├── OsiSolverBranch.hpp │ ├── OsiSolverParameters.hpp │ └── OsiAuxInfo.cpp ├── AUTHORS ├── .coin-or ├── Dependencies ├── config.yml ├── projDesc.xml └── generate_readme ├── .gitattributes ├── examples ├── README ├── basic.cpp ├── opbdp_solve.hpp ├── query.cpp ├── readconic.cpp ├── parameters.cpp ├── build.cpp └── Makefile.in ├── .gitignore ├── .github └── workflows │ ├── release.yml │ ├── linux-ci.yml │ ├── windows-ci.yml │ └── windows-msvs-ci.yml ├── osi.pc.in ├── osi-unittests.pc.in ├── test ├── OsiTestSolverInterfaceTest.cpp └── Makefile.am ├── MSVisualStudio ├── v9alt │ ├── osi.vsprops │ ├── Osi.sln │ └── genDefForOsi.ps1 ├── v16 │ └── libOsi │ │ └── libOsi.sln ├── v10alt │ ├── osi.props │ ├── Osi.sln │ └── genDefForOsi.ps1 ├── v17 │ ├── OsiTest.cmd │ └── Osi.sln ├── v9 │ ├── OsiExamplesBuild │ │ └── OsiExamplesBuild.vcproj │ ├── OsiExamplesBasic │ │ └── OsiExamplesBasic.vcproj │ ├── OsiExamplesSpecific │ │ └── OsiExamplesSpecific.vcproj │ ├── OsiExamplesQuery │ │ └── OsiExamplesQuery.vcproj │ └── OsiExamplesParameters │ │ └── OsiExamplesParameters.vcproj └── v10 │ ├── Osi.sln │ ├── OsiExamplesBuild │ └── OsiExamplesBuild.vcxproj │ └── OsiExamplesSpecific │ └── OsiExamplesSpecific.vcxproj └── Makefile.am /src/OsiCpx/config_osicpx.h.in: -------------------------------------------------------------------------------- 1 | /* src/Osi/config_osicpx.h.in. */ 2 | 3 | #ifndef __CONFIG_OSICPX_H__ 4 | #define __CONFIG_OSICPX_H__ 5 | 6 | /* Library Visibility Attribute */ 7 | #undef OSICPXLIB_EXPORT 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/OsiGrb/config_osigrb.h.in: -------------------------------------------------------------------------------- 1 | /* src/Osi/config_osigrb.h.in. */ 2 | 3 | #ifndef __CONFIG_OSIGRB_H__ 4 | #define __CONFIG_OSIGRB_H__ 5 | 6 | /* Library Visibility Attribute */ 7 | #undef OSIGRBLIB_EXPORT 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/OsiMsk/config_osimsk.h.in: -------------------------------------------------------------------------------- 1 | /* src/Osi/config_osimsk.h.in. */ 2 | 3 | #ifndef __CONFIG_OSIMSK_H__ 4 | #define __CONFIG_OSIMSK_H__ 5 | 6 | /* Library Visibility Attribute */ 7 | #undef OSIMSKLIB_EXPORT 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/OsiSpx/config_osispx.h.in: -------------------------------------------------------------------------------- 1 | /* src/Osi/config_osispx.h.in. */ 2 | 3 | #ifndef __CONFIG_OSISPX_H__ 4 | #define __CONFIG_OSISPX_H__ 5 | 6 | /* Library Visibility Attribute */ 7 | #undef OSISPXLIB_EXPORT 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/OsiXpr/config_osixpr.h.in: -------------------------------------------------------------------------------- 1 | /* src/Osi/config_osixpr.h.in. */ 2 | 3 | #ifndef __CONFIG_OSIXPR_H__ 4 | #define __CONFIG_OSIXPR_H__ 5 | 6 | /* Library Visibility Attribute */ 7 | #undef OSIXPRLIB_EXPORT 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/OsiGlpk/config_osiglpk.h.in: -------------------------------------------------------------------------------- 1 | /* src/Osi/config_osiglpk.h.in. */ 2 | 3 | #ifndef __CONFIG_OSIGLPK_H__ 4 | #define __CONFIG_OSIGLPK_H__ 5 | 6 | /* Library Visibility Attribute */ 7 | #undef OSIGLPKLIB_EXPORT 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/OsiCommonTest/config_osicommontest.h.in: -------------------------------------------------------------------------------- 1 | /* src/Osi/config_osicommontest.h.in. */ 2 | 3 | #ifndef __CONFIG_OSICOMMONTEST_H__ 4 | #define __CONFIG_OSICOMMONTEST_H__ 5 | 6 | /* Library Visibility Attribute */ 7 | #undef OSICOMMONTESTLIB_EXPORT 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | This file is last updated on 05/24/2007 2 | Fasano, J.P. 3 | Forrest, John J. 4 | Hafer, Lou 5 | Ladanyi, Laszlo 6 | Lannez, Sebastien (OsiCuts insert method) 7 | Margot, Francois 8 | Saltzman, Matt 9 | Ralphs, Ted 10 | Walton, Philip (trait specification of OsiCuts) 11 | -------------------------------------------------------------------------------- /.coin-or/Dependencies: -------------------------------------------------------------------------------- 1 | ThirdParty/Glpk https://github.com/coin-or-tools/ThirdParty-Glpk master 2 | Data/Netlib https://github.com/coin-or-tools/Data-Netlib master 3 | Data/Sample https://github.com/coin-or-tools/Data-Sample master 4 | CoinUtils https://github.com/coin-or/CoinUtils master 5 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto !eol 2 | *.sh text eol=lf 3 | install-sh text eol=lf 4 | config.sub text eol=lf 5 | config.guess text eol=lf 6 | missing text eol=lf 7 | decomp text eol=lf 8 | configure text eol=lf 9 | *.ac text eol=lf 10 | *.am text eol=lf 11 | *.in text eol=lf 12 | Makefile text eol=lf 13 | *.bat eol=crlf 14 | -------------------------------------------------------------------------------- /examples/README: -------------------------------------------------------------------------------- 1 | These examples are from the OSI tutorial at INFORMS Atlanta 2003 by 2 | Brady Hunsaker and the workshop section on OSI given by Matthew 3 | Saltzman at CORS/INFORMS Banff 2004. 4 | 5 | The accompanying slides and handouts can be found at 6 | 7 | http://www.coin-or.org/Presentations/CORSINFORMSWorkshop04/index.html 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore VS files 2 | *.suo 3 | *.db 4 | *.bak 5 | *.user 6 | **/.vs/ 7 | **/MSVisualStudio/**/Release/ 8 | **/MSVisualStudio/**/ReleaseParallel/ 9 | **/MSVisualStudio/**/Debug/ 10 | 11 | # Ignore files created during unit tests 12 | **/MSVisualStudio/**/*.mps 13 | **/MSVisualStudio/**/*.lp 14 | **/MSVisualStudio/**/*.out 15 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Create Release 3 | 4 | on: 5 | push: 6 | tags: 7 | - '*' 8 | 9 | jobs: 10 | create_release: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/create-release@v1 14 | env: 15 | GITHUB_TOKEN: ${{ secrets.TKRALPHS_RELEASE }} 16 | with: 17 | tag_name: ${{ github.ref }} 18 | release_name: Release ${{ github.ref }} 19 | draft: false 20 | prerelease: false 21 | -------------------------------------------------------------------------------- /src/Osi/config_osi.h.in: -------------------------------------------------------------------------------- 1 | /* src/Osi/config_osi.h.in. */ 2 | 3 | #ifndef __CONFIG_OSI_H__ 4 | #define __CONFIG_OSI_H__ 5 | 6 | /* Library Visibility Attribute */ 7 | #undef OSILIB_EXPORT 8 | 9 | /* Version number of project */ 10 | #undef OSI_VERSION 11 | 12 | /* Major Version number of project */ 13 | #undef OSI_VERSION_MAJOR 14 | 15 | /* Minor Version number of project */ 16 | #undef OSI_VERSION_MINOR 17 | 18 | /* Release Version number of project */ 19 | #undef OSI_VERSION_RELEASE 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/Osi/configall_system.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This header file is included by the *Config.h in the individual 3 | * COIN packages when the code is compiled in a setting that doesn't 4 | * use the configure script (i.e., HAVE_CONFIG_H is not defined). 5 | * This header file includes the system and compile dependent header 6 | * file defining macros that depend on what compiler is used. 7 | */ 8 | 9 | #ifdef _MSC_VER 10 | # include "configall_system_msc.h" 11 | #else 12 | # error "Trying to use configall_system for unknown compiler." 13 | #endif 14 | -------------------------------------------------------------------------------- /osi.pc.in: -------------------------------------------------------------------------------- 1 | @COIN_RELOCATABLE_FALSE@prefix=@prefix@ 2 | @COIN_RELOCATABLE_TRUE@prefix=${pcfiledir}/../.. 3 | exec_prefix=@exec_prefix@ 4 | libdir=@libdir@ 5 | includedir=@includedir@/coin-or 6 | 7 | Name: @PACKAGE_NAME@ 8 | Description: COIN-OR Open Solver Interface 9 | URL: @PACKAGE_URL@ 10 | Version: @PACKAGE_VERSION@ 11 | Cflags: -I${includedir} 12 | @COIN_STATIC_BUILD_FALSE@Libs: -L${libdir} -lOsi 13 | @COIN_STATIC_BUILD_FALSE@Requires.private: @OSILIB_PCFILES@ 14 | @COIN_STATIC_BUILD_TRUE@Libs: -L${libdir} -lOsi @OSILIB_LFLAGS_NOPC@ 15 | @COIN_STATIC_BUILD_TRUE@Requires: @OSILIB_PCFILES@ 16 | -------------------------------------------------------------------------------- /src/Osi/format-source.sh: -------------------------------------------------------------------------------- 1 | # script to format source code and include (if not included yet), 2 | # vim formatting settings (which are automatically loaded by vim) 3 | # Haroldo - 2019 4 | 5 | for file in *.[ch]pp; 6 | do 7 | sourceName=`basename $file` 8 | echo formatting "$sourceName" 9 | clang-format -i -style=file $file 10 | 11 | # adding vim modeline if not included yet 12 | if ! grep -q "/* vi: softtabstop=" $file; then 13 | echo '' >> $file 14 | echo '/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2' >> $file 15 | echo '*/' >> $file 16 | fi 17 | done 18 | -------------------------------------------------------------------------------- /src/OsiCpx/format-source.sh: -------------------------------------------------------------------------------- 1 | # script to format source code and include (if not included yet), 2 | # vim formatting settings (which are automatically loaded by vim) 3 | # Haroldo - 2019 4 | 5 | for file in *.[ch]pp; 6 | do 7 | sourceName=`basename $file` 8 | echo formatting "$sourceName" 9 | clang-format -i -style=file $file 10 | 11 | # adding vim modeline if not included yet 12 | if ! grep -q "/* vi: softtabstop=" $file; then 13 | echo '' >> $file 14 | echo '/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2' >> $file 15 | echo '*/' >> $file 16 | fi 17 | done 18 | -------------------------------------------------------------------------------- /src/OsiGrb/format-source.sh: -------------------------------------------------------------------------------- 1 | # script to format source code and include (if not included yet), 2 | # vim formatting settings (which are automatically loaded by vim) 3 | # Haroldo - 2019 4 | 5 | for file in *.[ch]pp; 6 | do 7 | sourceName=`basename $file` 8 | echo formatting "$sourceName" 9 | clang-format -i -style=file $file 10 | 11 | # adding vim modeline if not included yet 12 | if ! grep -q "/* vi: softtabstop=" $file; then 13 | echo '' >> $file 14 | echo '/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2' >> $file 15 | echo '*/' >> $file 16 | fi 17 | done 18 | -------------------------------------------------------------------------------- /src/OsiXpr/format-source.sh: -------------------------------------------------------------------------------- 1 | # script to format source code and include (if not included yet), 2 | # vim formatting settings (which are automatically loaded by vim) 3 | # Haroldo - 2019 4 | 5 | for file in *.[ch]pp; 6 | do 7 | sourceName=`basename $file` 8 | echo formatting "$sourceName" 9 | clang-format -i -style=file $file 10 | 11 | # adding vim modeline if not included yet 12 | if ! grep -q "/* vi: softtabstop=" $file; then 13 | echo '' >> $file 14 | echo '/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2' >> $file 15 | echo '*/' >> $file 16 | fi 17 | done 18 | -------------------------------------------------------------------------------- /src/OsiGlpk/format-source.sh: -------------------------------------------------------------------------------- 1 | # script to format source code and include (if not included yet), 2 | # vim formatting settings (which are automatically loaded by vim) 3 | # Haroldo - 2019 4 | 5 | for file in *.[ch]pp; 6 | do 7 | sourceName=`basename $file` 8 | echo formatting "$sourceName" 9 | clang-format -i -style=file $file 10 | 11 | # adding vim modeline if not included yet 12 | if ! grep -q "/* vi: softtabstop=" $file; then 13 | echo '' >> $file 14 | echo '/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2' >> $file 15 | echo '*/' >> $file 16 | fi 17 | done 18 | -------------------------------------------------------------------------------- /src/OsiCpx/osi-cplex.pc.in: -------------------------------------------------------------------------------- 1 | @COIN_RELOCATABLE_FALSE@prefix=@prefix@ 2 | @COIN_RELOCATABLE_TRUE@prefix=${pcfiledir}/../.. 3 | exec_prefix=@exec_prefix@ 4 | libdir=@libdir@ 5 | includedir=@includedir@/coin-or 6 | 7 | Name: OsiCplex 8 | Description: COIN-OR Open Solver Interface for CPLEX 9 | URL: @PACKAGE_URL@ 10 | Version: @PACKAGE_VERSION@ 11 | Cflags: -I${includedir} 12 | @COIN_STATIC_BUILD_FALSE@Libs: -L${libdir} -lOsiCpx 13 | @COIN_STATIC_BUILD_FALSE@Requires.private: @OSICPXLIB_PCFILES@ 14 | @COIN_STATIC_BUILD_TRUE@Libs: -L${libdir} -lOsiCpx @OSICPXLIB_LFLAGS_NOPC@ 15 | @COIN_STATIC_BUILD_TRUE@Requires: @OSICPXLIB_PCFILES@ 16 | -------------------------------------------------------------------------------- /src/OsiMsk/osi-mosek.pc.in: -------------------------------------------------------------------------------- 1 | @COIN_RELOCATABLE_FALSE@prefix=@prefix@ 2 | @COIN_RELOCATABLE_TRUE@prefix=${pcfiledir}/../.. 3 | exec_prefix=@exec_prefix@ 4 | libdir=@libdir@ 5 | includedir=@includedir@/coin-or 6 | 7 | Name: OsiMosek 8 | Description: COIN-OR Open Solver Interface for Mosek 9 | URL: @PACKAGE_URL@ 10 | Version: @PACKAGE_VERSION@ 11 | Cflags: -I${includedir} 12 | @COIN_STATIC_BUILD_FALSE@Libs: -L${libdir} -lOsiMsk 13 | @COIN_STATIC_BUILD_FALSE@Requires.private: @OSIMSKLIB_PCFILES@ 14 | @COIN_STATIC_BUILD_TRUE@Libs: -L${libdir} -lOsiMsk @OSIMSKLIB_LFLAGS_NOPC@ 15 | @COIN_STATIC_BUILD_TRUE@Requires: @OSIMSKLIB_PCFILES@ 16 | -------------------------------------------------------------------------------- /src/OsiGlpk/osi-glpk.pc.in: -------------------------------------------------------------------------------- 1 | @COIN_RELOCATABLE_FALSE@prefix=@prefix@ 2 | @COIN_RELOCATABLE_TRUE@prefix=${pcfiledir}/../.. 3 | exec_prefix=@exec_prefix@ 4 | libdir=@libdir@ 5 | includedir=@includedir@/coin-or 6 | 7 | Name: OsiGlpk 8 | Description: COIN-OR Open Solver Interface for GLPK 9 | URL: @PACKAGE_URL@ 10 | Version: @PACKAGE_VERSION@ 11 | Cflags: -I${includedir} 12 | @COIN_STATIC_BUILD_FALSE@Libs: -L${libdir} -lOsiGlpk 13 | @COIN_STATIC_BUILD_FALSE@Requires.private: @OSIGLPKLIB_PCFILES@ 14 | @COIN_STATIC_BUILD_TRUE@Libs: -L${libdir} -lOsiGlpk @OSIGLPKLIB_LFLAGS_NOPC@ 15 | @COIN_STATIC_BUILD_TRUE@Requires: @OSIGLPKLIB_PCFILES@ 16 | -------------------------------------------------------------------------------- /src/OsiGrb/osi-gurobi.pc.in: -------------------------------------------------------------------------------- 1 | @COIN_RELOCATABLE_FALSE@prefix=@prefix@ 2 | @COIN_RELOCATABLE_TRUE@prefix=${pcfiledir}/../.. 3 | exec_prefix=@exec_prefix@ 4 | libdir=@libdir@ 5 | includedir=@includedir@/coin-or 6 | 7 | Name: OsiGurobi 8 | Description: COIN-OR Open Solver Interface for Gurobi 9 | URL: @PACKAGE_URL@ 10 | Version: @PACKAGE_VERSION@ 11 | Cflags: -I${includedir} 12 | @COIN_STATIC_BUILD_FALSE@Libs: -L${libdir} -lOsiGrb 13 | @COIN_STATIC_BUILD_FALSE@Requires.private: @OSIGRBLIB_PCFILES@ 14 | @COIN_STATIC_BUILD_TRUE@Libs: -L${libdir} -lOsiGrb @OSIGRBLIB_LFLAGS_NOPC@ 15 | @COIN_STATIC_BUILD_TRUE@Requires: @OSIGRBLIB_PCFILES@ 16 | -------------------------------------------------------------------------------- /src/OsiSpx/osi-soplex.pc.in: -------------------------------------------------------------------------------- 1 | @COIN_RELOCATABLE_FALSE@prefix=@prefix@ 2 | @COIN_RELOCATABLE_TRUE@prefix=${pcfiledir}/../.. 3 | exec_prefix=@exec_prefix@ 4 | libdir=@libdir@ 5 | includedir=@includedir@/coin-or 6 | 7 | Name: OsiSoplex 8 | Description: COIN-OR Open Solver Interface for SoPlex 9 | URL: @PACKAGE_URL@ 10 | Version: @PACKAGE_VERSION@ 11 | Cflags: -I${includedir} 12 | @COIN_STATIC_BUILD_FALSE@Libs: -L${libdir} -lOsiSpx 13 | @COIN_STATIC_BUILD_FALSE@Requires.private: @OSISPXLIB_PCFILES@ 14 | @COIN_STATIC_BUILD_TRUE@Libs: -L${libdir} -lOsiSpx @OSISPXLIB_LFLAGS_NOPC@ 15 | @COIN_STATIC_BUILD_TRUE@Requires: @OSISPXLIB_PCFILES@ 16 | -------------------------------------------------------------------------------- /src/OsiXpr/osi-xpress.pc.in: -------------------------------------------------------------------------------- 1 | @COIN_RELOCATABLE_FALSE@prefix=@prefix@ 2 | @COIN_RELOCATABLE_TRUE@prefix=${pcfiledir}/../.. 3 | exec_prefix=@exec_prefix@ 4 | libdir=@libdir@ 5 | includedir=@includedir@/coin-or 6 | 7 | Name: OsiXpress 8 | Description: COIN-OR Open Solver Interface for Xpress 9 | URL: @PACKAGE_URL@ 10 | Version: @PACKAGE_VERSION@ 11 | Cflags: -I${includedir} 12 | @COIN_STATIC_BUILD_FALSE@Libs: -L${libdir} -lOsiXpr 13 | @COIN_STATIC_BUILD_FALSE@Requires.private: @OSIXPRLIB_PCFILES@ 14 | @COIN_STATIC_BUILD_TRUE@Libs: -L${libdir} -lOsiXpr @OSIXPRLIB_LFLAGS_NOPC@ 15 | @COIN_STATIC_BUILD_TRUE@Requires: @OSIXPRLIB_PCFILES@ 16 | -------------------------------------------------------------------------------- /osi-unittests.pc.in: -------------------------------------------------------------------------------- 1 | @COIN_RELOCATABLE_FALSE@prefix=@prefix@ 2 | @COIN_RELOCATABLE_TRUE@prefix=${pcfiledir}/../.. 3 | exec_prefix=@exec_prefix@ 4 | libdir=@libdir@ 5 | includedir=@includedir@/coin-or 6 | 7 | Name: OsiUnitTests 8 | Description: COIN-OR Open Solver Interface Common Unit Tests 9 | URL: @PACKAGE_URL@ 10 | Version: @PACKAGE_VERSION@ 11 | Cflags: -I${includedir} 12 | @COIN_STATIC_BUILD_FALSE@Libs: -L${libdir} -lOsiCommonTest 13 | @COIN_STATIC_BUILD_FALSE@Requires.private: osi @OSICOMMONTESTLIB_PCFILES@ 14 | @COIN_STATIC_BUILD_TRUE@Libs: -L${libdir} -lOsiCommonTest @OSICOMMONTESTLIB_LFLAGS_NOPC@ 15 | @COIN_STATIC_BUILD_TRUE@Requires: osi @OSICOMMONTESTLIB_PCFILES@ 16 | -------------------------------------------------------------------------------- /test/OsiTestSolverInterfaceTest.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2000, International Business Machines 2 | // Corporation and others. All Rights Reserved. 3 | // This file is licensed under the terms of Eclipse Public License (EPL). 4 | 5 | #include "OsiTestSolverInterface.hpp" 6 | #include "OsiUnitTests.hpp" 7 | 8 | //############################################################################# 9 | 10 | //-------------------------------------------------------------------------- 11 | void 12 | OsiTestSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir) 13 | { 14 | 15 | // Do common solverInterface testing 16 | { 17 | OsiTestSolverInterface m; 18 | OsiSolverInterfaceCommonUnitTest(&m, mpsDir, netlibDir); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/Osi/config_osi_default.h: -------------------------------------------------------------------------------- 1 | 2 | /***************************************************************************/ 3 | /* HERE DEFINE THE PROJECT SPECIFIC PUBLIC MACROS */ 4 | /* These are only in effect in a setting that doesn't use configure */ 5 | /***************************************************************************/ 6 | 7 | /* Version number of project */ 8 | #define OSI_VERSION "trunk" 9 | 10 | /* Major Version number of project */ 11 | #define OSI_VERSION_MAJOR 9999 12 | 13 | /* Minor Version number of project */ 14 | #define OSI_VERSION_MINOR 9999 15 | 16 | /* Release Version number of project */ 17 | #define OSI_VERSION_RELEASE 9999 18 | 19 | #ifndef OSILIB_EXPORT 20 | #if defined(_WIN32) && defined(DLL_EXPORT) 21 | #define OSILIB_EXPORT __declspec(dllimport) 22 | #else 23 | #define OSILIB_EXPORT 24 | #endif 25 | #endif 26 | -------------------------------------------------------------------------------- /MSVisualStudio/v9alt/osi.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 16 | 21 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /src/Osi/OsiCollections.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2000, International Business Machines 2 | // Corporation and others. All Rights Reserved. 3 | // This code is licensed under the terms of the Eclipse Public License (EPL). 4 | 5 | #ifndef OsiCollections_H 6 | #define OsiCollections_H 7 | 8 | #include 9 | 10 | //Forward declarations 11 | class OsiColCut; 12 | class OsiRowCut; 13 | class OsiCut; 14 | 15 | /* Collection Classes */ 16 | 17 | /**@name Typedefs for Standard Template Library collections of Osi Objects. */ 18 | //@{ 19 | /// Vector of int 20 | typedef std::vector< int > OsiVectorInt; 21 | /// Vector of double 22 | typedef std::vector< double > OsiVectorDouble; 23 | /// Vector of OsiColCut pointers 24 | typedef std::vector< OsiColCut * > OsiVectorColCutPtr; 25 | /// Vector of OsiRowCut pointers 26 | typedef std::vector< OsiRowCut * > OsiVectorRowCutPtr; 27 | /// Vector of OsiCut pointers 28 | typedef std::vector< OsiCut * > OsiVectorCutPtr; 29 | //@} 30 | 31 | #endif 32 | 33 | /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2 34 | */ 35 | -------------------------------------------------------------------------------- /examples/basic.cpp: -------------------------------------------------------------------------------- 1 | // Bare bones example of using COIN-OR OSI 2 | 3 | #include 4 | #include OSIXXXhpp 5 | 6 | int 7 | main(void) 8 | { 9 | // Create a problem pointer. We use the base class here. 10 | OsiSolverInterface *si; 11 | 12 | // When we instantiate the object, we need a specific derived class. 13 | si = new OSIXXX; 14 | 15 | // Read in an mps file. This one's from the MIPLIB library. 16 | #if defined(SAMPLEDIR) 17 | si->readMps(SAMPLEDIR "/p0033"); 18 | #else 19 | fprintf(stderr, "Do not know where to find sample MPS files.\n"); 20 | exit(1); 21 | #endif 22 | 23 | // Solve the (relaxation of the) problem 24 | si->initialSolve(); 25 | 26 | // Check the solution 27 | if ( si->isProvenOptimal() ) { 28 | std::cout << "Found optimal solution!" << std::endl; 29 | std::cout << "Objective value is " << si->getObjValue() << std::endl; 30 | 31 | int n = si->getNumCols(); 32 | const double* solution = si->getColSolution(); 33 | 34 | // We can then print the solution or could examine it. 35 | for( int i = 0; i < n && i < 5; ++i ) 36 | std::cout << si->getColName(i) << " = " << solution[i] << std::endl; 37 | if( 5 < n ) 38 | std::cout << "..." << std::endl; 39 | } else { 40 | std::cout << "Didn't find optimal solution." << std::endl; 41 | // Could then check other status functions. 42 | } 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /src/Osi/config_default.h: -------------------------------------------------------------------------------- 1 | 2 | /* include the COIN-OR-wide system specific configure header */ 3 | #include "configall_system.h" 4 | 5 | /* this needs to come before the include of config_osi_default.h */ 6 | #ifndef OSILIB_EXPORT 7 | #if defined(_WIN32) && defined(DLL_EXPORT) 8 | #define OSILIB_EXPORT __declspec(dllexport) 9 | #else 10 | #define OSILIB_EXPORT 11 | #endif 12 | #endif 13 | 14 | /* include the public project specific macros */ 15 | #include "config_osi_default.h" 16 | 17 | /***************************************************************************/ 18 | /* HERE DEFINE THE PROJECT SPECIFIC MACROS */ 19 | /* These are only in effect in a setting that doesn't use configure */ 20 | /***************************************************************************/ 21 | 22 | /* Define to 1 if the CoinUtils package is used. 23 | * Don't undef this unless you really know what you're doing. 24 | */ 25 | #define OSI_HAS_COINUTILS 1 26 | 27 | /* Define to 1 if the Cplex package is used */ 28 | /* #define OSI_HAS_CPLEX 1 */ 29 | 30 | /* Define to 1 if the Glpk package is used */ 31 | /* #define OSI_HAS_GLPK 1 */ 32 | 33 | /* Define to 1 if the Gurobi package is used */ 34 | /* #define OSI_HAS_GUROBI 1 */ 35 | 36 | /* Define to 1 if the Mosek package is used */ 37 | /* #define OSI_HAS_MOSEK 1 */ 38 | 39 | /* Define to 1 if the SoPlex package is used */ 40 | /* #define OSI_HAS_SOPLEX 1 */ 41 | 42 | /* Define to 1 if the Xpress package is used */ 43 | /* #define OSI_HAS_XPRESS 1 */ 44 | -------------------------------------------------------------------------------- /MSVisualStudio/v16/libOsi/libOsi.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29025.244 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsi", "libOsi.vcxproj", "{BF5C7532-EE0A-479B-9993-72134087D530}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {BF5C7532-EE0A-479B-9993-72134087D530}.Debug|x64.ActiveCfg = Debug|x64 17 | {BF5C7532-EE0A-479B-9993-72134087D530}.Debug|x64.Build.0 = Debug|x64 18 | {BF5C7532-EE0A-479B-9993-72134087D530}.Debug|x86.ActiveCfg = Debug|Win32 19 | {BF5C7532-EE0A-479B-9993-72134087D530}.Debug|x86.Build.0 = Debug|Win32 20 | {BF5C7532-EE0A-479B-9993-72134087D530}.Release|x64.ActiveCfg = Release|x64 21 | {BF5C7532-EE0A-479B-9993-72134087D530}.Release|x64.Build.0 = Release|x64 22 | {BF5C7532-EE0A-479B-9993-72134087D530}.Release|x86.ActiveCfg = Release|Win32 23 | {BF5C7532-EE0A-479B-9993-72134087D530}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {8D3882F5-D354-4362-9A7F-A5393F116053} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /MSVisualStudio/v10alt/osi.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | yes 8 | $(CoinRoot)\Osi\Osi\src\Osi 9 | $(CoinRoot)\Osi\Osi\src\OsiCommonTest 10 | 11 | 12 | <_ProjectFileVersion>10.0.30319.1 13 | 14 | 15 | 16 | $(OsiIncludeDir);%(AdditionalIncludeDirectories) 17 | 18 | 19 | %(AdditionalLibraryDirectories) 20 | 21 | 22 | libOsi.lib;%(AdditionalDependencies) 23 | 24 | 25 | 26 | 27 | $(Have_Osi_Props) 28 | 29 | 30 | $(OsiIncludeDir) 31 | 32 | 33 | $(OsiCommonTestIncludeDir) 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/OsiGrb/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009 Stefan Vigerske and others. 2 | # All Rights Reserved. 3 | # This file is distributed under the Eclipse Public License. 4 | 5 | 6 | include $(top_srcdir)/BuildTools/Makemain.inc 7 | 8 | ######################################################################## 9 | # libOsiGrb 10 | ######################################################################## 11 | 12 | # Name of the library compiled in this directory. 13 | lib_LTLIBRARIES = libOsiGrb.la 14 | 15 | # List all source files for this library, including headers 16 | libOsiGrb_la_SOURCES = OsiGrbSolverInterface.cpp OsiGrbSolverInterface.hpp 17 | 18 | # List all additionally required libraries 19 | libOsiGrb_la_LIBADD = ../Osi/libOsi.la $(OSIGRBLIB_LFLAGS) 20 | 21 | # This is for libtool (on Windows) 22 | AM_LDFLAGS = $(LT_LDFLAGS) 23 | 24 | # Here list all include flags, relative to this "srcdir" directory. 25 | AM_CPPFLAGS = -I$(srcdir)/../Osi $(OSIGRBLIB_CFLAGS) 26 | 27 | ######################################################################## 28 | # Headers that need to be installed # 29 | ######################################################################## 30 | 31 | # Here list all the header files that are required by a user of the library, 32 | # and that therefore should be installed in 'include/coin-or' 33 | includecoindir = $(pkgincludedir) 34 | includecoin_HEADERS = OsiGrbSolverInterface.hpp 35 | 36 | install-exec-local: 37 | $(install_sh_DATA) config_osigrb.h $(DESTDIR)$(includecoindir)/OsiGrbConfig.h 38 | 39 | uninstall-local: 40 | rm -f $(DESTDIR)$(includecoindir)/OsiGrbConfig.h 41 | -------------------------------------------------------------------------------- /src/OsiSpx/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2006 International Business Machines and others. 2 | # All Rights Reserved. 3 | # This file is distributed under the Eclipse Public License. 4 | 5 | 6 | include $(top_srcdir)/BuildTools/Makemain.inc 7 | 8 | ######################################################################## 9 | # libOsiSpx # 10 | ######################################################################## 11 | 12 | # Name of the library compiled in this directory. 13 | lib_LTLIBRARIES = libOsiSpx.la 14 | 15 | # List all source files for this library, including headers 16 | libOsiSpx_la_SOURCES = OsiSpxSolverInterface.cpp OsiSpxSolverInterface.hpp 17 | 18 | # List all additionally required libraries 19 | libOsiSpx_la_LIBADD = ../Osi/libOsi.la $(OSISPXLIB_LFLAGS) 20 | 21 | # This is for libtool 22 | AM_LDFLAGS = $(LT_LDFLAGS) 23 | 24 | # Here list all include flags, relative to this "srcdir" directory. 25 | AM_CPPFLAGS = -I$(srcdir)/../Osi $(OSISPXLIB_CFLAGS) 26 | 27 | ######################################################################## 28 | # Headers that need to be installed # 29 | ######################################################################## 30 | 31 | # Here list all the header files that are required by a user of the library, 32 | # and that therefore should be installed in 'include/coin-or' 33 | includecoindir = $(pkgincludedir) 34 | includecoin_HEADERS = OsiSpxSolverInterface.hpp 35 | 36 | install-exec-local: 37 | $(install_sh_DATA) config_osispx.h $(DESTDIR)$(includecoindir)/OsiSpxConfig.h 38 | 39 | uninstall-local: 40 | rm -f $(DESTDIR)$(includecoindir)/OsiSpxConfig.h 41 | -------------------------------------------------------------------------------- /examples/opbdp_solve.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006, International Business Machines 2 | // Corporation and others. All Rights Reserved. 3 | #ifndef OsiOpbdpSolve_H 4 | #define OsiOpbdpSolve_H 5 | 6 | #include 7 | 8 | #include "OsiSolverInterface.hpp" 9 | 10 | /** Solve pure 0-1 with integral coefficients etc (or can be made by scaling) using opdbp 11 | The solution will be set in model 12 | If no solution then returns 0, if not suitable returns -1 13 | */ 14 | int solveOpbdp(OsiSolverInterface * model); 15 | /** Find all solutions of a pure 0-1 with integral coefficients etc (or can be made by scaling) using opdbp 16 | Returns an array of bit solution vectors. 17 | i is 1 if bit set (see below) 18 | If no solution then numberFound will be 0, if not suitable -1 19 | 20 | This needs the line at about 206 of EnumerateOpt.cpp 21 | 22 | local_maximum = value + 1; // try to reach that one! 23 | 24 | replaced by 25 | 26 | if (verbosity!=-1) { 27 | local_maximum = value + 1; // try to reach that one! 28 | } else { 29 | local_maximum = 0; 30 | void opbdp_save_solution(OrdInt & sol); 31 | OrdInt sol = last_solution.to_OrdInt(); 32 | opbdp_save_solution(sol); // save solution 33 | } 34 | */ 35 | unsigned int ** solveOpbdp(const OsiSolverInterface * model,int & numberFound); 36 | 37 | inline bool atOne(int i,unsigned int * array) { 38 | return ((array[i>>5]>>(i&31))&1)!=0; 39 | } 40 | inline void setAtOne(int i,unsigned int * array,bool trueFalse) { 41 | unsigned int & value = array[i>>5]; 42 | int bit = i&31; 43 | if (trueFalse) 44 | value |= (1< ^ ^ 28 | echo INFO: where ^ contains the executables, sampledir the sample files and netlibdir the netlib files. 29 | echo INFO: This script runs automated test. 30 | echo INFO: The ^ and ^ must not contain spaces! 31 | echo INFO: For example: %0 "D:\Some Directory\" ..\..\samples\ "..\..\netlib" 32 | goto :error 33 | 34 | :error 35 | echo ERROR: An error occurred while running the tests! 36 | echo INFO: Finished Tests but failed 37 | exit /b 1 38 | 39 | :test 40 | echo INFO: Starting Tests 41 | 42 | "%BINDIR%\osiUnitTest.exe" -mpsDir=%SAMPLEDIR% -netlibDir=%NETLIBDIR% -testOsiSolverInterface 43 | if not %errorlevel%==0 echo ERROR: Error running osiUnitTest.exe tests. && goto :error 44 | 45 | echo INFO: Finished Tests successfully (%ERRORLEVEL%) -------------------------------------------------------------------------------- /src/Osi/OsiConfig.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 2 | * All Rights Reserved. 3 | * This code is published under the Eclipse Public License. 4 | * 5 | * 6 | * Include file for the configuration of Osi. 7 | * 8 | * On systems where the code is configured with the configure script 9 | * (i.e., compilation is always done with HAVE_CONFIG_H defined), this 10 | * header file includes the automatically generated header file. 11 | * 12 | * On systems that are compiled in other ways (e.g., with the 13 | * Developer Studio), a header file is included to define those 14 | * macros that depend on the operating system and the compiler. The 15 | * macros that define the configuration of the particular user setting 16 | * (e.g., presence of other COIN-OR packages or third party code) are set 17 | * by the files config_*default.h. The project maintainer needs to remember 18 | * to update these files and choose reasonable defines. 19 | * A user can modify the default setting by editing the config_*default.h 20 | * files. 21 | */ 22 | 23 | #ifndef __OSICONFIG_H__ 24 | #define __OSICONFIG_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #ifdef OSILIB_BUILD 28 | #include "config.h" 29 | 30 | /* overwrite OSILIB_EXPORT from config.h when building Osi 31 | * we want it to be __declspec(dllexport) when building a DLL on Windows 32 | * we want it to be __attribute__((__visibility__("default"))) when building with GCC, 33 | * so user can compile with -fvisibility=hidden 34 | */ 35 | #ifdef DLL_EXPORT 36 | #undef OSILIB_EXPORT 37 | #define OSILIB_EXPORT __declspec(dllexport) 38 | #elif defined(__GNUC__) && __GNUC__ >= 4 39 | #undef OSILIB_EXPORT 40 | #define OSILIB_EXPORT __attribute__((__visibility__("default"))) 41 | #endif 42 | 43 | #else 44 | #include "config_osi.h" 45 | #endif 46 | 47 | #else /* HAVE_CONFIG_H */ 48 | 49 | #ifdef OSILIB_BUILD 50 | #include "config_default.h" 51 | #else 52 | #include "config_osi_default.h" 53 | #endif 54 | 55 | #endif /* HAVE_CONFIG_H */ 56 | 57 | #endif /*__OSICONFIG_H__*/ 58 | -------------------------------------------------------------------------------- /src/OsiGlpk/OsiGlpkConfig.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 2 | * All Rights Reserved. 3 | * This code is published under the Eclipse Public License. 4 | * 5 | * Include file for the configuration of OsiCommonTest. 6 | * 7 | * On systems where the code is configured with the configure script 8 | * (i.e., compilation is always done with HAVE_CONFIG_H defined), this 9 | * header file includes the automatically generated header file. 10 | * 11 | * On systems that are compiled in other ways (e.g., with the 12 | * Developer Studio), a header file is included to define those 13 | * macros that depend on the operating system and the compiler. The 14 | * macros that define the configuration of the particular user setting 15 | * (e.g., presence of other COIN-OR packages or third party code) are set 16 | * by the files config_*default.h. The project maintainer needs to remember 17 | * to update these files and choose reasonable defines. 18 | * A user can modify the default setting by editing the config_*default.h 19 | * files. 20 | */ 21 | 22 | #ifndef __OSIGLPKCONFIG_H__ 23 | #define __OSIGLPKCONFIG_H__ 24 | 25 | #ifdef HAVE_CONFIG_H 26 | #ifdef OSIGLPKLIB_BUILD 27 | 28 | #ifdef DLL_EXPORT 29 | # define OSIGLPKLIB_EXPORT __declspec(dllexport) 30 | #elif defined(__GNUC__) && __GNUC__ >= 4 31 | # define OSIGLPKLIB_EXPORT __attribute__((__visibility__("default"))) 32 | #else 33 | # define OSIGLPKLIB_EXPORT 34 | #endif 35 | 36 | #else 37 | #include "config_osiglpk.h" 38 | #endif 39 | 40 | #else /* HAVE_CONFIG_H */ 41 | 42 | 43 | #ifndef OSIGLPKLIB_EXPORT 44 | # if defined(_WIN32) && defined(DLL_EXPORT) 45 | # ifdef OSIGLPKLIB_BUILD 46 | # define OSIGLPKLIB_EXPORT __declspec(dllexport) 47 | # else 48 | # define OSIGLPKLIB_EXPORT __declspec(dllimport) 49 | # endif 50 | # elif defined(__GNUC__) && __GNUC__ >= 4 51 | # define OSIGLPKLIB_EXPORT __attribute__((__visibility__("default"))) 52 | # endif 53 | #endif 54 | 55 | 56 | #endif /* HAVE_CONFIG_H */ 57 | 58 | #endif /*__OSIGLPKCONFIG_H__*/ 59 | -------------------------------------------------------------------------------- /src/OsiCpx/OsiCpxConfig.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 2 | * All Rights Reserved. 3 | * This code is published under the Eclipse Public License. 4 | * 5 | * Include file for the configuration of OsiCpx. 6 | * 7 | * On systems where the code is configured with the configure script 8 | * (i.e., compilation is always done with HAVE_CONFIG_H defined), this 9 | * header file includes the automatically generated header file. 10 | * 11 | * On systems that are compiled in other ways (e.g., with the 12 | * Developer Studio), a header file is included to define those 13 | * macros that depend on the operating system and the compiler. The 14 | * macros that define the configuration of the particular user setting 15 | * (e.g., presence of other COIN-OR packages or third party code) are set 16 | * by the files config_*default.h. The project maintainer needs to remember 17 | * to update these files and choose reasonable defines. 18 | * A user can modify the default setting by editing the config_*default.h 19 | * files. 20 | */ 21 | 22 | #ifndef __OSICPXCONFIG_H__ 23 | #define __OSICPXCONFIG_H__ 24 | 25 | #ifdef HAVE_CONFIG_H 26 | #ifdef OSICPXLIB_BUILD 27 | 28 | #ifdef DLL_EXPORT 29 | # define OSICPXLIB_EXPORT __declspec(dllexport) 30 | #elif defined(__GNUC__) && __GNUC__ >= 4 31 | # define OSICPXLIB_EXPORT __attribute__((__visibility__("default"))) 32 | #else 33 | # define OSICPXLIB_EXPORT 34 | #endif 35 | 36 | #else 37 | #include "config_osicpx.h" 38 | #endif 39 | 40 | #else /* HAVE_CONFIG_H */ 41 | 42 | 43 | #ifndef OSICPXLIB_EXPORT 44 | #if defined(_WIN32) && defined(DLL_EXPORT) 45 | # ifdef OSICPXLIB_BUILD 46 | # define OSICPXLIB_EXPORT __declspec(dllexport) 47 | # else 48 | # define OSICPXLIB_EXPORT __declspec(dllimport) 49 | # endif 50 | # elif defined(__GNUC__) && __GNUC__ >= 4 51 | # define OSICPXLIB_EXPORT __attribute__((__visibility__("default"))) 52 | # else 53 | # define OSICPXLIB_EXPORT 54 | # endif 55 | #endif 56 | 57 | 58 | #endif /* HAVE_CONFIG_H */ 59 | 60 | #endif /*__OSICPXCONFIG_H__*/ 61 | -------------------------------------------------------------------------------- /src/OsiCommonTest/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2006 International Business Machines and others. 2 | # All Rights Reserved. 3 | # This file is distributed under the Eclipse Public License. 4 | # 5 | # Author: Lou Hafer SFU 2010-11-20 6 | 7 | include $(top_srcdir)/BuildTools/Makemain.inc 8 | 9 | ######################################################################## 10 | # Common Test library for Osi # 11 | ######################################################################## 12 | 13 | # Name of the library compiled in this directory. We want it to be installed 14 | # in $libdir 15 | lib_LTLIBRARIES = libOsiCommonTest.la 16 | 17 | # List all source files for this library, including headers 18 | libOsiCommonTest_la_SOURCES = \ 19 | OsiCommonTest.hpp \ 20 | OsiColCutTest.cpp \ 21 | OsiCutsTest.cpp \ 22 | OsiRowCutDebuggerTest.cpp \ 23 | OsiRowCutTest.cpp \ 24 | OsiSimplexAPITest.cpp \ 25 | OsiNetlibTest.cpp \ 26 | OsiUnitTestUtils.cpp \ 27 | OsiSolverInterfaceTest.cpp 28 | 29 | # List all additionally required libraries 30 | libOsiCommonTest_la_LIBADD = $(OSICOMMONTESTLIB_LFLAGS) ../Osi/libOsi.la 31 | 32 | # Libtool flags 33 | AM_LDFLAGS = $(LT_LDFLAGS) 34 | 35 | # Here list all include flags, relative to this "srcdir" directory. 36 | AM_CPPFLAGS = -I$(srcdir)/../Osi $(OSICOMMONTESTLIB_CFLAGS) 37 | 38 | ######################################################################## 39 | # Headers that need to be installed # 40 | ######################################################################## 41 | 42 | # Here list all the header files that are required by a user of the library, 43 | # and that therefore should be installed in pkgincludedir 44 | includecoindir = $(pkgincludedir) 45 | includecoin_HEADERS = OsiUnitTests.hpp 46 | 47 | install-exec-local: 48 | $(install_sh_DATA) config_osicommontest.h $(DESTDIR)$(includecoindir)/OsiUnitTestsConfig.h 49 | 50 | uninstall-local: 51 | rm -f $(DESTDIR)$(includecoindir)/OsiUnitTestsConfig.h 52 | -------------------------------------------------------------------------------- /src/OsiGrb/OsiGrbConfig.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 2 | * All Rights Reserved. 3 | * This code is published under the Eclipse Public License. 4 | * 5 | * Include file for the configuration of OsiCommonTest. 6 | * 7 | * On systems where the code is configured with the configure script 8 | * (i.e., compilation is always done with HAVE_CONFIG_H defined), this 9 | * header file includes the automatically generated header file. 10 | * 11 | * On systems that are compiled in other ways (e.g., with the 12 | * Developer Studio), a header file is included to define those 13 | * macros that depend on the operating system and the compiler. The 14 | * macros that define the configuration of the particular user setting 15 | * (e.g., presence of other COIN-OR packages or third party code) are set 16 | * by the files config_*default.h. The project maintainer needs to remember 17 | * to update these files and choose reasonable defines. 18 | * A user can modify the default setting by editing the config_*default.h 19 | * files. 20 | */ 21 | 22 | #ifndef __OSIGRBCONFIG_H__ 23 | #define __OSIGRBCONFIG_H__ 24 | 25 | #ifdef HAVE_CONFIG_H 26 | #ifdef OSIGRBLIB_BUILD 27 | 28 | #ifdef DLL_EXPORT 29 | # define OSIGRBLIB_EXPORT __declspec(dllexport) 30 | #elif defined(__GNUC__) && __GNUC__ >= 4 31 | # define OSIGRBLIB_EXPORT __attribute__((__visibility__("default"))) 32 | #else 33 | # define OSIGRBLIB_EXPORT 34 | #endif 35 | 36 | #else 37 | #include "config_osigrb.h" 38 | #endif 39 | 40 | #else /* HAVE_CONFIG_H */ 41 | 42 | 43 | #ifndef OSIGRBLIB_EXPORT 44 | # if defined(_WIN32) && defined(DLL_EXPORT) 45 | # ifdef OSIGRBLIB_BUILD 46 | # define OSIGRBLIB_EXPORT __declspec(dllexport) 47 | # else 48 | # define OSIGRBLIB_EXPORT __declspec(dllimport) 49 | # endif 50 | # elif defined(__GNUC__) && __GNUC__ >= 4 51 | # define OSIGRBLIB_EXPORT __attribute__((__visibility__("default"))) 52 | # else 53 | # define OSIGRBLIB_EXPORT 54 | # endif 55 | #endif 56 | 57 | 58 | #endif /* HAVE_CONFIG_H */ 59 | 60 | #endif /*__OSIGRBCONFIG_H__*/ 61 | -------------------------------------------------------------------------------- /src/OsiMsk/OsiMskConfig.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 2 | * All Rights Reserved. 3 | * This code is published under the Eclipse Public License. 4 | * 5 | * Include file for the configuration of OsiCommonTest. 6 | * 7 | * On systems where the code is configured with the configure script 8 | * (i.e., compilation is always done with HAVE_CONFIG_H defined), this 9 | * header file includes the automatically generated header file. 10 | * 11 | * On systems that are compiled in other ways (e.g., with the 12 | * Developer Studio), a header file is included to define those 13 | * macros that depend on the operating system and the compiler. The 14 | * macros that define the configuration of the particular user setting 15 | * (e.g., presence of other COIN-OR packages or third party code) are set 16 | * by the files config_*default.h. The project maintainer needs to remember 17 | * to update these files and choose reasonable defines. 18 | * A user can modify the default setting by editing the config_*default.h 19 | * files. 20 | */ 21 | 22 | #ifndef __OSIMSKCONFIG_H__ 23 | #define __OSIMSKCONFIG_H__ 24 | 25 | #ifdef HAVE_CONFIG_H 26 | #ifdef OSIMSKLIB_BUILD 27 | 28 | #ifdef DLL_EXPORT 29 | # define OSIMSKLIB_EXPORT __declspec(dllexport) 30 | #elif defined(__GNUC__) && __GNUC__ >= 4 31 | # define OSIMSKLIB_EXPORT __attribute__((__visibility__("default"))) 32 | #else 33 | # define OSIMSKLIB_EXPORT 34 | #endif 35 | 36 | #else 37 | #include "config_osimsk.h" 38 | #endif 39 | 40 | #else /* HAVE_CONFIG_H */ 41 | 42 | 43 | #ifndef OSIMSKLIB_EXPORT 44 | # if defined(_WIN32) && defined(DLL_EXPORT) 45 | # ifdef OSIMSKLIB_BUILD 46 | # define OSIMSKLIB_EXPORT __declspec(dllexport) 47 | # else 48 | # define OSIMSKLIB_EXPORT __declspec(dllimport) 49 | # endif 50 | # elif defined(__GNUC__) && __GNUC__ >= 4 51 | # define OSIMSKLIB_EXPORT __attribute__((__visibility__("default"))) 52 | # else 53 | # define OSIMSKLIB_EXPORT 54 | # endif 55 | #endif 56 | 57 | 58 | #endif /* HAVE_CONFIG_H */ 59 | 60 | #endif /*__OSIMSKCONFIG_H__*/ 61 | -------------------------------------------------------------------------------- /src/OsiSpx/OsiSpxConfig.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 2 | * All Rights Reserved. 3 | * This code is published under the Eclipse Public License. 4 | * 5 | * Include file for the configuration of OsiCommonTest. 6 | * 7 | * On systems where the code is configured with the configure script 8 | * (i.e., compilation is always done with HAVE_CONFIG_H defined), this 9 | * header file includes the automatically generated header file. 10 | * 11 | * On systems that are compiled in other ways (e.g., with the 12 | * Developer Studio), a header file is included to define those 13 | * macros that depend on the operating system and the compiler. The 14 | * macros that define the configuration of the particular user setting 15 | * (e.g., presence of other COIN-OR packages or third party code) are set 16 | * by the files config_*default.h. The project maintainer needs to remember 17 | * to update these files and choose reasonable defines. 18 | * A user can modify the default setting by editing the config_*default.h 19 | * files. 20 | */ 21 | 22 | #ifndef __OSISPXCONFIG_H__ 23 | #define __OSISPXCONFIG_H__ 24 | 25 | #ifdef HAVE_CONFIG_H 26 | #ifdef OSISPXLIB_BUILD 27 | 28 | #ifdef DLL_EXPORT 29 | # define OSISPXLIB_EXPORT __declspec(dllexport) 30 | #elif defined(__GNUC__) && __GNUC__ >= 4 31 | # define OSISPXLIB_EXPORT __attribute__((__visibility__("default"))) 32 | #else 33 | # define OSISPXLIB_EXPORT 34 | #endif 35 | 36 | #else 37 | #include "config_osispx.h" 38 | #endif 39 | 40 | #else /* HAVE_CONFIG_H */ 41 | 42 | 43 | #ifndef OSISPXLIB_EXPORT 44 | # if defined(_WIN32) && defined(DLL_EXPORT) 45 | # ifdef OSISPXLIB_BUILD 46 | # define OSISPXLIB_EXPORT __declspec(dllexport) 47 | # else 48 | # define OSISPXLIB_EXPORT __declspec(dllimport) 49 | # endif 50 | # elif defined(__GNUC__) && __GNUC__ >= 4 51 | # define OSISPXLIB_EXPORT __attribute__((__visibility__("default"))) 52 | # else 53 | # define OSISPXLIB_EXPORT 54 | # endif 55 | #endif 56 | 57 | 58 | #endif /* HAVE_CONFIG_H */ 59 | 60 | #endif /*__OSISPXCONFIG_H__*/ 61 | -------------------------------------------------------------------------------- /src/OsiXpr/OsiXprConfig.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 2 | * All Rights Reserved. 3 | * This code is published under the Eclipse Public License. 4 | * 5 | * Include file for the configuration of OsiCommonTest. 6 | * 7 | * On systems where the code is configured with the configure script 8 | * (i.e., compilation is always done with HAVE_CONFIG_H defined), this 9 | * header file includes the automatically generated header file. 10 | * 11 | * On systems that are compiled in other ways (e.g., with the 12 | * Developer Studio), a header file is included to define those 13 | * macros that depend on the operating system and the compiler. The 14 | * macros that define the configuration of the particular user setting 15 | * (e.g., presence of other COIN-OR packages or third party code) are set 16 | * by the files config_*default.h. The project maintainer needs to remember 17 | * to update these files and choose reasonable defines. 18 | * A user can modify the default setting by editing the config_*default.h 19 | * files. 20 | */ 21 | 22 | #ifndef __OSIXPRCONFIG_H__ 23 | #define __OSIXPRCONFIG_H__ 24 | 25 | #ifdef HAVE_CONFIG_H 26 | #ifdef OSIXPRLIB_BUILD 27 | 28 | #ifdef DLL_EXPORT 29 | # define OSIXPRLIB_EXPORT __declspec(dllexport) 30 | #elif defined(__GNUC__) && __GNUC__ >= 4 31 | # define OSIXPRLIB_EXPORT __attribute__((__visibility__("default"))) 32 | #else 33 | # define OSIXPRLIB_EXPORT 34 | #endif 35 | 36 | #else 37 | #include "config_osixpr.h" 38 | #endif 39 | 40 | #else /* HAVE_CONFIG_H */ 41 | 42 | 43 | #ifndef OSIXPRLIB_EXPORT 44 | # if defined(_WIN32) && defined(DLL_EXPORT) 45 | # ifdef OSIXPRLIB_BUILD 46 | # define OSIXPRLIB_EXPORT __declspec(dllexport) 47 | # else 48 | # define OSIXPRLIB_EXPORT __declspec(dllimport) 49 | # endif 50 | # elif defined(__GNUC__) && __GNUC__ >= 4 51 | # define OSIXPRLIB_EXPORT __attribute__((__visibility__("default"))) 52 | # else 53 | # define OSIXPRLIB_EXPORT 54 | # endif 55 | #endif 56 | 57 | 58 | #endif /* HAVE_CONFIG_H */ 59 | 60 | #endif /*__OSIXPRCONFIG_H__*/ 61 | -------------------------------------------------------------------------------- /.coin-or/config.yml: -------------------------------------------------------------------------------- 1 | Description: 2 | Slug: Osi 3 | ShortName: Osi 4 | LongName: Open Solver Interface 5 | ShortDescription: A uniform API for calling embedded linear and mixed-integer programming solvers. 6 | LongDescription: |2 7 | "The COIN-OR Open Solver Interface is a uniform API for interacting 8 | with callable solver libraries. 9 | It supports linear programming solvers as well as the ability to \"finish off\" 10 | a mixed-integer problem calling the solver library\'s MIP solver. 11 | A list of supported solvers appears at the bottom of the page." 12 | Manager: Matthew Saltzman, Lou Hafer 13 | Homepage: https://github.com/coin-or/Osi 14 | License: Eclipse Public License 2.0 15 | LicenseURL: http://www.opensource.org/licenses/EPL-2.0 16 | Zenodo: 173476455 17 | IncludedIn: 18 | Package: Cbc 19 | Language: 20 | - C++ 21 | Categories: 22 | - Interfaces 23 | 24 | Dependencies: 25 | - Description: ThirdParty wrapper for building Glpk 26 | URL: https://github.com/coin-or-tools/ThirdParty-Glpk 27 | Version: master 28 | Required: Optional 29 | - Description: Netlib data files 30 | URL: https://github.com/coin-or-tools/Data-Netlib 31 | Version: master 32 | Required: Required 33 | - Description: Sample data files 34 | URL: https://github.com/coin-or-tools/Data-Sample 35 | Version: master 36 | Required: Required 37 | - Description: COIN-OR Utilities 38 | URL: https://github.com/coin-or/CoinUtils 39 | Version: master 40 | Required: Required 41 | 42 | DevelopmentStatus: 43 | activityStatus: Active 44 | maturityLevel: 5 45 | testedPlatforms: 46 | - operatingSystem: Linux 47 | compiler: gcc 48 | - operatingSystem: Mac OS X 49 | compiler: 50 | - gcc 51 | - clang 52 | - operatingSystem: Microsoft Windows 53 | compiler: cl 54 | - operatingSystem: Microsoft Windows with MSys2 55 | compiler: 56 | - gcc 57 | - cl 58 | - icl 59 | - operatingSystem: Microsoft Windows Subsystem for Linux 60 | compiler: 61 | - gcc 62 | - cl 63 | - icl 64 | -------------------------------------------------------------------------------- /src/OsiCommonTest/OsiUnitTestsConfig.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 2 | * All Rights Reserved. 3 | * This code is published under the Eclipse Public License. 4 | * 5 | * Include file for the configuration of OsiCommonTest. 6 | * 7 | * On systems where the code is configured with the configure script 8 | * (i.e., compilation is always done with HAVE_CONFIG_H defined), this 9 | * header file includes the automatically generated header file. 10 | * 11 | * On systems that are compiled in other ways (e.g., with the 12 | * Developer Studio), a header file is included to define those 13 | * macros that depend on the operating system and the compiler. The 14 | * macros that define the configuration of the particular user setting 15 | * (e.g., presence of other COIN-OR packages or third party code) are set 16 | * by the files config_*default.h. The project maintainer needs to remember 17 | * to update these files and choose reasonable defines. 18 | * A user can modify the default setting by editing the config_*default.h 19 | * files. 20 | */ 21 | 22 | #ifndef __OSIUNITTESTSCONFIG_H__ 23 | #define __OSIUNITTESTSCONFIG_H__ 24 | 25 | #ifdef HAVE_CONFIG_H 26 | #ifdef OSICOMMONTESTLIB_BUILD 27 | 28 | #ifdef DLL_EXPORT 29 | # define OSICOMMONTESTLIB_EXPORT __declspec(dllexport) 30 | #elif defined(__GNUC__) && __GNUC__ >= 4 31 | # define OSICOMMONTESTLIB_EXPORT __attribute__((__visibility__("default"))) 32 | #else 33 | # define OSICOMMONTESTLIB_EXPORT 34 | #endif 35 | 36 | #else 37 | #include "config_osicommontest.h" 38 | #endif 39 | 40 | #else /* HAVE_CONFIG_H */ 41 | 42 | 43 | #ifndef OSICOMMONTESTLIB_EXPORT 44 | # if defined(_WIN32) && defined(DLL_EXPORT) 45 | # ifdef OSICOMMONTESTLIB_BUILD 46 | # define OSICOMMONTESTLIB_EXPORT __declspec(dllexport) 47 | # else 48 | # define OSICOMMONTESTLIB_EXPORT __declspec(dllimport) 49 | # endif 50 | # elif defined(__GNUC__) && __GNUC__ >= 4 51 | # define OSICOMMONTESTLIB_EXPORT __attribute__((__visibility__("default"))) 52 | # else 53 | # define OSICOMMONTESTLIB_EXPORT 54 | # endif 55 | #endif 56 | 57 | 58 | #endif /* HAVE_CONFIG_H */ 59 | 60 | #endif /*__OSIUNITTESTSCONFIG_H__*/ 61 | -------------------------------------------------------------------------------- /src/Osi/OsiCut.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2000, International Business Machines 2 | // Corporation and others. All Rights Reserved. 3 | // This code is licensed under the terms of the Eclipse Public License (EPL). 4 | 5 | #if defined(_MSC_VER) 6 | // Turn off compiler warning about long names 7 | #pragma warning(disable : 4786) 8 | #endif 9 | 10 | #include "OsiCut.hpp" 11 | 12 | //------------------------------------------------------------------- 13 | // Default Constructor 14 | //------------------------------------------------------------------- 15 | OsiCut::OsiCut() 16 | : effectiveness_(0.) 17 | , globallyValid_(0) 18 | //timesUsed_(0), 19 | //timesTested_(0) 20 | { 21 | // nothing to do here 22 | } 23 | //------------------------------------------------------------------- 24 | // Copy constructor 25 | //------------------------------------------------------------------- 26 | OsiCut::OsiCut( 27 | const OsiCut &source) 28 | : effectiveness_(source.effectiveness_) 29 | , globallyValid_(source.globallyValid_) 30 | //timesUsed_(source.timesUsed_), 31 | //timesTested_(source.timesTested_) 32 | { 33 | // nothing to do here 34 | } 35 | 36 | #if 0 37 | //---------------------------------------------------------------- 38 | // Clone 39 | //---------------------------------------------------------------- 40 | OsiCut * OsiCut::clone() const 41 | { return (new OsiCut(*this));} 42 | #endif 43 | 44 | //------------------------------------------------------------------- 45 | // Destructor 46 | //------------------------------------------------------------------- 47 | OsiCut::~OsiCut() 48 | { 49 | // nothing to do here 50 | } 51 | 52 | //---------------------------------------------------------------- 53 | // Assignment operator 54 | //------------------------------------------------------------------- 55 | OsiCut & 56 | OsiCut::operator=(const OsiCut &rhs) 57 | { 58 | if (this != &rhs) { 59 | effectiveness_ = rhs.effectiveness_; 60 | globallyValid_ = rhs.globallyValid_; 61 | //timesUsed_=rhs.timesUsed_; 62 | //timesTested_=rhs.timesTested_; 63 | } 64 | return *this; 65 | } 66 | 67 | /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2 68 | */ 69 | -------------------------------------------------------------------------------- /examples/query.cpp: -------------------------------------------------------------------------------- 1 | // Example of using COIN-OR OSI 2 | // Demonstrates some problem and solution query methods 3 | 4 | #include 5 | #include OSIXXXhpp 6 | 7 | int 8 | main(void) 9 | { 10 | // Create a problem pointer. We use the base class here. 11 | OsiSolverInterface *si; 12 | 13 | // When we instantiate the object, we need a specific derived class. 14 | si = new OSIXXX; 15 | 16 | // Read in an mps file. This one's from the MIPLIB library. 17 | #if defined(SAMPLEDIR) 18 | si->readMps(SAMPLEDIR "/p0033"); 19 | #else 20 | fprintf(stderr, "Do not know where to find sample MPS files.\n"); 21 | exit(1); 22 | #endif 23 | 24 | // Display some information about the instance 25 | int nrows = si->getNumRows(); 26 | int ncols = si->getNumCols(); 27 | int nelem = si->getNumElements(); 28 | std::cout << "This problem has " << nrows << " rows, " 29 | << ncols << " columns, and " << nelem << " nonzeros." 30 | << std::endl; 31 | 32 | double const *upper_bounds = si->getColUpper(); 33 | std::cout << "The upper bound on the first column is " 34 | << upper_bounds[0] << std::endl; 35 | // All information about the instance is available with similar methods 36 | 37 | // Solve the (relaxation of the) problem 38 | si->initialSolve(); 39 | 40 | // Check the solution 41 | if ( si->isProvenOptimal() ) { 42 | std::cout << "Found optimal solution!" << std::endl; 43 | std::cout << "Objective value is " << si->getObjValue() << std::endl; 44 | 45 | // Examine solution 46 | int n = si->getNumCols(); 47 | const double *solution; 48 | solution = si->getColSolution(); 49 | 50 | std::cout << "Solution: "; 51 | for (int i = 0; i < n; i++) 52 | std::cout << solution[i] << " "; 53 | std::cout << std::endl; 54 | 55 | std::cout << "It took " << si->getIterationCount() << " iterations" 56 | << " to solve." << std::endl; 57 | } else { 58 | std::cout << "Didn't find optimal solution." << std::endl; 59 | 60 | // Check other status functions. What happened? 61 | if (si->isProvenPrimalInfeasible()) 62 | std::cout << "Problem is proven to be infeasible." << std::endl; 63 | if (si->isProvenDualInfeasible()) 64 | std::cout << "Problem is proven dual infeasible." << std::endl; 65 | if (si->isIterationLimitReached()) 66 | std::cout << "Reached iteration limit." << std::endl; 67 | } 68 | 69 | return 0; 70 | } 71 | -------------------------------------------------------------------------------- /src/Osi/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2010 Lou Hafer 2 | # All Rights Reserved. 3 | # This file is distributed under the Eclipse Public License. 4 | # 5 | # Author: Lou Hafer SFU 2010-07-29 6 | 7 | include $(top_srcdir)/BuildTools/Makemain.inc 8 | 9 | ######################################################################## 10 | # libOsi # 11 | ######################################################################## 12 | 13 | # Name of the library compiled in this directory. We want it to be installed 14 | # in $libdir 15 | lib_LTLIBRARIES = libOsi.la 16 | 17 | # List all source files for this library, including headers 18 | libOsi_la_SOURCES = \ 19 | OsiConfig.h \ 20 | OsiAuxInfo.cpp OsiAuxInfo.hpp \ 21 | OsiBranchingObject.cpp OsiBranchingObject.hpp \ 22 | OsiChooseVariable.cpp OsiChooseVariable.hpp \ 23 | OsiColCut.cpp OsiColCut.hpp \ 24 | OsiCollections.hpp \ 25 | OsiCut.cpp OsiCut.hpp \ 26 | OsiCuts.cpp OsiCuts.hpp \ 27 | OsiNames.cpp \ 28 | OsiPresolve.cpp OsiPresolve.hpp \ 29 | OsiRowCut.cpp OsiRowCut.hpp \ 30 | OsiRowCutDebugger.cpp OsiRowCutDebugger.hpp \ 31 | OsiSolverBranch.cpp OsiSolverBranch.hpp \ 32 | OsiSolverInterface.cpp OsiSolverInterface.hpp \ 33 | OsiSolverParameters.hpp \ 34 | OsiFeatures.cpp OsiFeatures.hpp 35 | 36 | # List all additionally required libraries 37 | libOsi_la_LIBADD = $(OSILIB_LFLAGS) 38 | 39 | # This is for libtool 40 | AM_LDFLAGS = $(LT_LDFLAGS) 41 | 42 | # Here list all include flags. 43 | AM_CPPFLAGS = $(OSILIB_CFLAGS) 44 | 45 | ######################################################################## 46 | # Headers that need to be installed # 47 | ######################################################################## 48 | 49 | # Here list all the header files that are required by a user of the library, 50 | # and that therefore should be installed in pkgincludedir 51 | includecoindir = $(pkgincludedir) 52 | includecoin_HEADERS = \ 53 | OsiAuxInfo.hpp \ 54 | OsiBranchingObject.hpp \ 55 | OsiChooseVariable.hpp \ 56 | OsiColCut.hpp \ 57 | OsiCollections.hpp \ 58 | OsiCut.hpp \ 59 | OsiCuts.hpp \ 60 | OsiPresolve.hpp \ 61 | OsiRowCut.hpp \ 62 | OsiRowCutDebugger.hpp \ 63 | OsiSolverBranch.hpp \ 64 | OsiSolverInterface.hpp \ 65 | OsiSolverParameters.hpp \ 66 | OsiFeatures.hpp 67 | 68 | install-exec-local: 69 | $(install_sh_DATA) config_osi.h $(DESTDIR)$(includecoindir)/OsiConfig.h 70 | 71 | uninstall-local: 72 | rm -f $(DESTDIR)$(includecoindir)/OsiConfig.h 73 | -------------------------------------------------------------------------------- /examples/readconic.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2005, International Business Machines 2 | // Corporation and others. All Rights Reserved. 3 | // This code is licensed under the terms of the Eclipse Public License (EPL). 4 | 5 | #include "CoinMpsIO.hpp" 6 | 7 | int main (int argc, const char *argv[]) 8 | { 9 | CoinMpsIO m_MpsData; 10 | int nOfSOS; 11 | CoinSet ** SOS = NULL; 12 | std::string mpsFileName; 13 | #if defined(SAMPLEDIR) 14 | mpsFileName = SAMPLEDIR "/conic.mps"; 15 | #else 16 | if (argc < 2) { 17 | fprintf(stderr, "Do not know where to find sample MPS files.\n"); 18 | exit(1); 19 | } 20 | #endif 21 | if (argc>=2) mpsFileName = argv[1]; 22 | int status = m_MpsData.readMps( mpsFileName.c_str(), "", nOfSOS, SOS ); 23 | assert (!status); 24 | int * columnStart = NULL; 25 | int * columnIdx = NULL; 26 | double * elements = NULL; 27 | status = m_MpsData.readQuadraticMps(NULL, columnStart, columnIdx, elements, 0); 28 | assert (!status); 29 | int nOfCones; 30 | int * coneStart = NULL; 31 | int * coneIdx = NULL; 32 | int * coneType = NULL; 33 | status = m_MpsData.readConicMps(NULL, coneStart, coneIdx, coneType, nOfCones); 34 | assert (!status); 35 | if (nOfSOS) { 36 | printf("%d SOS sets\n",nOfSOS); 37 | for (int iSOS=0;iSOSnumberEntries(); 39 | printf("Set %d has %d entries - type %d\n",iSOS,numberEntries,SOS[iSOS]->setType()); 40 | const int * which = SOS[iSOS]->which(); 41 | const double * weights = SOS[iSOS]->weights(); 42 | for (int i=0;i 6 | #include OSIXXXhpp 7 | 8 | int 9 | main(void) 10 | { 11 | // Create a problem pointer. We use the base class here. 12 | OsiSolverInterface *si; 13 | 14 | // When we instantiate the object, we need a specific derived class. 15 | si = new OSIXXX; 16 | 17 | // Read in an mps file. This one's from the MIPLIB library. 18 | #if defined(SAMPLEDIR) 19 | si->readMps(SAMPLEDIR "/p0033"); 20 | #else 21 | fprintf(stderr, "Do not know where to find sample MPS files.\n"); 22 | exit(1); 23 | #endif 24 | 25 | // Display some information about the instance 26 | int nrows = si->getNumRows(); 27 | int ncols = si->getNumCols(); 28 | int nelem = si->getNumElements(); 29 | std::cout << "This problem has " << nrows << " rows, " 30 | << ncols << " columns, and " << nelem << " nonzeros." 31 | << std::endl; 32 | 33 | double const * upper_bounds = si->getColUpper(); 34 | std::cout << "The upper bound on the first column is " << upper_bounds[0] 35 | << std::endl; 36 | // All information about the instance is available with similar methods 37 | 38 | 39 | // Before solving, indicate some parameters 40 | si->setIntParam( OsiMaxNumIteration, 10); 41 | si->setDblParam( OsiPrimalTolerance, 0.001 ); 42 | 43 | // Can also read parameters 44 | std::string solver; 45 | si->getStrParam( OsiSolverName, solver ); 46 | std::cout << "About to solve with: " << solver << std::endl; 47 | 48 | // Solve the (relaxation of the) problem 49 | si->initialSolve(); 50 | 51 | // Check the solution 52 | if ( si->isProvenOptimal() ) { 53 | std::cout << "Found optimal solution!" << std::endl; 54 | std::cout << "Objective value is " << si->getObjValue() << std::endl; 55 | 56 | // Examine solution 57 | int n = si->getNumCols(); 58 | const double *solution; 59 | solution = si->getColSolution(); 60 | 61 | std::cout << "Solution: "; 62 | for (int i = 0; i < n; i++) 63 | std::cout << solution[i] << " "; 64 | std::cout << std::endl; 65 | 66 | std::cout << "It took " << si->getIterationCount() << " iterations" 67 | << " to solve." << std::endl; 68 | } else { 69 | std::cout << "Didn't find optimal solution." << std::endl; 70 | 71 | // Check other status functions. What happened? 72 | if (si->isProvenPrimalInfeasible()) 73 | std::cout << "Problem is proven to be infeasible." << std::endl; 74 | if (si->isProvenDualInfeasible()) 75 | std::cout << "Problem is proven dual infeasible." << std::endl; 76 | if (si->isIterationLimitReached()) 77 | std::cout << "Reached iteration limit." << std::endl; 78 | } 79 | 80 | return 0; 81 | } 82 | -------------------------------------------------------------------------------- /test/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2006 International Business Machines and others. 2 | # All Rights Reserved. 3 | # This file is distributed under the Eclipse Public License. 4 | # 5 | # Author: Andreas Waechter IBM 2006-04-13 6 | 7 | include $(top_srcdir)/BuildTools/Makemain.inc 8 | 9 | ######################################################################## 10 | # unitTest for Coin # 11 | ######################################################################## 12 | 13 | noinst_PROGRAMS = unitTest 14 | 15 | unitTest_SOURCES = unitTest.cpp \ 16 | OsiTestSolver.cpp \ 17 | OsiTestSolverInterface.cpp \ 18 | OsiTestSolverInterfaceIO.cpp \ 19 | OsiTestSolverInterfaceTest.cpp 20 | 21 | # List libraries of COIN projects 22 | unitTest_LDADD = ../src/OsiCommonTest/libOsiCommonTest.la 23 | 24 | AM_LDFLAGS = $(LT_LDFLAGS) 25 | 26 | # Here list all include flags, relative to this "srcdir" directory. 27 | AM_CPPFLAGS = -I$(srcdir)/../src/Osi -I$(srcdir)/../src/OsiCommonTest 28 | 29 | # Depending of what solvers are available, we add the corresponding files, 30 | # libraries and compile flags 31 | 32 | if COIN_HAS_CPLEX 33 | unitTest_SOURCES += OsiCpxSolverInterfaceTest.cpp 34 | AM_CPPFLAGS += -DOSI_HAS_CPLEX -I$(srcdir)/../src/OsiCpx 35 | unitTest_LDADD += ../src/OsiCpx/libOsiCpx.la 36 | endif 37 | 38 | if COIN_HAS_GLPK 39 | unitTest_SOURCES += OsiGlpkSolverInterfaceTest.cpp 40 | AM_CPPFLAGS += -DOSI_HAS_GLPK -I$(srcdir)/../src/OsiGlpk 41 | unitTest_LDADD += ../src/OsiGlpk/libOsiGlpk.la 42 | endif 43 | 44 | if COIN_HAS_MOSEK 45 | unitTest_SOURCES += OsiMskSolverInterfaceTest.cpp 46 | AM_CPPFLAGS += -DOSI_HAS_MOSEK -I$(srcdir)/../src/OsiMsk 47 | unitTest_LDADD += ../src/OsiMsk/libOsiMsk.la 48 | endif 49 | 50 | if COIN_HAS_XPRESS 51 | unitTest_SOURCES += OsiXprSolverInterfaceTest.cpp 52 | AM_CPPFLAGS += -DOSI_HAS_XPRESS -I$(srcdir)/../src/OsiXpr 53 | unitTest_LDADD += ../src/OsiXpr/libOsiXpr.la 54 | endif 55 | 56 | if COIN_HAS_GUROBI 57 | unitTest_SOURCES += OsiGrbSolverInterfaceTest.cpp 58 | AM_CPPFLAGS += -DOSI_HAS_GUROBI -I$(srcdir)/../src/OsiGrb 59 | unitTest_LDADD += ../src/OsiGrb/libOsiGrb.la 60 | endif 61 | 62 | if COIN_HAS_SOPLEX 63 | unitTest_SOURCES += OsiSpxSolverInterfaceTest.cpp 64 | AM_CPPFLAGS += -DOSI_HAS_SOPLEX -I$(srcdir)/../src/OsiSpx 65 | unitTest_LDADD += ../src/OsiSpx/libOsiSpx.la 66 | endif 67 | 68 | # put this one after the -I$(srcdir)/../src/OsiXyz from above 69 | AM_CPPFLAGS += $(OSITEST_CFLAGS) 70 | 71 | unittestflags = 72 | if COIN_HAS_SAMPLE 73 | unittestflags += -mpsDir=`$(CYGPATH_W) $(SAMPLE_DATA)` 74 | endif 75 | if COIN_HAS_NETLIB 76 | unittestflags += -netlibDir=`$(CYGPATH_W) $(NETLIB_DATA)` -testOsiSolverInterface 77 | endif 78 | 79 | test: unitTest$(EXEEXT) 80 | ./unitTest$(EXEEXT) $(unittestflags) 81 | 82 | .PHONY: test 83 | 84 | ######################################################################## 85 | # Cleaning stuff # 86 | ######################################################################## 87 | 88 | # Here we list everything that is not generated by the compiler, e.g., 89 | # output files of a program 90 | 91 | CLEANFILES = *.mps *.mps.gz *.lp test2out *.out.gz *.out 92 | -------------------------------------------------------------------------------- /examples/build.cpp: -------------------------------------------------------------------------------- 1 | // Example of using COIN-OR OSI, building the instance internally 2 | // with sparse matrix object 3 | 4 | #include 5 | #include OSIXXXhpp 6 | #include "CoinPackedMatrix.hpp" 7 | #include "CoinPackedVector.hpp" 8 | 9 | int 10 | main(void) 11 | { 12 | // Create a problem pointer. We use the base class here. 13 | OsiSolverInterface *si; 14 | 15 | // When we instantiate the object, we need a specific derived class. 16 | si = new OSIXXX; 17 | 18 | // Build our own instance from scratch 19 | 20 | /* 21 | * This section adapted from Matt Galati's example 22 | * on the COIN-OR Tutorial website. 23 | * 24 | * Problem from Bertsimas, Tsitsiklis page 21 25 | * 26 | * optimal solution: x* = (1,1) 27 | * 28 | * minimize -1 x0 - 1 x1 29 | * s.t 1 x0 + 2 x1 <= 3 30 | * 2 x0 + 1 x1 <= 3 31 | * x0 >= 0 32 | * x1 >= 0 33 | */ 34 | 35 | int n_cols = 2; 36 | double *objective = new double[n_cols];//the objective coefficients 37 | double *col_lb = new double[n_cols];//the column lower bounds 38 | double *col_ub = new double[n_cols];//the column upper bounds 39 | 40 | //Define the objective coefficients. 41 | //minimize -1 x0 - 1 x1 42 | objective[0] = -1.0; 43 | objective[1] = -1.0; 44 | 45 | //Define the variable lower/upper bounds. 46 | // x0 >= 0 => 0 <= x0 <= infinity 47 | // x1 >= 0 => 0 <= x1 <= infinity 48 | col_lb[0] = 0.0; 49 | col_lb[1] = 0.0; 50 | col_ub[0] = si->getInfinity(); 51 | col_ub[1] = si->getInfinity(); 52 | 53 | int n_rows = 2; 54 | double *row_lb = new double[n_rows]; //the row lower bounds 55 | double *row_ub = new double[n_rows]; //the row upper bounds 56 | 57 | //Define the constraint matrix. 58 | CoinPackedMatrix *matrix = new CoinPackedMatrix(false,0,0); 59 | matrix->setDimensions(0, n_cols); 60 | 61 | //1 x0 + 2 x1 <= 3 => -infinity <= 1 x0 + 2 x2 <= 3 62 | CoinPackedVector row1; 63 | row1.insert(0, 1.0); 64 | row1.insert(1, 2.0); 65 | row_lb[0] = -1.0 * si->getInfinity(); 66 | row_ub[0] = 3.0; 67 | matrix->appendRow(row1); 68 | 69 | //2 x0 + 1 x1 <= 3 => -infinity <= 2 x0 + 1 x1 <= 3 70 | CoinPackedVector row2; 71 | row2.insert(0, 2.0); 72 | row2.insert(1, 1.0); 73 | row_lb[1] = -1.0 * si->getInfinity(); 74 | row_ub[1] = 3.0; 75 | matrix->appendRow(row2); 76 | 77 | //load the problem to OSI 78 | si->loadProblem(*matrix, col_lb, col_ub, objective, row_lb, row_ub); 79 | 80 | //write the MPS file to a file called example.mps 81 | si->writeMps("example"); 82 | 83 | 84 | 85 | // Solve the (relaxation of the) problem 86 | si->initialSolve(); 87 | 88 | // Check the solution 89 | if ( si->isProvenOptimal() ) { 90 | std::cout << "Found optimal solution!" << std::endl; 91 | std::cout << "Objective value is " << si->getObjValue() << std::endl; 92 | 93 | int n = si->getNumCols(); 94 | const double* solution = si->getColSolution(); 95 | 96 | // We can then print the solution or could examine it. 97 | for( int i = 0; i < n; ++i ) 98 | std::cout << si->getColName(i) << " = " << solution[i] << std::endl; 99 | 100 | } else { 101 | std::cout << "Didn't find optimal solution." << std::endl; 102 | // Could then check other status functions. 103 | } 104 | 105 | delete[] row_ub; 106 | delete[] row_lb; 107 | delete[] objective; 108 | delete[] col_ub; 109 | delete[] col_lb; 110 | 111 | return 0; 112 | } 113 | -------------------------------------------------------------------------------- /examples/Makefile.in: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2006 International Business Machines and others. 2 | # All Rights Reserved. 3 | # This file is distributed under the Eclipse Public License. 4 | 5 | ########################################################################## 6 | # You can modify this example makefile to fit for your own program. # 7 | # Usually, you only need to change CHANGEME entries below. # 8 | ########################################################################## 9 | 10 | # CHANGEME 11 | # To compile other examples, either change the following line, or add the 12 | # argument DRIVER=filename_without_extension to make, e.g., 13 | # `make DRIVER=parameters' 14 | 15 | DRIVER = basic 16 | 17 | # CHANGEME 18 | # This should be the name of your executable; change if you want a name 19 | # that's different from the file name. 20 | 21 | EXE = $(DRIVER)@EXEEXT@ 22 | 23 | # CHANGEME 24 | # OBJS should include all object files necessary to build your program. For 25 | # the examples, only one file is needed for each example. You will probably 26 | # have more as your code grows. 27 | 28 | OBJS = $(DRIVER).@OBJEXT@ 29 | 30 | # CHANGEME 31 | # Additional libraries. The examples require only the COIN-OR libraries specified 32 | # as LIBS below. You may need more. 33 | 34 | ADDLIBS = 35 | 36 | # CHANGEME 37 | # Additional flags for compilation (e.g., include flags). As for libraries, 38 | # the examples require only COIN-OR include files, specified as part of CXXFLAGS 39 | # below. 40 | 41 | ADDINCFLAGS = 42 | 43 | # CHANGEME 44 | # Directory to the sources for the (example) problem definition files. VPATH 45 | # is used if you are building in a different directory than the source. This 46 | # can be handy for various reasons; if none occur to you, don't worry about 47 | # it. 48 | 49 | SRCDIR = @srcdir@ 50 | VPATH = @srcdir@ 51 | 52 | ########################################################################## 53 | # Usually, you don't have to change anything below. Note that if you # 54 | # change certain compiler options, you might have to recompile the # 55 | # package. # 56 | ########################################################################## 57 | 58 | # C++ Compiler command 59 | CXX = @CXX@ 60 | 61 | # C++ Compiler options 62 | CXXFLAGS = @CXXFLAGS@ 63 | CXXFLAGS += -DOSIXXXhpp=\"@OSI_EXAMPLES_SOLVER_NAME@.hpp\" -DOSIXXX=@OSI_EXAMPLES_SOLVER_NAME@ 64 | 65 | # Sample data directory 66 | @COIN_HAS_SAMPLE_TRUE@CXXFLAGS += -DSAMPLEDIR=\"`$(CYGPATH_W) @SAMPLE_DATA@`\" 67 | 68 | # Netlib data directory 69 | @COIN_HAS_NETLIB_TRUE@CXXFLAGS += -DNETLIBDIR=\"`$(CYGPATH_W) @NETLIB_DATA@`\" 70 | 71 | # additional C++ Compiler options for linking 72 | CXXLINKFLAGS = @RPATH_FLAGS@ 73 | 74 | # Include directories 75 | @COIN_HAS_PKGCONFIG_TRUE@INCL = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --cflags @OSI_EXAMPLES_SOLVER_PCNAME@ osi` 76 | @COIN_HAS_PKGCONFIG_FALSE@INCL = -I@includedir@/coin-or @OSI_EXAMPLES_SOLVER_CFLAGS@ 77 | INCL += $(ADDINCFLAGS) 78 | 79 | # Linker flags 80 | @COIN_HAS_PKGCONFIG_TRUE@LIBS = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --libs @OSI_EXAMPLES_SOLVER_PCNAME@ osi` 81 | @COIN_HAS_PKGCONFIG_FALSE@LIBS = -L@libdir@ @OSI_EXAMPLES_SOLVER_LFLAGS@ -lOsi -lCoinUtils 82 | LIBS += $(ADDLIBS) 83 | 84 | # The following is necessary under cygwin, if native compilers are used 85 | CYGPATH_W = @CYGPATH_W@ 86 | 87 | # get some directories, so we can expand @libdir@ and @includedir@ 88 | prefix=@prefix@ 89 | exec_prefix=@exec_prefix@ 90 | 91 | all: $(EXE) 92 | 93 | .SUFFIXES: .cpp .@OBJEXT@ 94 | 95 | $(EXE): $(OBJS) 96 | $(CXX) $(CXXLINKFLAGS) $(CXXFLAGS) -o $@ $< $(LIBS) 97 | 98 | clean: 99 | rm -rf $(EXE) $(OBJS) 100 | 101 | .cpp.@OBJEXT@: 102 | $(CXX) $(CXXFLAGS) $(INCL) -c -o $@ `test -f '$<' || echo '$(SRCDIR)/'`$< 103 | -------------------------------------------------------------------------------- /MSVisualStudio/v10alt/Osi.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 11.00 2 | # Visual Studio 2010 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsi", "libOsi.vcxproj", "{6A555565-9EA5-4382-B913-01544C52A2AB}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiCommonTest", "libOsiCommonTest.vcxproj", "{109D6E6F-6D91-460F-86AE-DF27400E09A9}" 6 | EndProject 7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiUnitTest", "OsiUnitTest.vcxproj", "{0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}" 8 | EndProject 9 | Global 10 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 11 | Debug|Win32 = Debug|Win32 12 | Debug|x64 = Debug|x64 13 | DebugDLL|Win32 = DebugDLL|Win32 14 | DebugDLL|x64 = DebugDLL|x64 15 | Release|Win32 = Release|Win32 16 | Release|x64 = Release|x64 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {6A555565-9EA5-4382-B913-01544C52A2AB}.Debug|Win32.ActiveCfg = Debug|Win32 20 | {6A555565-9EA5-4382-B913-01544C52A2AB}.Debug|Win32.Build.0 = Debug|Win32 21 | {6A555565-9EA5-4382-B913-01544C52A2AB}.Debug|x64.ActiveCfg = Debug|x64 22 | {6A555565-9EA5-4382-B913-01544C52A2AB}.Debug|x64.Build.0 = Debug|x64 23 | {6A555565-9EA5-4382-B913-01544C52A2AB}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32 24 | {6A555565-9EA5-4382-B913-01544C52A2AB}.DebugDLL|Win32.Build.0 = DebugDLL|Win32 25 | {6A555565-9EA5-4382-B913-01544C52A2AB}.DebugDLL|x64.ActiveCfg = DebugDLL|x64 26 | {6A555565-9EA5-4382-B913-01544C52A2AB}.DebugDLL|x64.Build.0 = DebugDLL|x64 27 | {6A555565-9EA5-4382-B913-01544C52A2AB}.Release|Win32.ActiveCfg = Release|Win32 28 | {6A555565-9EA5-4382-B913-01544C52A2AB}.Release|Win32.Build.0 = Release|Win32 29 | {6A555565-9EA5-4382-B913-01544C52A2AB}.Release|x64.ActiveCfg = Release|x64 30 | {6A555565-9EA5-4382-B913-01544C52A2AB}.Release|x64.Build.0 = Release|x64 31 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.ActiveCfg = Debug|Win32 32 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.Build.0 = Debug|Win32 33 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.ActiveCfg = Debug|x64 34 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.Build.0 = Debug|x64 35 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32 36 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.DebugDLL|Win32.Build.0 = DebugDLL|Win32 37 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.DebugDLL|x64.ActiveCfg = DebugDLL|x64 38 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.DebugDLL|x64.Build.0 = DebugDLL|x64 39 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.ActiveCfg = Release|Win32 40 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.Build.0 = Release|Win32 41 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.ActiveCfg = Release|x64 42 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.Build.0 = Release|x64 43 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|Win32.ActiveCfg = Debug|Win32 44 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|Win32.Build.0 = Debug|Win32 45 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|x64.ActiveCfg = Debug|x64 46 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|x64.Build.0 = Debug|x64 47 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32 48 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.DebugDLL|Win32.Build.0 = DebugDLL|Win32 49 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.DebugDLL|x64.ActiveCfg = DebugDLL|x64 50 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.DebugDLL|x64.Build.0 = DebugDLL|x64 51 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|Win32.ActiveCfg = Release|Win32 52 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|Win32.Build.0 = Release|Win32 53 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|x64.ActiveCfg = Release|x64 54 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|x64.Build.0 = Release|x64 55 | EndGlobalSection 56 | GlobalSection(SolutionProperties) = preSolution 57 | HideSolutionNode = FALSE 58 | EndGlobalSection 59 | EndGlobal 60 | -------------------------------------------------------------------------------- /src/Osi/OsiColCut.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2000, International Business Machines 2 | // Corporation and others. All Rights Reserved. 3 | // This code is licensed under the terms of the Eclipse Public License (EPL). 4 | 5 | #if defined(_MSC_VER) 6 | // Turn off compiler warning about long names 7 | #pragma warning(disable : 4786) 8 | #endif 9 | 10 | #include "OsiColCut.hpp" 11 | #include 12 | #include 13 | #include 14 | 15 | //------------------------------------------------------------------- 16 | // Default Constructor 17 | //------------------------------------------------------------------- 18 | OsiColCut::OsiColCut() 19 | : OsiCut() 20 | , lbs_() 21 | , ubs_() 22 | { 23 | // nothing to do here 24 | } 25 | //------------------------------------------------------------------- 26 | // Copy constructor 27 | //------------------------------------------------------------------- 28 | OsiColCut::OsiColCut(const OsiColCut &source) 29 | : OsiCut(source) 30 | , lbs_(source.lbs_) 31 | , ubs_(source.ubs_) 32 | { 33 | // Nothing to do here 34 | } 35 | 36 | //---------------------------------------------------------------- 37 | // Clone 38 | //---------------------------------------------------------------- 39 | OsiColCut *OsiColCut::clone() const 40 | { 41 | return (new OsiColCut(*this)); 42 | } 43 | 44 | //------------------------------------------------------------------- 45 | // Destructor 46 | //------------------------------------------------------------------- 47 | OsiColCut::~OsiColCut() 48 | { 49 | // Nothing to do here 50 | } 51 | 52 | //---------------------------------------------------------------- 53 | // Assignment operator 54 | //------------------------------------------------------------------- 55 | OsiColCut & 56 | OsiColCut::operator=(const OsiColCut &rhs) 57 | { 58 | if (this != &rhs) { 59 | 60 | OsiCut::operator=(rhs); 61 | lbs_ = rhs.lbs_; 62 | ubs_ = rhs.ubs_; 63 | } 64 | return *this; 65 | } 66 | //---------------------------------------------------------------- 67 | // Print 68 | //------------------------------------------------------------------- 69 | 70 | void OsiColCut::print() const 71 | { 72 | const CoinPackedVector &cutLbs = lbs(); 73 | const CoinPackedVector &cutUbs = ubs(); 74 | int i; 75 | std::cout << "Column cut has " 76 | << cutLbs.getNumElements() 77 | << " lower bound cuts and " 78 | << cutUbs.getNumElements() 79 | << " upper bound cuts" 80 | << std::endl; 81 | for (i = 0; i < cutLbs.getNumElements(); i++) { 82 | int colIndx = cutLbs.getIndices()[i]; 83 | double newLb = cutLbs.getElements()[i]; 84 | std::cout << "[ x" << colIndx << " >= " << newLb << "] "; 85 | } 86 | for (i = 0; i < cutUbs.getNumElements(); i++) { 87 | int colIndx = cutUbs.getIndices()[i]; 88 | double newUb = cutUbs.getElements()[i]; 89 | std::cout << "[ x" << colIndx << " <= " << newUb << "] "; 90 | } 91 | std::cout << std::endl; 92 | } 93 | /* Returns infeasibility of the cut with respect to solution 94 | passed in i.e. is positive if cuts off that solution. 95 | solution is getNumCols() long.. 96 | */ 97 | double 98 | OsiColCut::violated(const double *solution) const 99 | { 100 | const CoinPackedVector &cutLbs = lbs(); 101 | const CoinPackedVector &cutUbs = ubs(); 102 | double sum = 0.0; 103 | int i; 104 | const int *column = cutLbs.getIndices(); 105 | int number = cutLbs.getNumElements(); 106 | const double *bound = cutLbs.getElements(); 107 | for (i = 0; i < number; i++) { 108 | int colIndx = column[i]; 109 | double newLb = bound[i]; 110 | if (newLb > solution[colIndx]) 111 | sum += newLb - solution[colIndx]; 112 | } 113 | column = cutUbs.getIndices(); 114 | number = cutUbs.getNumElements(); 115 | bound = cutUbs.getElements(); 116 | for (i = 0; i < number; i++) { 117 | int colIndx = column[i]; 118 | double newUb = bound[i]; 119 | if (newUb < solution[colIndx]) 120 | sum += solution[colIndx] - newUb; 121 | } 122 | return sum; 123 | } 124 | 125 | /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2 126 | */ 127 | -------------------------------------------------------------------------------- /MSVisualStudio/v9alt/Osi.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 10.00 2 | # Visual Studio 2008 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsi", "libOsi.vcproj", "{6A555565-9EA5-4382-B913-01544C52A2AB}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiCommonTest", "libOsiCommonTest.vcproj", "{109D6E6F-6D91-460F-86AE-DF27400E09A9}" 6 | ProjectSection(ProjectDependencies) = postProject 7 | {6A555565-9EA5-4382-B913-01544C52A2AB} = {6A555565-9EA5-4382-B913-01544C52A2AB} 8 | EndProjectSection 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiUnitTest", "OsiUnitTest.vcproj", "{0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}" 11 | ProjectSection(ProjectDependencies) = postProject 12 | {6A555565-9EA5-4382-B913-01544C52A2AB} = {6A555565-9EA5-4382-B913-01544C52A2AB} 13 | {109D6E6F-6D91-460F-86AE-DF27400E09A9} = {109D6E6F-6D91-460F-86AE-DF27400E09A9} 14 | EndProjectSection 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|Win32 = Debug|Win32 19 | Debug|x64 = Debug|x64 20 | DebugDLL|Win32 = DebugDLL|Win32 21 | DebugDLL|x64 = DebugDLL|x64 22 | Release|Win32 = Release|Win32 23 | Release|x64 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 26 | {6A555565-9EA5-4382-B913-01544C52A2AB}.Debug|Win32.ActiveCfg = Debug|Win32 27 | {6A555565-9EA5-4382-B913-01544C52A2AB}.Debug|Win32.Build.0 = Debug|Win32 28 | {6A555565-9EA5-4382-B913-01544C52A2AB}.Debug|x64.ActiveCfg = Debug|x64 29 | {6A555565-9EA5-4382-B913-01544C52A2AB}.Debug|x64.Build.0 = Debug|x64 30 | {6A555565-9EA5-4382-B913-01544C52A2AB}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32 31 | {6A555565-9EA5-4382-B913-01544C52A2AB}.DebugDLL|Win32.Build.0 = DebugDLL|Win32 32 | {6A555565-9EA5-4382-B913-01544C52A2AB}.DebugDLL|x64.ActiveCfg = DebugDLL|x64 33 | {6A555565-9EA5-4382-B913-01544C52A2AB}.DebugDLL|x64.Build.0 = DebugDLL|x64 34 | {6A555565-9EA5-4382-B913-01544C52A2AB}.Release|Win32.ActiveCfg = Release|Win32 35 | {6A555565-9EA5-4382-B913-01544C52A2AB}.Release|Win32.Build.0 = Release|Win32 36 | {6A555565-9EA5-4382-B913-01544C52A2AB}.Release|x64.ActiveCfg = Release|x64 37 | {6A555565-9EA5-4382-B913-01544C52A2AB}.Release|x64.Build.0 = Release|x64 38 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.ActiveCfg = Debug|Win32 39 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.Build.0 = Debug|Win32 40 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.ActiveCfg = Debug|x64 41 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.Build.0 = Debug|x64 42 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32 43 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.DebugDLL|Win32.Build.0 = DebugDLL|Win32 44 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.DebugDLL|x64.ActiveCfg = DebugDLL|x64 45 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.DebugDLL|x64.Build.0 = DebugDLL|x64 46 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.ActiveCfg = Release|Win32 47 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.Build.0 = Release|Win32 48 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.ActiveCfg = Release|x64 49 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.Build.0 = Release|x64 50 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|Win32.ActiveCfg = Debug|Win32 51 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|Win32.Build.0 = Debug|Win32 52 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|x64.ActiveCfg = Debug|x64 53 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|x64.Build.0 = Debug|x64 54 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32 55 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.DebugDLL|Win32.Build.0 = DebugDLL|Win32 56 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.DebugDLL|x64.ActiveCfg = DebugDLL|x64 57 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.DebugDLL|x64.Build.0 = DebugDLL|x64 58 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|Win32.ActiveCfg = Release|Win32 59 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|Win32.Build.0 = Release|Win32 60 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|x64.ActiveCfg = Release|x64 61 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|x64.Build.0 = Release|x64 62 | EndGlobalSection 63 | GlobalSection(SolutionProperties) = preSolution 64 | HideSolutionNode = FALSE 65 | EndGlobalSection 66 | EndGlobal 67 | -------------------------------------------------------------------------------- /.github/workflows/linux-ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Linux build and test 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | - 'stable/*' 8 | pull_request: 9 | branches: 10 | - '**' 11 | release: 12 | types: 13 | - created 14 | 15 | jobs: 16 | test: 17 | name: Run tests 18 | runs-on: ${{ matrix.os }} 19 | strategy: 20 | matrix: 21 | os: [ubuntu-22.04, ubuntu-24.04] 22 | build_static: [true, false] 23 | flags: [ADD_CXXFLAGS=-fvisibility=hidden] 24 | download_requirements: [sudo apt install -y -qq gfortran liblapack-dev libmetis-dev libnauty-dev] 25 | include: 26 | - os: macos-13 27 | build_static: false 28 | flags: CC=clang OSX=13 29 | download_requirements: brew install metis bash 30 | - os: macos-13 31 | build_static: false 32 | flags: CC=gcc-13 CXX=g++-13 OSX=13 ADD_CXXFLAGS=-Wl,-ld_classic 33 | download_requirements: brew install metis bash 34 | - os: macos-14 35 | arch: arm64 36 | build_static: false 37 | flags: CC=gcc-13 CXX=g++-13 OSX=14 ADD_CXXFLAGS=-Wl,-ld_classic 38 | download_requirements: brew install metis bash 39 | steps: 40 | - name: Checkout source 41 | uses: actions/checkout@v4 42 | with: 43 | path: ${{ github.event.repository.name }} 44 | - name: Install required packages from package manager 45 | run: ${{ matrix.download_requirements }} 46 | - name: Checkout coinbrew 47 | uses: actions/checkout@v4 48 | with: 49 | repository: coin-or/coinbrew 50 | path: coinbrew 51 | - name: Build project 52 | run: | 53 | export ${{ matrix.flags }} 54 | ADD_ARGS=() 55 | ADD_ARGS+=( --skip='ThirdParty/Metis ThirdParty/Mumps ThirdParty/Blas ThirdParty/Lapack' ) 56 | ADD_BUILD_ARGS=() 57 | ADD_BUILD_ARGS+=( --tests main --enable-relocatable ) 58 | ADD_BUILD_ARGS+=( --verbosity 2 ) 59 | [[ ${{ matrix.build_static }} == "true" ]] && \ 60 | ADD_BUILD_ARGS+=( --static --with-lapack='-llapack -lblas -lgfortran -lquadmath -lm' ) 61 | bash coinbrew/coinbrew fetch ${{ github.event.repository.name }} --skip-update \ 62 | "${ADD_ARGS[@]}" 63 | bash coinbrew/coinbrew build ${{ github.event.repository.name }} \ 64 | "${ADD_ARGS[@]}" "${ADD_BUILD_ARGS[@]}" \ 65 | ADD_CXXFLAGS="${ADD_CXXFLAGS}" CC=${CC} CXX=${CXX} 66 | [[ ${CC} ]] && CC="${CC}" || CC="" 67 | echo "CC=${CC}" >> $GITHUB_ENV 68 | - name: Archive dist contents 69 | run: | 70 | cp ${{ github.event.repository.name }}/README.md dist/ 71 | cp ${{ github.event.repository.name }}/LICENSE dist/ 72 | tar -czvf release.tar.gz -C dist . 73 | - name: Checkout package name generation script 74 | uses: actions/checkout@v4 75 | with: 76 | repository: coin-or-tools/platform-analysis-tools 77 | path: tools 78 | ref: 0.0.2 79 | - name: Retrieve platform info 80 | run: | 81 | python3 -m venv venv 82 | source venv/bin/activate 83 | pip install -r tools/requirements.txt 84 | [[ ${{ matrix.build_static }} == "true" ]] && buildtype=static || buildtype= 85 | platform_str=`python3 tools/hsf_get_platform.py -b $buildtype` 86 | echo "platform_string=${platform_str}" >> $GITHUB_ENV 87 | - name: Upload Artifact 88 | uses: actions/upload-artifact@v4 89 | with: 90 | name: ${{ github.event.repository.name }}-${{ env.platform_string }}.tar.gz 91 | path: release.tar.gz 92 | if-no-files-found: error 93 | - name: Upload package to release 94 | if: ${{ github.event_name == 'release'}} 95 | uses: actions/upload-release-asset@v1 96 | env: 97 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 98 | with: 99 | upload_url: ${{ github.event.release.upload_url }} 100 | asset_path: ./release.tar.gz 101 | asset_name: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}-${{ env.platform_string }}.tar.gz 102 | asset_content_type: application/gzip 103 | -------------------------------------------------------------------------------- /src/Osi/config.h.in: -------------------------------------------------------------------------------- 1 | /* src/Osi/config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* Define to 1 if your C++ compiler doesn't accept -c and -o together. */ 4 | #undef CXX_NO_MINUS_C_MINUS_O 5 | 6 | /* Define to 1 if GLPK has the advanced B&B solver lpx_intopt */ 7 | #undef GLPK_HAS_INTOPT 8 | 9 | /* Define to 1 if you have the header file. */ 10 | #undef HAVE_CFLOAT 11 | 12 | /* Define to 1 if you have the header file. */ 13 | #undef HAVE_CIEEEFP 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #undef HAVE_CMATH 17 | 18 | /* Define to 1 if you have the header file. */ 19 | #undef HAVE_DLFCN_H 20 | 21 | /* Define to 1 if you have the header file. */ 22 | #undef HAVE_FLOAT_H 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #undef HAVE_IEEEFP_H 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #undef HAVE_INTTYPES_H 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #undef HAVE_MATH_H 32 | 33 | /* Define to 1 if you have the header file. */ 34 | #undef HAVE_STDINT_H 35 | 36 | /* Define to 1 if you have the header file. */ 37 | #undef HAVE_STDIO_H 38 | 39 | /* Define to 1 if you have the header file. */ 40 | #undef HAVE_STDLIB_H 41 | 42 | /* Define to 1 if you have the header file. */ 43 | #undef HAVE_STRINGS_H 44 | 45 | /* Define to 1 if you have the header file. */ 46 | #undef HAVE_STRING_H 47 | 48 | /* Define to 1 if you have the header file. */ 49 | #undef HAVE_SYS_STAT_H 50 | 51 | /* Define to 1 if you have the header file. */ 52 | #undef HAVE_SYS_TYPES_H 53 | 54 | /* Define to 1 if you have the header file. */ 55 | #undef HAVE_UNISTD_H 56 | 57 | /* Define to the sub-directory where libtool stores uninstalled libraries. */ 58 | #undef LT_OBJDIR 59 | 60 | /* Library Visibility Attribute */ 61 | #undef OSICOMMONTESTLIB_EXPORT 62 | 63 | /* Library Visibility Attribute */ 64 | #undef OSICPXLIB_EXPORT 65 | 66 | /* Library Visibility Attribute */ 67 | #undef OSIGLPKLIB_EXPORT 68 | 69 | /* Library Visibility Attribute */ 70 | #undef OSIGRBLIB_EXPORT 71 | 72 | /* Library Visibility Attribute */ 73 | #undef OSILIB_EXPORT 74 | 75 | /* Library Visibility Attribute */ 76 | #undef OSIMSKLIB_EXPORT 77 | 78 | /* Library Visibility Attribute */ 79 | #undef OSISPXLIB_EXPORT 80 | 81 | /* Library Visibility Attribute */ 82 | #undef OSITEST_EXPORT 83 | 84 | /* Library Visibility Attribute */ 85 | #undef OSIXPRLIB_EXPORT 86 | 87 | /* Define to 1 if CoinUtils is available. */ 88 | #undef OSI_HAS_COINUTILS 89 | 90 | /* Define to 1 if the Cplex package is available */ 91 | #undef OSI_HAS_CPLEX 92 | 93 | /* Define to 1 if Glpk is available. */ 94 | #undef OSI_HAS_GLPK 95 | 96 | /* Define to 1 if the Gurobi package is available */ 97 | #undef OSI_HAS_GUROBI 98 | 99 | /* Define to 1 if the Mosek package is available */ 100 | #undef OSI_HAS_MOSEK 101 | 102 | /* Define to 1 if Netlib is available. */ 103 | #undef OSI_HAS_NETLIB 104 | 105 | /* Define to 1 if Sample is available. */ 106 | #undef OSI_HAS_SAMPLE 107 | 108 | /* Define to 1 if the SoPlex package is available */ 109 | #undef OSI_HAS_SOPLEX 110 | 111 | /* Define to 1 if the Xpress package is available */ 112 | #undef OSI_HAS_XPRESS 113 | 114 | /* Version number of project */ 115 | #undef OSI_VERSION 116 | 117 | /* Major version number of project. */ 118 | #undef OSI_VERSION_MAJOR 119 | 120 | /* Minor version number of project. */ 121 | #undef OSI_VERSION_MINOR 122 | 123 | /* Release version number of project. */ 124 | #undef OSI_VERSION_RELEASE 125 | 126 | /* Define to the address where bug reports for this package should be sent. */ 127 | #undef PACKAGE_BUGREPORT 128 | 129 | /* Define to the full name of this package. */ 130 | #undef PACKAGE_NAME 131 | 132 | /* Define to the full name and version of this package. */ 133 | #undef PACKAGE_STRING 134 | 135 | /* Define to the one symbol short name of this package. */ 136 | #undef PACKAGE_TARNAME 137 | 138 | /* Define to the home page for this package. */ 139 | #undef PACKAGE_URL 140 | 141 | /* Define to the version of this package. */ 142 | #undef PACKAGE_VERSION 143 | 144 | /* Define to 1 if all of the C89 standard headers exist (not just the ones 145 | required in a freestanding environment). This macro is provided for 146 | backward compatibility; new code need not use it. */ 147 | #undef STDC_HEADERS 148 | -------------------------------------------------------------------------------- /src/Osi/.ycm_extra_conf.py: -------------------------------------------------------------------------------- 1 | # For code completion in VIM and Youcompleteme include necessary COIN-OR 2 | # headers in relative paths based on the original ycm_extra_conf.py from 3 | # YouCompleteMe 4 | # Haroldo, 2019 5 | 6 | import os 7 | import ycm_core 8 | 9 | flags = [ 10 | '-Wall', 11 | '-Wextra', 12 | '-Werror', 13 | '-fopenmp', 14 | '-Wno-long-long', 15 | '-Wno-variadic-macros', 16 | '-Wno-unused-variable', 17 | '-I../../../CoinUtils/src/', 18 | '-I../../../Osi/src/Osi/', 19 | '-I../../../Clp/src/', 20 | '-I../../../Clp/src/OsiClp/', 21 | '-I../../../ThirdParty/', 22 | '-I../../../Cgl/src/', 23 | '-I../../../Cgl/src/CglPreProcess/', 24 | '-I../../../Cgl/src/CglGomory/', 25 | '-I../../../Cgl/src/CglProbing/', 26 | '-I../../../Cgl/src/CglKnapsackCover/', 27 | '-I../../../Cgl/src/CglRedSplit/', 28 | '-I../../../Cgl/src/CglRedSplit2/', 29 | '-I../../../Cgl/src/CglGMI/', 30 | '-I../../../Cgl/src/CglClique/', 31 | '-I../../../Cgl/src/CglFlowCover/', 32 | '-I../../../Cgl/src/CglMixedIntegerRounding2/', 33 | '-I../../../Cgl/src/CglTwomir/', 34 | '-I../../../Cgl/src/CglDuplicateRow/', 35 | '-I../../../Cgl/src/CglStored/', 36 | '-I../../../Cgl/src/CglLandP/', 37 | '-I../../../Cgl/src/CglResidualCapacity/', 38 | '-I../../../Cgl/src/CglZeroHalf/', 39 | '-std=c++11', 40 | '-x', 41 | 'c++' 42 | ] 43 | 44 | 45 | compilation_database_folder = '' 46 | 47 | if os.path.exists( compilation_database_folder ): 48 | database = ycm_core.CompilationDatabase( compilation_database_folder ) 49 | else: 50 | database = None 51 | 52 | SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ] 53 | 54 | def DirectoryOfThisScript(): 55 | return os.path.dirname( os.path.abspath( __file__ ) ) 56 | 57 | 58 | def MakeRelativePathsInFlagsAbsolute( flags, working_directory ): 59 | if not working_directory: 60 | return list( flags ) 61 | new_flags = [] 62 | make_next_absolute = False 63 | path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ] 64 | for flag in flags: 65 | new_flag = flag 66 | 67 | if make_next_absolute: 68 | make_next_absolute = False 69 | if not flag.startswith( '/' ): 70 | new_flag = os.path.join( working_directory, flag ) 71 | 72 | for path_flag in path_flags: 73 | if flag == path_flag: 74 | make_next_absolute = True 75 | break 76 | 77 | if flag.startswith( path_flag ): 78 | path = flag[ len( path_flag ): ] 79 | new_flag = path_flag + os.path.join( working_directory, path ) 80 | break 81 | 82 | if new_flag: 83 | new_flags.append( new_flag ) 84 | return new_flags 85 | 86 | 87 | def IsHeaderFile( filename ): 88 | extension = os.path.splitext( filename )[ 1 ] 89 | return extension in [ '.h', '.hxx', '.hpp', '.hh' ] 90 | 91 | 92 | def GetCompilationInfoForFile( filename ): 93 | # The compilation_commands.json file generated by CMake does not have entries 94 | # for header files. So we do our best by asking the db for flags for a 95 | # corresponding source file, if any. If one exists, the flags for that file 96 | # should be good enough. 97 | if IsHeaderFile( filename ): 98 | basename = os.path.splitext( filename )[ 0 ] 99 | for extension in SOURCE_EXTENSIONS: 100 | replacement_file = basename + extension 101 | if os.path.exists( replacement_file ): 102 | compilation_info = database.GetCompilationInfoForFile( 103 | replacement_file ) 104 | if compilation_info.compiler_flags_: 105 | return compilation_info 106 | return None 107 | return database.GetCompilationInfoForFile( filename ) 108 | 109 | 110 | def FlagsForFile( filename, **kwargs ): 111 | if database: 112 | # Bear in mind that compilation_info.compiler_flags_ does NOT return a 113 | # python list, but a "list-like" StringVec object 114 | compilation_info = GetCompilationInfoForFile( filename ) 115 | if not compilation_info: 116 | return None 117 | 118 | final_flags = MakeRelativePathsInFlagsAbsolute( 119 | compilation_info.compiler_flags_, 120 | compilation_info.compiler_working_dir_ ) 121 | 122 | # NOTE: This is just for YouCompleteMe; it's highly likely that your project 123 | # does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR 124 | # ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT. 125 | try: 126 | final_flags.remove( '-stdlib=libc++' ) 127 | except ValueError: 128 | pass 129 | else: 130 | relative_to = DirectoryOfThisScript() 131 | final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to ) 132 | 133 | return { 'flags': final_flags } 134 | -------------------------------------------------------------------------------- /.github/workflows/windows-ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Windows build and test 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | - 'stable/*' 8 | pull_request: 9 | branches: 10 | - '**' 11 | release: 12 | types: 13 | - created 14 | 15 | jobs: 16 | test: 17 | name: Run tests 18 | runs-on: ${{ matrix.os }} 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | include: [ 23 | { os: windows-2022, arch: x86_64, msystem: mingw64, debug: true, suffix: "-dbg" }, 24 | { os: windows-2025, arch: x86_64, msystem: mingw64, debug: false, suffix: "" }, 25 | { os: windows-2022, arch: msvc, msystem: mingw64, debug: true, suffix: "-dbg" }, 26 | { os: windows-2025, arch: msvc, msystem: mingw64, debug: false, suffix: "-md" }, 27 | ] 28 | steps: 29 | - name: Checkout source 30 | uses: actions/checkout@v4 31 | with: 32 | path: ${{ github.event.repository.name }} 33 | - name: Checkout coinbrew 34 | uses: actions/checkout@v4 35 | with: 36 | repository: coin-or/coinbrew 37 | path: coinbrew 38 | - name: Set up msvc 39 | if: ${{ matrix.arch == 'msvc' }} 40 | uses: ilammy/msvc-dev-cmd@v1 41 | - name: Set correct host flag and install requirements 42 | if: ${{ matrix.arch != 'msvc' }} 43 | run: | 44 | echo "host_flag=--host=${{ matrix.arch }}-w64-mingw32" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append 45 | C:\msys64\usr\bin\pacman -S mingw-w64-${{ matrix.arch }}-lapack mingw-w64-${{ matrix.arch }}-winpthreads-git mingw-w64-${{ matrix.arch }}-readline mingw-w64-${{ matrix.arch }}-suitesparse mingw-w64-${{ matrix.arch }}-metis --noconfirm 46 | - name: Set up msys with ${{ matrix.msystem }} 47 | uses: msys2/setup-msys2@v2 48 | with: 49 | update: true 50 | install: >- 51 | base-devel 52 | git 53 | zip 54 | path-type: inherit 55 | msystem: ${{ matrix.msystem }} 56 | - name: Build project 57 | run: | 58 | ADD_ARGS=() 59 | ADD_ARGS+=( --skip='ThirdParty/Metis ThirdParty/Mumps ThirdParty/Blas ThirdParty/Lapack' ) 60 | ADD_BUILD_ARGS=() 61 | ADD_BUILD_ARGS+=( --build=x86_64-w64-mingw32 --tests main --enable-relocatable ) 62 | ADD_BUILD_ARGS+=( --verbosity 2 ) 63 | [[ ${{ matrix.debug }} == "true" ]] && ADD_BUILD_ARGS+=( --enable-debug ) 64 | [[ ${{ matrix.arch }} == "msvc" ]] && ADD_BUILD_ARGS+=( --enable-msvc ) 65 | ./coinbrew/coinbrew fetch ${{ github.event.repository.name }} --skip-update "${ADD_ARGS[@]}" 66 | ./coinbrew/coinbrew build ${{ github.event.repository.name }} ${{ env.host_flag }} \ 67 | "${ADD_ARGS[@]}" "${ADD_BUILD_ARGS[@]}" 68 | cp ${{ github.event.repository.name }}/README.md dist/ 69 | cp ${{ github.event.repository.name }}/LICENSE dist/ 70 | shell: msys2 {0} 71 | - name: Upload failed build directory 72 | uses: actions/upload-artifact@v4 73 | if: failure() 74 | with: 75 | name: ${{ matrix.os}}-{{ matrix.arch }}-debug=${{ matrix.debug }}-failedbuild 76 | path: build 77 | - name: Generate package name for msvc 78 | run: | 79 | msvc_version=${VisualStudioVersion%.*} 80 | echo "package_suffix=w64-msvc${msvc_version}${{ matrix.suffix }}" >> $GITHUB_ENV 81 | shell: msys2 {0} 82 | if: ${{ matrix.arch == 'msvc' }} 83 | - name: Generate package name 84 | run: | 85 | echo "package_suffix=${{ matrix.arch }}-w64-${{ matrix.msystem }}${{ matrix.suffix }}" >> $GITHUB_ENV 86 | shell: msys2 {0} 87 | if: ${{ matrix.arch != 'msvc' }} 88 | - name: Upload artifact 89 | uses: actions/upload-artifact@v4 90 | with: 91 | name: ${{ github.event.repository.name }}-${{ env.package_suffix }} 92 | path: dist 93 | if-no-files-found: error 94 | - name: Zip up dist contents for release 95 | if: ${{ github.event_name == 'release'}} 96 | run: cd dist && zip -r ../release.zip * 97 | shell: msys2 {0} 98 | - name: Upload package to release 99 | if: ${{ github.event_name == 'release'}} 100 | uses: actions/upload-release-asset@v1 101 | env: 102 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 103 | with: 104 | upload_url: ${{ github.event.release.upload_url }} 105 | asset_path: ./release.zip 106 | asset_name: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}-${{ env.package_suffix }}.zip 107 | asset_content_type: application/gzip 108 | -------------------------------------------------------------------------------- /src/Osi/configall_system_msc.h: -------------------------------------------------------------------------------- 1 | /* This is the header file for the Microsoft compiler, defining all 2 | * system and compiler dependent configuration macros */ 3 | 4 | /* Define to dummy `main' function (if any) required to link to the Fortran 5 | libraries. */ 6 | /* #undef F77_DUMMY_MAIN */ 7 | 8 | #ifndef COIN_USE_F2C 9 | /* Define to a macro mangling the given C identifier (in lower and upper 10 | case), which must not contain underscores, for linking with Fortran. */ 11 | # define F77_FUNC(name,NAME) NAME 12 | 13 | /* As F77_FUNC, but for C identifiers containing underscores. */ 14 | # define F77_FUNC_(name,NAME) NAME 15 | #else 16 | /* Define to a macro mangling the given C identifier (in lower and upper 17 | case), which must not contain underscores, for linking with Fortran. */ 18 | # define F77_FUNC(name,NAME) name ## _ 19 | 20 | /* As F77_FUNC, but for C identifiers containing underscores. */ 21 | # define F77_FUNC_(name,NAME) name ## __ 22 | #endif 23 | 24 | /* Define if F77 and FC dummy `main' functions are identical. */ 25 | /* #undef FC_DUMMY_MAIN_EQ_F77 */ 26 | 27 | /* Define to 1 if you have the header file. */ 28 | /* #undef HAVE_ASSERT_H */ 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #define HAVE_CASSERT 1 32 | 33 | /* Define to 1 if you have the header file. */ 34 | #define HAVE_CCTYPE 1 35 | 36 | /* Define to 1 if you have the header file. */ 37 | #define HAVE_CFLOAT 1 38 | 39 | /* Define to 1 if you have the header file. */ 40 | /* #undef HAVE_CIEEEFP */ 41 | 42 | /* Define to 1 if you have the header file. */ 43 | #define HAVE_CMATH 1 44 | 45 | /* Define to 1 if you have the header file. */ 46 | #define HAVE_CSTDARG 1 47 | 48 | /* Define to 1 if you have the header file. */ 49 | #define HAVE_CSTDIO 1 50 | 51 | /* Define to 1 if you have the header file. */ 52 | #define HAVE_CSTDLIB 1 53 | 54 | /* Define to 1 if you have the header file. */ 55 | #define HAVE_CSTRING 1 56 | 57 | /* Define to 1 if you have the header file. */ 58 | #define HAVE_CTIME 1 59 | 60 | /* Define to 1 if you have the header file. */ 61 | #define HAVE_CSTDDEF 1 62 | 63 | /* Define to 1 if you have the header file. */ 64 | /* #undef HAVE_CTYPE_H */ 65 | 66 | /* Define to 1 if you have the header file. */ 67 | /* #undef HAVE_DLFCN_H */ 68 | 69 | /* Define to 1 if function drand48 is available */ 70 | /* #undef HAVE_DRAND48 */ 71 | 72 | /* Define to 1 if you have the header file. */ 73 | /* #undef HAVE_FLOAT_H */ 74 | 75 | /* Define to 1 if you have the header file. */ 76 | /* #undef HAVE_IEEEFP_H */ 77 | 78 | /* Define to 1 if you have the header file. */ 79 | /* #define HAVE_INTTYPES_H */ 80 | 81 | /* Define to 1 if you have the header file. */ 82 | /* #undef HAVE_MATH_H */ 83 | 84 | /* Define to 1 if you have the header file. */ 85 | #define HAVE_MEMORY_H 1 86 | 87 | /* Define to 1 if function rand is available */ 88 | #define HAVE_RAND 1 89 | 90 | /* Define to 1 if you have the header file. */ 91 | /* #undef HAVE_STDARG_H */ 92 | 93 | /* Define to 1 if you have the header file. */ 94 | /* #undef HAVE_STDINT_H */ 95 | 96 | /* Define to 1 if you have the header file. */ 97 | /* #undef HAVE_STDIO_H */ 98 | 99 | /* Define to 1 if you have the header file. */ 100 | #define HAVE_STDLIB_H 1 101 | 102 | /* Define to 1 if function std::rand is available */ 103 | #define HAVE_STD__RAND 1 104 | 105 | /* Define to 1 if you have the header file. */ 106 | /* #define HAVE_STRINGS_H */ 107 | 108 | /* Define to 1 if you have the header file. */ 109 | #define HAVE_STRING_H 1 110 | 111 | /* Define to 1 if you have the header file. */ 112 | #define HAVE_SYS_STAT_H 1 113 | 114 | /* Define to 1 if you have the header file. */ 115 | #define HAVE_SYS_TYPES_H 1 116 | 117 | /* Define to 1 if you have the header file. */ 118 | /* #undef HAVE_TIME_H */ 119 | 120 | /* Define to 1 if you have the header file. */ 121 | /* #define HAVE_UNISTD_H */ 122 | 123 | /* Define to 1 if va_copy is avaliable */ 124 | /* #undef HAVE_VA_COPY */ 125 | 126 | /* Define to 1 if you have the header file. */ 127 | /* #undef HAVE_WINDOWS_H */ 128 | 129 | /* Define to 1 if you have the `_snprintf' function. */ 130 | #define HAVE__SNPRINTF 1 131 | 132 | /* The size of a `double', as computed by sizeof. */ 133 | #define SIZEOF_DOUBLE 8 134 | 135 | /* The size of a `int', as computed by sizeof. */ 136 | #define SIZEOF_INT 4 137 | 138 | /* The size of a `int *', as computed by sizeof. */ 139 | #define SIZEOF_INT_P 8 140 | 141 | /* The size of a `long', as computed by sizeof. */ 142 | #define SIZEOF_LONG 4 143 | 144 | /* Define to 1 if you have the ANSI C header files. */ 145 | #define STDC_HEADERS 1 146 | -------------------------------------------------------------------------------- /src/Osi/OsiSolverBranch.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2005, International Business Machines 2 | // Corporation and others. All Rights Reserved. 3 | // This code is licensed under the terms of the Eclipse Public License (EPL). 4 | 5 | #ifndef OsiSolverBranch_H 6 | #define OsiSolverBranch_H 7 | 8 | #include "OsiConfig.h" 9 | 10 | class OsiSolverInterface; 11 | #include "CoinWarmStartBasis.hpp" 12 | 13 | //############################################################################# 14 | 15 | /** Solver Branch Class 16 | 17 | This provides information on a branch as a set of tighter bounds on both ways 18 | */ 19 | 20 | class OSILIB_EXPORT OsiSolverBranch { 21 | 22 | public: 23 | ///@name Add and Get methods 24 | //@{ 25 | /// Add a simple branch (i.e. first sets ub of floor(value), second lb of ceil(value)) 26 | void addBranch(int iColumn, double value); 27 | 28 | /// Add bounds - way =-1 is first , +1 is second 29 | void addBranch(int way, int numberTighterLower, const int *whichLower, const double *newLower, 30 | int numberTighterUpper, const int *whichUpper, const double *newUpper); 31 | /// Add bounds - way =-1 is first , +1 is second 32 | void addBranch(int way, int numberColumns, const double *oldLower, const double *newLower, 33 | const double *oldUpper, const double *newUpper); 34 | 35 | /// Apply bounds 36 | void applyBounds(OsiSolverInterface &solver, int way) const; 37 | /// Returns true if current solution satsifies one side of branch 38 | bool feasibleOneWay(const OsiSolverInterface &solver) const; 39 | /// Starts 40 | inline const int *starts() const 41 | { 42 | return start_; 43 | } 44 | /// Which variables 45 | inline const int *which() const 46 | { 47 | return indices_; 48 | } 49 | /// Bounds 50 | inline const double *bounds() const 51 | { 52 | return bound_; 53 | } 54 | //@} 55 | 56 | ///@name Constructors and destructors 57 | //@{ 58 | /// Default Constructor 59 | OsiSolverBranch(); 60 | 61 | /// Copy constructor 62 | OsiSolverBranch(const OsiSolverBranch &rhs); 63 | 64 | /// Assignment operator 65 | OsiSolverBranch &operator=(const OsiSolverBranch &rhs); 66 | 67 | /// Destructor 68 | ~OsiSolverBranch(); 69 | 70 | //@} 71 | 72 | private: 73 | ///@name Private member data 74 | //@{ 75 | /// Start of lower first, upper first, lower second, upper second 76 | int start_[5]; 77 | /// Column numbers (if >= numberColumns treat as rows) 78 | int *indices_; 79 | /// New bounds 80 | double *bound_; 81 | //@} 82 | }; 83 | //############################################################################# 84 | 85 | /** Solver Result Class 86 | 87 | This provides information on a result as a set of tighter bounds on both ways 88 | */ 89 | 90 | class OsiSolverResult { 91 | 92 | public: 93 | ///@name Add and Get methods 94 | //@{ 95 | /// Create result 96 | void createResult(const OsiSolverInterface &solver, const double *lowerBefore, 97 | const double *upperBefore); 98 | 99 | /// Restore result 100 | void restoreResult(OsiSolverInterface &solver) const; 101 | 102 | /// Get basis 103 | inline const CoinWarmStartBasis &basis() const 104 | { 105 | return basis_; 106 | } 107 | 108 | /// Objective value (as minimization) 109 | inline double objectiveValue() const 110 | { 111 | return objectiveValue_; 112 | } 113 | 114 | /// Primal solution 115 | inline const double *primalSolution() const 116 | { 117 | return primalSolution_; 118 | } 119 | 120 | /// Dual solution 121 | inline const double *dualSolution() const 122 | { 123 | return dualSolution_; 124 | } 125 | 126 | /// Extra fixed 127 | inline const OsiSolverBranch &fixed() const 128 | { 129 | return fixed_; 130 | } 131 | //@} 132 | 133 | ///@name Constructors and destructors 134 | //@{ 135 | /// Default Constructor 136 | OsiSolverResult(); 137 | 138 | /// Constructor from solver 139 | OsiSolverResult(const OsiSolverInterface &solver, const double *lowerBefore, 140 | const double *upperBefore); 141 | 142 | /// Copy constructor 143 | OsiSolverResult(const OsiSolverResult &rhs); 144 | 145 | /// Assignment operator 146 | OsiSolverResult &operator=(const OsiSolverResult &rhs); 147 | 148 | /// Destructor 149 | ~OsiSolverResult(); 150 | 151 | //@} 152 | 153 | private: 154 | ///@name Private member data 155 | //@{ 156 | /// Value of objective (if >= OsiSolverInterface::getInfinity() then infeasible) 157 | double objectiveValue_; 158 | /// Warm start information 159 | CoinWarmStartBasis basis_; 160 | /// Primal solution (numberColumns) 161 | double *primalSolution_; 162 | /// Dual solution (numberRows) 163 | double *dualSolution_; 164 | /// Which extra variables have been fixed (only way==-1 counts) 165 | OsiSolverBranch fixed_; 166 | //@} 167 | }; 168 | #endif 169 | 170 | /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2 171 | */ 172 | -------------------------------------------------------------------------------- /src/OsiCommonTest/OsiRowCutDebuggerTest.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2000, International Business Machines 2 | // Corporation and others. All Rights Reserved. 3 | // This code is licensed under the terms of the Eclipse Public License (EPL). 4 | 5 | #include "CoinPragma.hpp" 6 | 7 | #include "OsiUnitTests.hpp" 8 | 9 | #include "OsiRowCutDebugger.hpp" 10 | 11 | //-------------------------------------------------------------------------- 12 | // test cut debugger methods. 13 | void OsiRowCutDebuggerUnitTest(const OsiSolverInterface *baseSiP, const std::string &mpsDir) 14 | { 15 | 16 | CoinRelFltEq eq; 17 | 18 | // Test default constructor 19 | { 20 | OsiRowCutDebugger r; 21 | OSIUNITTEST_ASSERT_ERROR(r.integerVariable_ == NULL, {}, "osirowcutdebugger", "default constructor"); 22 | OSIUNITTEST_ASSERT_ERROR(r.knownSolution_ == NULL, {}, "osirowcutdebugger", "default constructor"); 23 | OSIUNITTEST_ASSERT_ERROR(r.numberColumns_ == 0, {}, "osirowcutdebugger", "default constructor"); 24 | } 25 | 26 | { 27 | // Get non trivial instance 28 | OsiSolverInterface *imP = baseSiP->clone(); 29 | std::string fn = mpsDir + "exmip1"; 30 | imP->readMps(fn.c_str(), "mps"); 31 | OSIUNITTEST_ASSERT_ERROR(imP->getNumRows() == 5, {}, "osirowcutdebugger", "read exmip1"); 32 | 33 | /* 34 | Activate the debugger. The garbled name here is deliberate; the 35 | debugger should isolate the portion of the string between '/' and 36 | '.' (in normal use, this would be the base file name, stripped of 37 | the prefix and extension). 38 | */ 39 | imP->activateRowCutDebugger("ab cd /x/ /exmip1.asc"); 40 | 41 | int i; 42 | 43 | // return debugger 44 | const OsiRowCutDebugger *debugger = imP->getRowCutDebugger(); 45 | OSIUNITTEST_ASSERT_ERROR(debugger != NULL, {}, "osirowcutdebugger", "return debugger"); 46 | OSIUNITTEST_ASSERT_ERROR(((debugger != NULL) && (debugger->numberColumns_ == 8)), {}, "osirowcutdebugger", "return debugger"); 47 | 48 | const bool type[] = { 0, 0, 1, 1, 0, 0, 0, 0 }; 49 | const double values[] = { 2.5, 0, 1, 1, 0.5, 3, 0, 0.26315789473684253 }; 50 | CoinPackedVector objCoefs(8, imP->getObjCoefficients()); 51 | 52 | bool type_ok = true; 53 | #if 0 54 | for (i=0;i<8;i++) 55 | type_ok &= type[i] == debugger->integerVariable_[i]; 56 | OSIUNITTEST_ASSERT_ERROR(type_ok, {}, "osirowcutdebugger", "???"); 57 | #endif 58 | 59 | double objValue = objCoefs.dotProduct(values); 60 | double debuggerObjValue = objCoefs.dotProduct(debugger->knownSolution_); 61 | OSIUNITTEST_ASSERT_ERROR(eq(objValue, debuggerObjValue), {}, "osirowcutdebugger", "objective value"); 62 | 63 | OsiRowCutDebugger rhs; 64 | { 65 | OsiRowCutDebugger rC1(*debugger); 66 | 67 | OSIUNITTEST_ASSERT_ERROR(rC1.numberColumns_ == 8, {}, "osirowcutdebugger", "copy constructor"); 68 | type_ok = true; 69 | for (i = 0; i < 8; i++) 70 | type_ok &= type[i] == rC1.integerVariable_[i]; 71 | OSIUNITTEST_ASSERT_ERROR(type_ok, {}, "osirowcutdebugger", "copy constructor"); 72 | OSIUNITTEST_ASSERT_ERROR(eq(objValue, objCoefs.dotProduct(rC1.knownSolution_)), {}, "osirowcutdebugger", "copy constructor"); 73 | 74 | rhs = rC1; 75 | OSIUNITTEST_ASSERT_ERROR(rhs.numberColumns_ == 8, {}, "osirowcutdebugger", "assignment operator"); 76 | type_ok = true; 77 | for (i = 0; i < 8; i++) 78 | type_ok &= type[i] == rhs.integerVariable_[i]; 79 | OSIUNITTEST_ASSERT_ERROR(type_ok, {}, "osirowcutdebugger", "assignment operator"); 80 | OSIUNITTEST_ASSERT_ERROR(eq(objValue, objCoefs.dotProduct(rhs.knownSolution_)), {}, "osirowcutdebugger", "assignment operator"); 81 | } 82 | // Test that rhs has correct values even though lhs has gone out of scope 83 | OSIUNITTEST_ASSERT_ERROR(rhs.numberColumns_ == 8, {}, "osirowcutdebugger", "assignment operator"); 84 | type_ok = true; 85 | for (i = 0; i < 8; i++) 86 | type_ok &= type[i] == rhs.integerVariable_[i]; 87 | OSIUNITTEST_ASSERT_ERROR(type_ok, {}, "osirowcutdebugger", "assignment operator"); 88 | OSIUNITTEST_ASSERT_ERROR(eq(objValue, objCoefs.dotProduct(rhs.knownSolution_)), {}, "osirowcutdebugger", "assignment operator"); 89 | 90 | OsiRowCut cut[2]; 91 | 92 | const int ne = 3; 93 | int inx[ne] = { 0, 2, 3 }; 94 | double el[ne] = { 1., 1., 1. }; 95 | cut[0].setRow(ne, inx, el); 96 | cut[0].setUb(5.); 97 | 98 | el[1] = 5; 99 | cut[1].setRow(ne, inx, el); 100 | cut[1].setUb(5); 101 | OsiCuts cs; 102 | cs.insert(cut[0]); 103 | cs.insert(cut[1]); 104 | OSIUNITTEST_ASSERT_ERROR(!debugger->invalidCut(cut[0]), {}, "osirowcutdebugger", "recognize (in)valid cut"); 105 | OSIUNITTEST_ASSERT_ERROR(debugger->invalidCut(cut[1]), {}, "osirowcutdebugger", "recognize (in)valid cut"); 106 | OSIUNITTEST_ASSERT_ERROR(debugger->validateCuts(cs, 0, 2) == 1, {}, "osirowcutdebugger", "recognize (in)valid cut"); 107 | OSIUNITTEST_ASSERT_ERROR(debugger->validateCuts(cs, 0, 1) == 0, {}, "osirowcutdebugger", "recognize (in)valid cut"); 108 | delete imP; 109 | } 110 | } 111 | 112 | /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2 113 | */ 114 | -------------------------------------------------------------------------------- /MSVisualStudio/v17/Osi.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.3.32804.467 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsi", "libOsi\libOsi.vcxproj", "{BF5C7532-EE0A-479B-9993-72134087D530}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiCommonTest", "libOsiCommonTest\libOsiCommonTest.vcxproj", "{109D6E6F-6D91-460F-86AE-DF27400E09A9}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiUnitTest", "OsiUnitTest\OsiUnitTest.vcxproj", "{FCF90EF8-93AE-482A-9B55-018B8338B99D}" 11 | EndProject 12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCoinUtils", "..\..\..\CoinUtils\MSVisualStudio\v17\libCoinUtils\libCoinUtils.vcxproj", "{6D2EF92A-D693-47E3-A325-A686E78C5FFD}" 13 | EndProject 14 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F8AFDCAA-7845-4221-8F63-45BE825B678A}" 15 | ProjectSection(SolutionItems) = preProject 16 | ..\..\AUTHORS = ..\..\AUTHORS 17 | ..\..\CHANGELOG = ..\..\CHANGELOG 18 | ..\..\LICENSE = ..\..\LICENSE 19 | ..\..\README.md = ..\..\README.md 20 | EndProjectSection 21 | EndProject 22 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{A0209C59-3B68-4EB6-8AB2-B16831D6C759}" 23 | ProjectSection(SolutionItems) = preProject 24 | ..\..\.github\workflows\linux-ci.yml = ..\..\.github\workflows\linux-ci.yml 25 | ..\..\.github\workflows\release.yml = ..\..\.github\workflows\release.yml 26 | ..\..\.github\workflows\windows-ci.yml = ..\..\.github\workflows\windows-ci.yml 27 | EndProjectSection 28 | EndProject 29 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{19F0A284-FF77-4B8D-BEF9-31775B580170}" 30 | ProjectSection(SolutionItems) = preProject 31 | OsiTest.cmd = OsiTest.cmd 32 | EndProjectSection 33 | EndProject 34 | Global 35 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 36 | Debug|x64 = Debug|x64 37 | Debug|x86 = Debug|x86 38 | Release|x64 = Release|x64 39 | Release|x86 = Release|x86 40 | EndGlobalSection 41 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 42 | {BF5C7532-EE0A-479B-9993-72134087D530}.Debug|x64.ActiveCfg = Debug|x64 43 | {BF5C7532-EE0A-479B-9993-72134087D530}.Debug|x64.Build.0 = Debug|x64 44 | {BF5C7532-EE0A-479B-9993-72134087D530}.Debug|x86.ActiveCfg = Debug|Win32 45 | {BF5C7532-EE0A-479B-9993-72134087D530}.Debug|x86.Build.0 = Debug|Win32 46 | {BF5C7532-EE0A-479B-9993-72134087D530}.Release|x64.ActiveCfg = Release|x64 47 | {BF5C7532-EE0A-479B-9993-72134087D530}.Release|x64.Build.0 = Release|x64 48 | {BF5C7532-EE0A-479B-9993-72134087D530}.Release|x86.ActiveCfg = Release|Win32 49 | {BF5C7532-EE0A-479B-9993-72134087D530}.Release|x86.Build.0 = Release|Win32 50 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.ActiveCfg = Debug|x64 51 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.Build.0 = Debug|x64 52 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x86.ActiveCfg = Debug|Win32 53 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x86.Build.0 = Debug|Win32 54 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.ActiveCfg = Release|x64 55 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.Build.0 = Release|x64 56 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x86.ActiveCfg = Release|Win32 57 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x86.Build.0 = Release|Win32 58 | {FCF90EF8-93AE-482A-9B55-018B8338B99D}.Debug|x64.ActiveCfg = Debug|x64 59 | {FCF90EF8-93AE-482A-9B55-018B8338B99D}.Debug|x64.Build.0 = Debug|x64 60 | {FCF90EF8-93AE-482A-9B55-018B8338B99D}.Debug|x86.ActiveCfg = Debug|Win32 61 | {FCF90EF8-93AE-482A-9B55-018B8338B99D}.Debug|x86.Build.0 = Debug|Win32 62 | {FCF90EF8-93AE-482A-9B55-018B8338B99D}.Release|x64.ActiveCfg = Release|x64 63 | {FCF90EF8-93AE-482A-9B55-018B8338B99D}.Release|x64.Build.0 = Release|x64 64 | {FCF90EF8-93AE-482A-9B55-018B8338B99D}.Release|x86.ActiveCfg = Release|Win32 65 | {FCF90EF8-93AE-482A-9B55-018B8338B99D}.Release|x86.Build.0 = Release|Win32 66 | {6D2EF92A-D693-47E3-A325-A686E78C5FFD}.Debug|x64.ActiveCfg = Debug|x64 67 | {6D2EF92A-D693-47E3-A325-A686E78C5FFD}.Debug|x64.Build.0 = Debug|x64 68 | {6D2EF92A-D693-47E3-A325-A686E78C5FFD}.Debug|x86.ActiveCfg = Debug|Win32 69 | {6D2EF92A-D693-47E3-A325-A686E78C5FFD}.Debug|x86.Build.0 = Debug|Win32 70 | {6D2EF92A-D693-47E3-A325-A686E78C5FFD}.Release|x64.ActiveCfg = Release|x64 71 | {6D2EF92A-D693-47E3-A325-A686E78C5FFD}.Release|x64.Build.0 = Release|x64 72 | {6D2EF92A-D693-47E3-A325-A686E78C5FFD}.Release|x86.ActiveCfg = Release|Win32 73 | {6D2EF92A-D693-47E3-A325-A686E78C5FFD}.Release|x86.Build.0 = Release|Win32 74 | EndGlobalSection 75 | GlobalSection(SolutionProperties) = preSolution 76 | HideSolutionNode = FALSE 77 | EndGlobalSection 78 | GlobalSection(NestedProjects) = preSolution 79 | {FCF90EF8-93AE-482A-9B55-018B8338B99D} = {19F0A284-FF77-4B8D-BEF9-31775B580170} 80 | {A0209C59-3B68-4EB6-8AB2-B16831D6C759} = {F8AFDCAA-7845-4221-8F63-45BE825B678A} 81 | {19F0A284-FF77-4B8D-BEF9-31775B580170} = {F8AFDCAA-7845-4221-8F63-45BE825B678A} 82 | EndGlobalSection 83 | GlobalSection(ExtensibilityGlobals) = postSolution 84 | SolutionGuid = {8D3882F5-D354-4362-9A7F-A5393F116053} 85 | EndGlobalSection 86 | EndGlobal 87 | -------------------------------------------------------------------------------- /.coin-or/projDesc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | OSI 6 | Osi 7 | 8 | The COIN-OR Open Solver Interface is a uniform API for interacting 9 | with callable solver libraries. 10 | It supports linear programming solvers as well as the ability to "finish off" 11 | a mixed-integer problem calling the solver library's MIP solver. 12 | A list of supported solvers appears at the bottom of the page. 13 | 14 | 15 | A uniform API for calling embedded linear and mixed-integer 16 | programming solvers. 17 | 18 | Matthew Saltzman, Lou Hafer 19 | https://www.github.com/coin-or/Osi 20 | Eclipse Public License 1.0 21 | http://www.opensource.org/licenses/eclipse-1.0 22 | 23 | 24 | Cbc 25 | 26 | 27 | Cgl 28 | 29 | 30 | Clp 31 | 32 | 33 | CoinUtils 34 | 35 | 36 | Data 37 | 38 | 39 | DyLP 40 | 41 | 42 | HiGHS 43 | 44 | 45 | SYMPHONY 46 | 47 | 48 | Vol 49 | 50 | 51 | 52 | 53 | CPLEX 54 | https://www.ibm.com/analytics/cplex-optimizer 55 | Optional 56 | 57 | 58 | Glpk 59 | http://www.gnu.org/software/glpk/ 60 | Optional 61 | 62 | 63 | FICO-Xpress 64 | https://www.fico.com/en/products/fico-xpress-optimization 65 | Optional 66 | 67 | 68 | Gurobi 69 | http://www.gurobi.com 70 | Optional 71 | 72 | 73 | Mosek 74 | http://www.mosek.com/ 75 | Optional 76 | 77 | 78 | SoPlex 79 | http://soplex.zib.de 80 | Optional 81 | 82 | 83 | C++ 84 | 85 | Active 86 | 5 87 | 88 | 89 | 90 | GNU/Linux 91 | gcc 92 | 93 | 94 | Mac OS X 95 | gcc 96 | 97 | 98 | Microsoft Windows with MSys2 99 | gcc, cl, icl 100 | 101 | 102 | Microsoft Windows 103 | Visual Studio, cl 104 | 105 | 106 | 107 | Interfaces 108 | 109 | 110 | OsiCpx: CPLEX 111 | OsiGlpk: GNU LP Toolkit 112 | OsiGrb: Gurobi 113 | OsiMsk: Mosek 114 | OsiSpx: Soplex 115 | OsiXpr: XPRESS-MP 116 | 117 | 118 | 119 | http://www.coin-or.org/Doxygen/Osi/ 120 | https://github.com/coin-or/Osi/ 121 | 122 | http://list.coin-or.org/mailman/listinfo/osi 123 | 124 | 125 | -------------------------------------------------------------------------------- /MSVisualStudio/v9/OsiExamplesBuild/OsiExamplesBuild.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 26 | 29 | 32 | 35 | 38 | 41 | 54 | 57 | 60 | 63 | 74 | 77 | 80 | 83 | 86 | 89 | 92 | 95 | 96 | 104 | 107 | 110 | 113 | 116 | 119 | 129 | 132 | 135 | 138 | 150 | 153 | 156 | 159 | 162 | 165 | 168 | 171 | 172 | 173 | 174 | 175 | 176 | 181 | 184 | 185 | 186 | 191 | 192 | 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /MSVisualStudio/v9/OsiExamplesBasic/OsiExamplesBasic.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 27 | 30 | 33 | 36 | 39 | 42 | 55 | 58 | 61 | 64 | 75 | 78 | 81 | 84 | 87 | 90 | 93 | 96 | 97 | 105 | 108 | 111 | 114 | 117 | 120 | 130 | 133 | 136 | 139 | 151 | 154 | 157 | 160 | 163 | 166 | 169 | 172 | 173 | 174 | 175 | 176 | 177 | 182 | 185 | 186 | 187 | 192 | 193 | 194 | 195 | 196 | 197 | -------------------------------------------------------------------------------- /MSVisualStudio/v9/OsiExamplesSpecific/OsiExamplesSpecific.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 26 | 29 | 32 | 35 | 38 | 41 | 54 | 57 | 60 | 63 | 74 | 77 | 80 | 83 | 86 | 89 | 92 | 95 | 96 | 104 | 107 | 110 | 113 | 116 | 119 | 129 | 132 | 135 | 138 | 150 | 153 | 156 | 159 | 162 | 165 | 168 | 171 | 172 | 173 | 174 | 175 | 176 | 181 | 184 | 185 | 186 | 191 | 192 | 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /MSVisualStudio/v9/OsiExamplesQuery/OsiExamplesQuery.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 27 | 30 | 33 | 36 | 39 | 42 | 55 | 58 | 61 | 64 | 75 | 78 | 81 | 84 | 87 | 90 | 93 | 96 | 97 | 105 | 108 | 111 | 114 | 117 | 120 | 130 | 133 | 136 | 139 | 151 | 154 | 157 | 160 | 163 | 166 | 169 | 172 | 173 | 174 | 175 | 176 | 177 | 182 | 185 | 186 | 187 | 192 | 193 | 194 | 195 | 196 | 197 | -------------------------------------------------------------------------------- /MSVisualStudio/v9/OsiExamplesParameters/OsiExamplesParameters.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 26 | 29 | 32 | 35 | 38 | 41 | 54 | 57 | 60 | 63 | 74 | 77 | 80 | 83 | 86 | 89 | 92 | 95 | 96 | 104 | 107 | 110 | 113 | 116 | 119 | 129 | 132 | 135 | 138 | 150 | 153 | 156 | 159 | 162 | 165 | 168 | 171 | 172 | 173 | 174 | 175 | 176 | 181 | 184 | 185 | 186 | 191 | 192 | 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /.github/workflows/windows-msvs-ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Windows MSVS build and test 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | - 'stable/*' 8 | pull_request: 9 | branches: 10 | - '**' 11 | release: 12 | types: 13 | - created 14 | 15 | jobs: 16 | test: 17 | name: Run tests 18 | runs-on: ${{ matrix.os }} 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | include: [ 23 | # Only os: windows-2022 has Visual Studio 2022 (v17) installed with toolset v143, which is required. 24 | # configuration: "Release" or "Debug", platform: "x86" or "x64". See solution Configuration Manager. 25 | { os: windows-2022, configuration: "Debug", platform: "x64" }, 26 | { os: windows-2025, configuration: "Release", platform: "x64" } 27 | ] 28 | steps: 29 | - name: Set up environment variables 30 | shell: cmd 31 | # For cmd, dont use double quotes in the echo command and dont put a space before >> %GITHUB_ENV% 32 | run: | 33 | if "${{ matrix.platform }}"=="x64" echo output_dir=x64\${{ matrix.configuration }}>> %GITHUB_ENV% 34 | if "${{ matrix.platform }}"=="x86" echo output_dir=${{ matrix.configuration }}>> %GITHUB_ENV% 35 | echo package_suffix=${{ matrix.os}}-msvs-v17-${{ matrix.configuration }}-${{ matrix.platform }}>> %GITHUB_ENV% 36 | - name: Check environment variables 37 | shell: cmd 38 | run: | 39 | echo Output directory - '${{ env.output_dir }}' 40 | echo Package suffix - '${{ env.package_suffix }}' 41 | if "${{ env.output_dir }}"=="" echo ERROR - No output_dir set, possibly unsupported platform '${{ matrix.platform }}'. Expecting x64 or x86. && exit 1 42 | - name: Checkout source 43 | uses: actions/checkout@v4 44 | with: 45 | path: ${{ github.event.repository.name }} 46 | - name: Checkout coinbrew 47 | uses: actions/checkout@v4 48 | with: 49 | repository: coin-or/coinbrew 50 | path: coinbrew 51 | - name: Set up msbuild 52 | uses: microsoft/setup-msbuild@v2 53 | - name: Set up msys for coinbrew 54 | uses: msys2/setup-msys2@v2 55 | with: 56 | update: true 57 | install: >- 58 | base-devel 59 | git 60 | zip 61 | path-type: inherit 62 | msystem: mingw64 63 | - name: Fetch project 64 | run: | 65 | ADD_ARGS=() 66 | ADD_ARGS+=( --skip='ThirdParty/Metis ThirdParty/Mumps ThirdParty/Blas ThirdParty/Lapack' ) 67 | ./coinbrew/coinbrew fetch ${{ github.event.repository.name }} --skip-update "${ADD_ARGS[@]}" 68 | echo "##################################################" 69 | echo "### Extracting Netlib and Miplib3 if available" 70 | if [ -d "./Data/Netlib/" ]; then gunzip ./Data/Netlib/*.gz; fi 71 | if [ -d "./Data/Miplib3/" ]; then gunzip ./Data/Miplib3/*.gz; fi 72 | echo "##################################################" 73 | shell: msys2 {0} 74 | - name: Build project 75 | shell: cmd 76 | run: | 77 | msbuild ${{ github.event.repository.name }}\MSVisualStudio\v17\${{ github.event.repository.name }}.sln /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }} /m 78 | - name: Test project 79 | shell: cmd 80 | run: | 81 | .\${{ github.event.repository.name }}\MSVisualStudio\v17\${{ github.event.repository.name }}Test.cmd .\${{ github.event.repository.name }}\MSVisualStudio\v17\${{ env.output_dir }} .\Data\Sample .\Data\Netlib .\Data\Miplib3 82 | - name: Install project 83 | shell: cmd 84 | run: | 85 | mkdir dist 86 | copy ${{ github.event.repository.name }}\README.* dist\. 87 | copy ${{ github.event.repository.name }}\AUTHORS.* dist\. 88 | copy ${{ github.event.repository.name }}\LICENSE.* dist\. 89 | mkdir dist\bin 90 | copy ${{ github.event.repository.name }}\MSVisualStudio\v17\${{ env.output_dir }}\*.exe dist\bin\. 91 | mkdir dist\share 92 | if exist .\Data\Sample xcopy .\Data\Sample dist\share\coin-or-sample /i 93 | if exist .\Data\Netlib xcopy .\Data\Netlib dist\share\coin-or-netlib /i 94 | if exist .\Data\Miplib3 xcopy .\Data\Miplib3 dist\share\coin-or-miplib3 /i 95 | - name: Upload artifact 96 | uses: actions/upload-artifact@v4 97 | with: 98 | name: ${{ github.event.repository.name }}-${{ env.package_suffix }} 99 | path: dist 100 | if-no-files-found: error 101 | - name: Zip up dist contents for release 102 | if: ${{ github.event_name == 'release'}} 103 | run: cd dist && zip -r ../release.zip * 104 | shell: msys2 {0} 105 | - name: Upload package to release 106 | if: ${{ github.event_name == 'release'}} 107 | uses: actions/upload-release-asset@v1 108 | env: 109 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 110 | with: 111 | upload_url: ${{ github.event.release.upload_url }} 112 | asset_path: ./release.zip 113 | asset_name: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}-${{ env.package_suffix }}.zip 114 | asset_content_type: application/gzip 115 | -------------------------------------------------------------------------------- /src/Osi/OsiSolverParameters.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2000, International Business Machines 2 | // Corporation and others. All Rights Reserved. 3 | // This code is licensed under the terms of the Eclipse Public License (EPL). 4 | 5 | #ifndef OsiSolverParameters_H 6 | #define OsiSolverParameters_H 7 | 8 | enum OsiIntParam { 9 | /*! \brief Iteration limit for initial solve and resolve. 10 | 11 | The maximum number of iterations (whatever that means for the given 12 | solver) the solver can execute in the OsiSolverinterface::initialSolve() 13 | and OsiSolverinterface::resolve() methods before terminating. 14 | */ 15 | OsiMaxNumIteration = 0, 16 | /*! \brief Iteration limit for hot start 17 | 18 | The maximum number of iterations (whatever that means for the given 19 | solver) the solver can execute in the 20 | OsiSolverinterface::solveFromHotStart() method before terminating. 21 | */ 22 | OsiMaxNumIterationHotStart, 23 | /*! \brief Handling of row and column names. 24 | 25 | The name discipline specifies how the solver will handle row and column 26 | names: 27 | - 0: Auto names: Names cannot be set by the client. Names of the form 28 | Rnnnnnnn or Cnnnnnnn are generated on demand when a name for a 29 | specific row or column is requested; nnnnnnn is derived from the row 30 | or column index. Requests for a vector of names return a vector with 31 | zero entries. 32 | - 1: Lazy names: Names supplied by the client are retained. Names of the 33 | form Rnnnnnnn or Cnnnnnnn are generated on demand if no name has been 34 | supplied by the client. Requests for a vector of names return a 35 | vector sized to the largest index of a name supplied by the client; 36 | some entries in the vector may be null strings. 37 | - 2: Full names: Names supplied by the client are retained. Names of the 38 | form Rnnnnnnn or Cnnnnnnn are generated on demand if no name has been 39 | supplied by the client. Requests for a vector of names return a 40 | vector sized to match the constraint system, and all entries will 41 | contain either the name specified by the client or a generated name. 42 | */ 43 | OsiNameDiscipline, 44 | /*! \brief End marker. 45 | 46 | Used by OsiSolverInterface to allocate a fixed-sized array to store 47 | integer parameters. 48 | */ 49 | OsiLastIntParam 50 | }; 51 | 52 | enum OsiDblParam { 53 | /*! \brief Dual objective limit. 54 | 55 | This is to be used as a termination criteria in algorithms where the dual 56 | objective changes monotonically (e.g., dual simplex, volume algorithm). 57 | */ 58 | OsiDualObjectiveLimit = 0, 59 | /*! \brief Primal objective limit. 60 | 61 | This is to be used as a termination criteria in algorithms where the 62 | primal objective changes monotonically (e.g., primal simplex) 63 | */ 64 | OsiPrimalObjectiveLimit, 65 | /*! \brief Dual feasibility tolerance. 66 | 67 | The maximum amount a dual constraint can be violated and still be 68 | considered feasible. 69 | */ 70 | OsiDualTolerance, 71 | /*! \brief Primal feasibility tolerance. 72 | 73 | The maximum amount a primal constraint can be violated and still be 74 | considered feasible. 75 | */ 76 | OsiPrimalTolerance, 77 | /** The value of any constant term in the objective function. */ 78 | OsiObjOffset, 79 | /*! \brief End marker. 80 | 81 | Used by OsiSolverInterface to allocate a fixed-sized array to store 82 | double parameters. 83 | */ 84 | OsiLastDblParam 85 | }; 86 | 87 | enum OsiStrParam { 88 | /*! \brief The name of the loaded problem. 89 | 90 | This is the string specified on the Name card of an mps file. 91 | */ 92 | OsiProbName = 0, 93 | /*! \brief The name of the solver. 94 | 95 | This parameter is read-only. 96 | */ 97 | OsiSolverName, 98 | /*! \brief End marker. 99 | 100 | Used by OsiSolverInterface to allocate a fixed-sized array to store 101 | string parameters. 102 | */ 103 | OsiLastStrParam 104 | }; 105 | 106 | enum OsiHintParam { 107 | /** Whether to do a presolve in initialSolve */ 108 | OsiDoPresolveInInitial = 0, 109 | /** Whether to use a dual algorithm in initialSolve. 110 | The reverse is to use a primal algorithm */ 111 | OsiDoDualInInitial, 112 | /** Whether to do a presolve in resolve */ 113 | OsiDoPresolveInResolve, 114 | /** Whether to use a dual algorithm in resolve. 115 | The reverse is to use a primal algorithm */ 116 | OsiDoDualInResolve, 117 | /** Whether to scale problem */ 118 | OsiDoScale, 119 | /** Whether to create a non-slack basis (only in initialSolve) */ 120 | OsiDoCrash, 121 | /** Whether to reduce amount of printout, e.g., for branch and cut */ 122 | OsiDoReducePrint, 123 | /** Whether we are in branch and cut - so can modify behavior */ 124 | OsiDoInBranchAndCut, 125 | /** Just a marker, so that OsiSolverInterface can allocate a static sized 126 | array to store parameters. */ 127 | OsiLastHintParam 128 | }; 129 | 130 | enum OsiHintStrength { 131 | /** Ignore hint (default) */ 132 | OsiHintIgnore = 0, 133 | /** This means it is only a hint */ 134 | OsiHintTry, 135 | /** This means do hint if at all possible */ 136 | OsiHintDo, 137 | /** And this means throw an exception if not possible */ 138 | OsiForceDo 139 | }; 140 | 141 | #endif 142 | 143 | /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2 144 | */ 145 | -------------------------------------------------------------------------------- /src/Osi/OsiAuxInfo.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006, International Business Machines 2 | // Corporation and others. All Rights Reserved. 3 | // This code is licensed under the terms of the Eclipse Public License (EPL). 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "CoinPragma.hpp" 11 | #include "CoinHelperFunctions.hpp" 12 | #include "OsiSolverInterface.hpp" 13 | #include "OsiAuxInfo.hpp" 14 | 15 | // Default Constructor 16 | OsiAuxInfo::OsiAuxInfo(void *appData) 17 | : appData_(appData) 18 | { 19 | } 20 | 21 | // Destructor 22 | OsiAuxInfo::~OsiAuxInfo() 23 | { 24 | } 25 | 26 | // Clone 27 | OsiAuxInfo * 28 | OsiAuxInfo::clone() const 29 | { 30 | return new OsiAuxInfo(*this); 31 | } 32 | 33 | // Copy constructor 34 | OsiAuxInfo::OsiAuxInfo(const OsiAuxInfo &rhs) 35 | : appData_(rhs.appData_) 36 | { 37 | } 38 | OsiAuxInfo & 39 | OsiAuxInfo::operator=(const OsiAuxInfo &rhs) 40 | { 41 | if (this != &rhs) { 42 | appData_ = rhs.appData_; 43 | } 44 | return *this; 45 | } 46 | // Default Constructor 47 | OsiBabSolver::OsiBabSolver(int solverType) 48 | : OsiAuxInfo() 49 | , bestObjectiveValue_(1.0e100) 50 | , mipBound_(-1.0e100) 51 | , solver_(NULL) 52 | , bestSolution_(NULL) 53 | , beforeLower_(NULL) 54 | , beforeUpper_(NULL) 55 | , extraInfo_(NULL) 56 | , solverType_(solverType) 57 | , sizeSolution_(0) 58 | , extraCharacteristics_(0) 59 | { 60 | } 61 | 62 | // Destructor 63 | OsiBabSolver::~OsiBabSolver() 64 | { 65 | delete[] bestSolution_; 66 | } 67 | 68 | // Clone 69 | OsiAuxInfo * 70 | OsiBabSolver::clone() const 71 | { 72 | return new OsiBabSolver(*this); 73 | } 74 | 75 | // Copy constructor 76 | OsiBabSolver::OsiBabSolver(const OsiBabSolver &rhs) 77 | : OsiAuxInfo(rhs) 78 | , bestObjectiveValue_(rhs.bestObjectiveValue_) 79 | , mipBound_(rhs.mipBound_) 80 | , solver_(rhs.solver_) 81 | , bestSolution_(NULL) 82 | , beforeLower_(rhs.beforeLower_) 83 | , beforeUpper_(rhs.beforeUpper_) 84 | , extraInfo_(rhs.extraInfo_) 85 | , solverType_(rhs.solverType_) 86 | , sizeSolution_(rhs.sizeSolution_) 87 | , extraCharacteristics_(rhs.extraCharacteristics_) 88 | { 89 | if (rhs.bestSolution_) { 90 | assert(solver_); 91 | bestSolution_ = CoinCopyOfArray(rhs.bestSolution_, sizeSolution_); 92 | } 93 | } 94 | OsiBabSolver & 95 | OsiBabSolver::operator=(const OsiBabSolver &rhs) 96 | { 97 | if (this != &rhs) { 98 | OsiAuxInfo::operator=(rhs); 99 | delete[] bestSolution_; 100 | solver_ = rhs.solver_; 101 | solverType_ = rhs.solverType_; 102 | bestObjectiveValue_ = rhs.bestObjectiveValue_; 103 | bestSolution_ = NULL; 104 | mipBound_ = rhs.mipBound_; 105 | sizeSolution_ = rhs.sizeSolution_; 106 | extraCharacteristics_ = rhs.extraCharacteristics_; 107 | beforeLower_ = rhs.beforeLower_; 108 | beforeUpper_ = rhs.beforeUpper_; 109 | extraInfo_ = rhs.extraInfo_; 110 | if (rhs.bestSolution_) { 111 | assert(solver_); 112 | bestSolution_ = CoinCopyOfArray(rhs.bestSolution_, sizeSolution_); 113 | } 114 | } 115 | return *this; 116 | } 117 | // Returns 1 if solution, 0 if not 118 | int OsiBabSolver::solution(double &solutionValue, 119 | double *betterSolution, 120 | int numberColumns) 121 | { 122 | if (!solver_) 123 | return 0; 124 | //printf("getSol %x solution_address %x - value %g\n", 125 | // this,bestSolution_,bestObjectiveValue_); 126 | if (bestObjectiveValue_ < solutionValue && bestSolution_) { 127 | // new solution 128 | memcpy(betterSolution, bestSolution_, std::min(numberColumns, sizeSolution_) * sizeof(double)); 129 | if (sizeSolution_ < numberColumns) 130 | CoinZeroN(betterSolution + sizeSolution_, numberColumns - sizeSolution_); 131 | solutionValue = bestObjectiveValue_; 132 | // free up 133 | //delete [] bestSolution_; 134 | //bestSolution_=NULL; 135 | //bestObjectiveValue_=1.0e100; 136 | return 1; 137 | } else { 138 | return 0; 139 | } 140 | } 141 | 142 | bool OsiBabSolver::hasSolution(double &solutionValue, double *solution) 143 | { 144 | if (!bestSolution_) 145 | return false; 146 | 147 | int numberColumns = solver_->getNumCols(); 148 | memcpy(solution, bestSolution_, numberColumns * sizeof(double)); 149 | solutionValue = bestObjectiveValue_; 150 | return true; 151 | } 152 | 153 | // set solution 154 | void OsiBabSolver::setSolution(const double *solution, int numberColumns, double objectiveValue) 155 | { 156 | assert(solver_); 157 | // just in case size has changed 158 | delete[] bestSolution_; 159 | sizeSolution_ = std::min(solver_->getNumCols(), numberColumns); 160 | bestSolution_ = new double[sizeSolution_]; 161 | CoinZeroN(bestSolution_, sizeSolution_); 162 | CoinMemcpyN(solution, std::min(sizeSolution_, numberColumns), bestSolution_); 163 | bestObjectiveValue_ = objectiveValue * solver_->getObjSense(); 164 | } 165 | // Get objective (well mip bound) 166 | double 167 | OsiBabSolver::mipBound() const 168 | { 169 | assert(solver_); 170 | if (solverType_ != 3) 171 | return solver_->getObjSense() * solver_->getObjValue(); 172 | else 173 | return mipBound_; 174 | } 175 | // Returns true if node feasible 176 | bool OsiBabSolver::mipFeasible() const 177 | { 178 | assert(solver_); 179 | if (solverType_ == 0 || solverType_ == 4) 180 | return true; 181 | else if (solverType_ != 3) 182 | return solver_->isProvenOptimal(); 183 | else 184 | return mipBound_ < 1.0e50; 185 | } 186 | 187 | void OsiBabSolver::setSolverType(int value) 188 | { 189 | solverType_ = value; 190 | } 191 | 192 | 193 | /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2 194 | */ 195 | -------------------------------------------------------------------------------- /.coin-or/generate_readme: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Exit when command fails 4 | set -e 5 | #Attempt to use undefined variable outputs error message, and forces an exit 6 | set -u 7 | #Causes a pipeline to return the exit status of the last command in the pipe 8 | #that returned a non-zero return value. 9 | set -o pipefail 10 | #set -x 11 | 12 | source $COINBREW_HOME/scripts/generate_readme 13 | 14 | pushd . > /dev/null 15 | cd $(dirname $0) 16 | SCRIPT_DIR=$PWD 17 | popd > /dev/null 18 | 19 | create_variables $SCRIPT_DIR/config.yml 20 | 21 | make_header 22 | 23 | echo "Osi (*O*pen *S*olver *I*nterface) provides an abstract base class to a generic linear programming (LP) solver, along with derived classes for specific solvers. 24 | Many applications may be able to use the Osi to insulate themselves from a specific LP solver. 25 | That is, programs written to the OSI standard may be linked to any solver with an OSI interface and should produce correct results. 26 | The OSI has been significantly extended compared to its first incarnation. 27 | Currently, the OSI supports linear programming solvers and has rudimentary support for integer programming. 28 | Among others the following operations are supported: 29 | * creating the LP formulation; 30 | * directly modifying the formulation by adding rows/columns; 31 | * modifying the formulation by adding cutting planes provided by [CGL](https://www.github.com/coin-or/Cgl); 32 | * solving the formulation (and resolving after modifications); 33 | * extracting solution information; 34 | * invoking the underlying solver's branch-and-bound component. 35 | 36 | The following is a list of derived Osi classes: 37 | 38 | |Solver|Derived Class|Note| 39 | |------|-------------|----| 40 | |[Cbc](https://www.github.com/coin-or/Cbc)|OsiCbc| unmaintained | 41 | |[Clp](https://www.github.com/coin-or/Clp)|OsiClp| | 42 | |[CPLEX](https://www.ibm.com/analytics/cplex-optimizer)|OsiCpx| | 43 | |[DyLP](https://www.github.com/coin-or/DyLP)|OsiDylp| | 44 | |[GLPK](http://www.gnu.org/software/glpk/glpk.html)|OsiGlpk| Glpk | 45 | |[Gurobi](http://www.gurobi.com)|OsiGrb| | 46 | |[MOSEK](http://www.mosek.com)|OsiMsk| | 47 | |[SoPlex](http://soplex.zib.de)|OsiSpx| SoPlex < 4.0 | 48 | |[SYMPHONY](https://www.github.com/coin-or/SYMPHONY)|OsiSym| | 49 | |[Vol](https://www.github.com/coin-or/Vol)|OsiVol| | 50 | |[XPRESS-MP](https://www.fico.com/en/products/fico-xpress-optimization)|OsiXpr| | 51 | 52 | Each solver interface is in a separate directory of Osi or distributed 53 | with the solver itself. 54 | 55 | Within COIN-OR, Osi is used by [Cgl](https://www.github.com/coin-or/Cgl), [Cbc](https://www.github.com/coin-or/Cbc), and [Bcp](https://www.github.com/coin-or/Bcp), among others. 56 | 57 | The main project managers are Lou Hafer (@LouHafer) and Matt Saltzmann (@mjsaltzman). 58 | 59 | An incomplete list of recent changes to Osi are found in the [CHANGELOG](Osi/CHANGELOG) 60 | " 61 | 62 | make_build_info 63 | 64 | make_doxygen_info 65 | 66 | echo "## Project Links 67 | 68 | * [Code of Conduct](https://www.coin-or.org/code-of-conduct/) 69 | * [COIN-OR Web Site](http://www.coin-or.org/) 70 | * [Discussion forum](https://github.com/coin-or/Osi/discussions) 71 | * [Report a bug](https://github.com/coin-or/Osi/issues/new) 72 | * [Doxygen-generated html documentation](https://coin-or.github.io/Osi/Doxygen) 73 | * [OSI2 Discussion](https://github.com/coin-or/Osi2/discussions) 74 | * The most recent tutorial on OSI can be accessed from the [page on presentations from the 2004 CORS/INFORMS Joint Meeting in Banff](http://www.coin-or.org/Presentations/CORSINFORMSWorkshop04/index.html). 75 | * [The COIN-OR Open Solver Interface: Technology Overview](http://www.coin-or.org/Presentations/CORS2004-OSI.pdf): An overview of the COIN-OR OSI and design issues for a next-generation version given at CORS/INFORMS 2004 by Matthew Saltzman. 76 | 77 | ------- 78 | 79 | ## Dynamically loading commercial solver libraries 80 | 81 | ### At build time 82 | 83 | It is possible to create an osi build that supports cplex, gurobi and xpress even if you don't have (yet) any of these solvers on your machine using [lazylpsolverlibs](https://code.google.com/p/lazylpsolverlibs/). To do so, follow these steps: 84 | 85 | 1. Install lazylpsolverlibs (follow the instructions of the [lazylpsolverlibs wiki](https://code.google.com/p/lazylpsolverlibs/wiki/HowToSetup)) 86 | 2. Use the following command line to configure Osi: 87 | \`\`\` 88 | ./configure --with-cplex-incdir=\"\$(pkg-config --variable=includedir lazycplex)/lazylpsolverlibs/ilcplex\" \\ 89 | --with-cplex-lib=\"\$(pkg-config --libs lazycplex)\" \\ 90 | --with-gurobi-incdir=\"\$(pkg-config --variable=includedir lazygurobi)/lazylpsolverlibs\" \\ 91 | --with-gurobi-lib=\"\$(pkg-config --libs lazygurobi)\" \\ 92 | --with-xpress-incdir=\"\$(pkg-config --variable=includedir lazyxprs)/lazylpsolverlibs\" \\ 93 | --with-xpress-lib=\"\$(pkg-config --libs lazyxprs)\" 94 | \`\`\` 95 | 3. Then follow the normal installation process (make, make install) 96 | 97 | ### At run time 98 | 99 | Your build should now support cplex, gurobi and xpress, which means that if you install one of these solvers, osi will be able to use it. 100 | At run time, you just need to point one of the environment variables LAZYLPSOLVERLIBS_GUROBI_LIB, LAZYLPSOLVERLIBS_CPLEX_LIB or LAZYLPSOLVERLIBS_XPRS_LIB to the full path of the corresponding solver library. 101 | For example: 102 | \`\`\` 103 | export LAZYLPSOLVERLIBS_CPLEX_LIB=/usr/ilog/cplex121/bin/x86_debian4.0_4.1/libcplex121.so 104 | \`\`\` 105 | 106 | ### Troubleshooting 107 | 108 | If pkg-config reports errors during the configure step, try modifying the PKG_CONFIG_PATH variable. Most likely, you need to do: 109 | \`\`\` 110 | export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig 111 | \`\`\` 112 | " 113 | 114 | -------------------------------------------------------------------------------- /MSVisualStudio/v10alt/genDefForOsi.ps1: -------------------------------------------------------------------------------- 1 | # Usage: genDefForOsi.ps 2 | # should be $(IntDir) in VS 3 | # is one of Osi, OsiCommonTest 4 | 5 | $VSPathComponents = ,'C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE' 6 | $VSPathComponents += 'C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN' 7 | $VSPathComponents += 'C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools' 8 | $VSPathComponents += 'C:\Windows\Microsoft.NET\Framework\v3.5' 9 | $VSPathComponents += 'C:\Windows\Microsoft.NET\Framework\v2.0.50727' 10 | $VSPathComponents += 'C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCPackages' 11 | $VSPathComponents += 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin' 12 | echo "Checking path for VS directories ..." 13 | foreach ($VSComponent in $VSPathComponents) 14 | { if ("$env:PATH" -notlike "*$VSComponent*") 15 | { echo "Prepending $VSComponent" 16 | $env:PATH = "$VSComponent;"+$env:PATH } } 17 | 18 | $objPath = $Args[0] 19 | $tgtBase = $Args[1] 20 | 21 | "Looking in $objPath ..." 22 | 23 | switch ($tgtBase) 24 | { "Osi" 25 | { $fileNames = "OsiAuxInfo.obj","OsiBranchingObject.obj","OsiChooseVariable.obj" 26 | $fileNames += "OsiColCut.obj","OsiCut.obj","OsiCuts.obj","OsiNames.obj" 27 | $fileNames += "OsiPresolve.obj","OsiRowCut.obj","OsiRowCutDebugger.obj" 28 | $fileNames += "OsiSolverBranch.obj","OsiSolverInterface.obj" 29 | $babyString = ".*Osi.*" 30 | break } 31 | "OsiCommonTest" 32 | { $fileNames = "OsiColCutTest.obj","OsiCutsTest.obj","OsiNetlibTest.obj" 33 | $fileNames += "OsiRowCutDebuggerTest.obj","OsiRowCutTest.obj","OsiSimplexAPITest.obj" 34 | $fileNames += "OsiSolverInterfaceTest.obj","OsiUnitTestUtils.obj" 35 | $babyString = ".*Osi.*" 36 | break } 37 | default 38 | { echo "Unrecognised target $tgtBase; valid choices are Osi, OsiCommonTest" 39 | return 40 | break } 41 | } 42 | $objFiles = @() 43 | foreach ($fileName in $fileNames) 44 | { $objFiles += get-item -path $objPath\$fileName } 45 | 46 | if ($objfiles.length -eq 0) 47 | { Out-Default -InputObject "No file selected" 48 | return 1 } 49 | 50 | 51 | $libTgt = "lib"+$tgtBase 52 | $tgtDLL = $libTgt+".dll" 53 | $tgtDef = $libTgt+".def" 54 | echo "Target is $tgtDLL" 55 | 56 | $defFile = new-item -path $objPath -name $tgtDef -type "file" -force 57 | add-content -path $defFile -value "LIBRARY $libTgt`r`n`r`nEXPORTS" 58 | 59 | $tmpfile = "$objPath\gendef.tmp.out" 60 | # "Using $tmpfile" 61 | $totalSyms = 0 62 | echo "Processing files ... " 63 | foreach ($file in $objFiles) 64 | { # get-member -inputobject $file 65 | $fileBase = $file.basename 66 | write-output $fileBase 67 | 68 | # The following line works just fine when this script is invoked directly 69 | # from powershell, and indirectly from a cmd window. But when it's invoked 70 | # as the pre-link event in VS, VS does something to output redirection that 71 | # causes all output to appear in the VS output window. Sending the dumpbin 72 | # output to a file fixes the problem until I can figure out how to block VS's 73 | # redirection of output. 74 | # $symbols = dumpbin /symbols $file 75 | $junk = dumpbin /OUT:$tmpfile /symbols $file 76 | $symbols = get-content $tmpfile 77 | 78 | # Eliminate Static symbols. Likewise labels. 79 | $symbols = $symbols -notmatch '^.*Static[^|]*\|.*$' 80 | $symbols = $symbols -notmatch '^.*Label[^|]*\|.*$' 81 | 82 | # Trim off the junk fore and aft. Some lines have no trailing information, 83 | # hence the second pattern 84 | $symbols = $symbols -replace '^.*\| ([^ ]+) .*$','$1' 85 | $symbols = $symbols -replace '^.*\| ([^ ]+)$','$1' 86 | 87 | # Lines we want will have @@ in the decorated name 88 | $filteredSymbols = $symbols -like "*@@*" 89 | $symLen = $filteredSymbols.length 90 | "Grabbed $symLen symbols" 91 | 92 | # Anything with "...@@$$..." seems to be invalid (either an artifact or a 93 | # system routine). But on occasion (template classes) it seems that the 94 | # required signature (@@$$F -> @@) is needed but isn't generated. So let's 95 | # try synthesizing it on the fly here. 96 | $filteredSymbols = $filteredSymbols -replace '@@\$\$F','@@' 97 | $filteredSymbols = $filteredSymbols -notlike '*@@$$*' 98 | 99 | # Lines with symbols that start with _ look to be compiler artifacts. Some 100 | # are acceptable to the linker, some not. It doesn't seem necessary to 101 | # export any of them. There's considerable, but not total, overlap between 102 | # this class of symbols and the previous class. 103 | $filteredSymbols = $filteredSymbols -notmatch '^_.*' 104 | 105 | # These are not acceptable to the linker, no specific reason given. 106 | $filteredSymbols = $filteredSymbols -notmatch '^\?\?.@\$\$.*' 107 | 108 | # Lines with symbols that start with ??_[EG] are deleting destructors 109 | # (whatever that is) and should not be exported. 110 | $filteredSymbols = $filteredSymbols -notmatch '^\?\?_[EG].*' 111 | $symLen = $filteredSymbols.length 112 | "Initial filtering leaves $symLen" 113 | 114 | # std:: is not our problem, but we have to be a little bit careful not 115 | # to throw out the baby with the bathwater. It's not possible (as best 116 | # I can see) to distinguish std:: in a parameter vs. std:: as the name 117 | # space for the method without knowing a lot more about the mangling 118 | # algorithm. Toss the bath, then retrieve the baby. 119 | $notStd = $filteredSymbols -notlike "*@std@@*" 120 | $bathwaterAndBaby = $filteredSymbols -like "*@std@@*" 121 | $baby = $bathwaterAndBaby -match "$babyString" 122 | $filteredSymbols = $notStd+$baby 123 | "Removing std:: leaves $symLen" 124 | $filteredSymbols = $filteredSymbols | sort-object -unique 125 | $symLen = $filteredSymbols.length 126 | "$symLen unique symbols" 127 | $totalSyms += $symLen 128 | 129 | add-content -path $defFile -value "`r`n; $fileBase" 130 | add-content -path $defFile -value $filteredSymbols 131 | } 132 | 133 | remove-item $tmpfile 134 | "Collected $totalSyms symbols." 135 | 136 | return 137 | -------------------------------------------------------------------------------- /MSVisualStudio/v9alt/genDefForOsi.ps1: -------------------------------------------------------------------------------- 1 | # Usage: genDefForOsi.ps 2 | # should be $(IntDir) in VS 3 | # is one of Osi, OsiCommonTest 4 | 5 | $VSPathComponents = ,'C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE' 6 | $VSPathComponents += 'C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN' 7 | $VSPathComponents += 'C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools' 8 | $VSPathComponents += 'C:\Windows\Microsoft.NET\Framework\v3.5' 9 | $VSPathComponents += 'C:\Windows\Microsoft.NET\Framework\v2.0.50727' 10 | $VSPathComponents += 'C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCPackages' 11 | $VSPathComponents += 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin' 12 | echo "Checking path for VS directories ..." 13 | foreach ($VSComponent in $VSPathComponents) 14 | { if ("$env:PATH" -notlike "*$VSComponent*") 15 | { echo "Prepending $VSComponent" 16 | $env:PATH = "$VSComponent;"+$env:PATH } } 17 | 18 | $objPath = $Args[0] 19 | $tgtBase = $Args[1] 20 | 21 | "Looking in $objPath ..." 22 | 23 | switch ($tgtBase) 24 | { "Osi" 25 | { $fileNames = "OsiAuxInfo.obj","OsiBranchingObject.obj","OsiChooseVariable.obj" 26 | $fileNames += "OsiColCut.obj","OsiCut.obj","OsiCuts.obj","OsiNames.obj" 27 | $fileNames += "OsiPresolve.obj","OsiRowCut.obj","OsiRowCutDebugger.obj" 28 | $fileNames += "OsiSolverBranch.obj","OsiSolverInterface.obj" 29 | $babyString = ".*Osi.*" 30 | break } 31 | "OsiCommonTest" 32 | { $fileNames = "OsiColCutTest.obj","OsiCutsTest.obj","OsiNetlibTest.obj" 33 | $fileNames += "OsiRowCutDebuggerTest.obj","OsiRowCutTest.obj","OsiSimplexAPITest.obj" 34 | $fileNames += "OsiSolverInterfaceTest.obj","OsiUnitTestUtils.obj" 35 | $babyString = ".*Osi.*" 36 | break } 37 | default 38 | { echo "Unrecognised target $tgtBase; valid choices are Osi, OsiCommonTest" 39 | return 40 | break } 41 | } 42 | $objFiles = @() 43 | foreach ($fileName in $fileNames) 44 | { $objFiles += get-item -path $objPath\$fileName } 45 | 46 | if ($objfiles.length -eq 0) 47 | { Out-Default -InputObject "No file selected" 48 | return 1 } 49 | 50 | 51 | $libTgt = "lib"+$tgtBase 52 | $tgtDLL = $libTgt+".dll" 53 | $tgtDef = $libTgt+".def" 54 | echo "Target is $tgtDLL" 55 | 56 | $defFile = new-item -path $objPath -name $tgtDef -type "file" -force 57 | add-content -path $defFile -value "LIBRARY $libTgt`r`n`r`nEXPORTS" 58 | 59 | $tmpfile = "$objPath\gendef.tmp.out" 60 | # "Using $tmpfile" 61 | $totalSyms = 0 62 | echo "Processing files ... " 63 | foreach ($file in $objFiles) 64 | { # get-member -inputobject $file 65 | $fileBase = $file.basename 66 | write-output $fileBase 67 | 68 | # The following line works just fine when this script is invoked directly 69 | # from powershell, and indirectly from a cmd window. But when it's invoked 70 | # as the pre-link event in VS, VS does something to output redirection that 71 | # causes all output to appear in the VS output window. Sending the dumpbin 72 | # output to a file fixes the problem until I can figure out how to block VS's 73 | # redirection of output. 74 | # $symbols = dumpbin /symbols $file 75 | $junk = dumpbin /OUT:$tmpfile /symbols $file 76 | $symbols = get-content $tmpfile 77 | 78 | # Eliminate Static symbols. Likewise labels. 79 | $symbols = $symbols -notmatch '^.*Static[^|]*\|.*$' 80 | $symbols = $symbols -notmatch '^.*Label[^|]*\|.*$' 81 | 82 | # Trim off the junk fore and aft. Some lines have no trailing information, 83 | # hence the second pattern 84 | $symbols = $symbols -replace '^.*\| ([^ ]+) .*$','$1' 85 | $symbols = $symbols -replace '^.*\| ([^ ]+)$','$1' 86 | 87 | # Lines we want will have @@ in the decorated name 88 | $filteredSymbols = $symbols -like "*@@*" 89 | $symLen = $filteredSymbols.length 90 | "Grabbed $symLen symbols" 91 | 92 | # Anything with "...@@$$..." seems to be invalid (either an artifact or a 93 | # system routine). But on occasion (template classes) it seems that the 94 | # required signature (@@$$F -> @@) is needed but isn't generated. So let's 95 | # try synthesizing it on the fly here. 96 | $filteredSymbols = $filteredSymbols -replace '@@\$\$F','@@' 97 | $filteredSymbols = $filteredSymbols -notlike '*@@$$*' 98 | 99 | # Lines with symbols that start with _ look to be compiler artifacts. Some 100 | # are acceptable to the linker, some not. It doesn't seem necessary to 101 | # export any of them. There's considerable, but not total, overlap between 102 | # this class of symbols and the previous class. 103 | $filteredSymbols = $filteredSymbols -notmatch '^_.*' 104 | 105 | # These are not acceptable to the linker, no specific reason given. 106 | $filteredSymbols = $filteredSymbols -notmatch '^\?\?.@\$\$.*' 107 | 108 | # Lines with symbols that start with ??_[EG] are deleting destructors 109 | # (whatever that is) and should not be exported. 110 | $filteredSymbols = $filteredSymbols -notmatch '^\?\?_[EG].*' 111 | $symLen = $filteredSymbols.length 112 | "Initial filtering leaves $symLen" 113 | 114 | # std:: is not our problem, but we have to be a little bit careful not 115 | # to throw out the baby with the bathwater. It's not possible (as best 116 | # I can see) to distinguish std:: in a parameter vs. std:: as the name 117 | # space for the method without knowing a lot more about the mangling 118 | # algorithm. Toss the bath, then retrieve the baby. 119 | $notStd = $filteredSymbols -notlike "*@std@@*" 120 | $bathwaterAndBaby = $filteredSymbols -like "*@std@@*" 121 | $baby = $bathwaterAndBaby -match "$babyString" 122 | $filteredSymbols = $notStd+$baby 123 | "Removing std:: leaves $symLen" 124 | $filteredSymbols = $filteredSymbols | sort-object -unique 125 | $symLen = $filteredSymbols.length 126 | "$symLen unique symbols" 127 | $totalSyms += $symLen 128 | 129 | add-content -path $defFile -value "`r`n; $fileBase" 130 | add-content -path $defFile -value $filteredSymbols 131 | } 132 | 133 | remove-item $tmpfile 134 | "Collected $totalSyms symbols." 135 | 136 | return 137 | -------------------------------------------------------------------------------- /MSVisualStudio/v10/Osi.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 11.00 2 | # Visual Studio 2010 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsi", "libOsi\libOsi.vcxproj", "{7D98E2CB-876E-4F75-9F71-77D3FE87E149}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCoinUtils", "..\..\..\CoinUtils\MSVisualStudio\v10\libCoinUtils\libCoinUtils.vcxproj", "{C4867F15-438D-4FF8-8388-62FBAAA9786C}" 6 | EndProject 7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiExamplesBasic", "OsiExamplesBasic\OsiExamplesBasic.vcxproj", "{B874A948-B5F4-4501-9735-BD9586C5216D}" 8 | EndProject 9 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiExamplesBuild", "OsiExamplesBuild\OsiExamplesBuild.vcxproj", "{1864FDC9-F116-4EB0-9B3F-6FD11E0307B4}" 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiExamplesParameters", "OsiExamplesParameters\OsiExamplesParameters.vcxproj", "{C0F44D7F-B535-44DC-9125-515E813A1753}" 12 | EndProject 13 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiExamplesQuery", "OsiExamplesQuery\OsiExamplesQuery.vcxproj", "{E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C}" 14 | EndProject 15 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiExamplesSpecific", "OsiExamplesSpecific\OsiExamplesSpecific.vcxproj", "{B5A702D5-C5F7-40EE-99E0-A500AE91528A}" 16 | EndProject 17 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libOsiCommonTest", "libOsiCommonTest\libOsiCommonTest.vcxproj", "{109D6E6F-6D91-460F-86AE-DF27400E09A9}" 18 | EndProject 19 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OsiUnitTest", "OsiUnitTest\OsiUnitTest.vcxproj", "{0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}" 20 | EndProject 21 | Global 22 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 23 | Debug|Win32 = Debug|Win32 24 | Debug|x64 = Debug|x64 25 | Release|Win32 = Release|Win32 26 | Release|x64 = Release|x64 27 | EndGlobalSection 28 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 29 | {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.ActiveCfg = Debug|Win32 30 | {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|Win32.Build.0 = Debug|Win32 31 | {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.ActiveCfg = Debug|x64 32 | {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Debug|x64.Build.0 = Debug|x64 33 | {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.ActiveCfg = Release|Win32 34 | {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|Win32.Build.0 = Release|Win32 35 | {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.ActiveCfg = Release|x64 36 | {7D98E2CB-876E-4F75-9F71-77D3FE87E149}.Release|x64.Build.0 = Release|x64 37 | {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.ActiveCfg = Debug|Win32 38 | {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|Win32.Build.0 = Debug|Win32 39 | {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.ActiveCfg = Debug|x64 40 | {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Debug|x64.Build.0 = Debug|x64 41 | {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.ActiveCfg = Release|Win32 42 | {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|Win32.Build.0 = Release|Win32 43 | {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.ActiveCfg = Release|x64 44 | {C4867F15-438D-4FF8-8388-62FBAAA9786C}.Release|x64.Build.0 = Release|x64 45 | {B349E853-2E2B-468E-8853-184ACD948678}.Debug|Win32.ActiveCfg = Debug|Win32 46 | {B349E853-2E2B-468E-8853-184ACD948678}.Debug|x64.ActiveCfg = Debug|Win32 47 | {B349E853-2E2B-468E-8853-184ACD948678}.Release|Win32.ActiveCfg = Release|Win32 48 | {B349E853-2E2B-468E-8853-184ACD948678}.Release|x64.ActiveCfg = Release|Win32 49 | {B874A948-B5F4-4501-9735-BD9586C5216D}.Debug|Win32.ActiveCfg = Debug|Win32 50 | {B874A948-B5F4-4501-9735-BD9586C5216D}.Debug|x64.ActiveCfg = Debug|Win32 51 | {B874A948-B5F4-4501-9735-BD9586C5216D}.Release|Win32.ActiveCfg = Release|Win32 52 | {B874A948-B5F4-4501-9735-BD9586C5216D}.Release|x64.ActiveCfg = Release|Win32 53 | {1864FDC9-F116-4EB0-9B3F-6FD11E0307B4}.Debug|Win32.ActiveCfg = Debug|Win32 54 | {1864FDC9-F116-4EB0-9B3F-6FD11E0307B4}.Debug|x64.ActiveCfg = Debug|Win32 55 | {1864FDC9-F116-4EB0-9B3F-6FD11E0307B4}.Release|Win32.ActiveCfg = Release|Win32 56 | {1864FDC9-F116-4EB0-9B3F-6FD11E0307B4}.Release|x64.ActiveCfg = Release|Win32 57 | {C0F44D7F-B535-44DC-9125-515E813A1753}.Debug|Win32.ActiveCfg = Debug|Win32 58 | {C0F44D7F-B535-44DC-9125-515E813A1753}.Debug|x64.ActiveCfg = Debug|Win32 59 | {C0F44D7F-B535-44DC-9125-515E813A1753}.Release|Win32.ActiveCfg = Release|Win32 60 | {C0F44D7F-B535-44DC-9125-515E813A1753}.Release|x64.ActiveCfg = Release|Win32 61 | {E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C}.Debug|Win32.ActiveCfg = Debug|Win32 62 | {E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C}.Debug|x64.ActiveCfg = Debug|Win32 63 | {E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C}.Release|Win32.ActiveCfg = Release|Win32 64 | {E54AF10F-FCBB-4A09-AAB7-2C83CF91BD2C}.Release|x64.ActiveCfg = Release|Win32 65 | {B5A702D5-C5F7-40EE-99E0-A500AE91528A}.Debug|Win32.ActiveCfg = Debug|Win32 66 | {B5A702D5-C5F7-40EE-99E0-A500AE91528A}.Debug|x64.ActiveCfg = Debug|Win32 67 | {B5A702D5-C5F7-40EE-99E0-A500AE91528A}.Release|Win32.ActiveCfg = Release|Win32 68 | {B5A702D5-C5F7-40EE-99E0-A500AE91528A}.Release|x64.ActiveCfg = Release|Win32 69 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.ActiveCfg = Debug|Win32 70 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|Win32.Build.0 = Debug|Win32 71 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.ActiveCfg = Debug|x64 72 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Debug|x64.Build.0 = Debug|x64 73 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.ActiveCfg = Release|Win32 74 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|Win32.Build.0 = Release|Win32 75 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.ActiveCfg = Release|x64 76 | {109D6E6F-6D91-460F-86AE-DF27400E09A9}.Release|x64.Build.0 = Release|x64 77 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|Win32.ActiveCfg = Debug|Win32 78 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|Win32.Build.0 = Debug|Win32 79 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|x64.ActiveCfg = Debug|x64 80 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Debug|x64.Build.0 = Debug|x64 81 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|Win32.ActiveCfg = Release|Win32 82 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|Win32.Build.0 = Release|Win32 83 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|x64.ActiveCfg = Release|x64 84 | {0DCD21B9-FCBD-4B2A-B1DE-65FA359C904C}.Release|x64.Build.0 = Release|x64 85 | EndGlobalSection 86 | GlobalSection(SolutionProperties) = preSolution 87 | HideSolutionNode = FALSE 88 | EndGlobalSection 89 | EndGlobal 90 | -------------------------------------------------------------------------------- /MSVisualStudio/v10/OsiExamplesBuild/OsiExamplesBuild.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {1864FDC9-F116-4EB0-9B3F-6FD11E0307B4} 15 | Win32Proj 16 | 17 | 18 | 19 | Application 20 | MultiByte 21 | 22 | 23 | Application 24 | MultiByte 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | <_ProjectFileVersion>10.0.30319.1 40 | $(SolutionDir)$(Platform)\$(Configuration)\ 41 | $(Platform)\$(Configuration)\ 42 | true 43 | $(SolutionDir)$(Platform)\$(Configuration)\ 44 | $(Platform)\$(Configuration)\ 45 | false 46 | AllRules.ruleset 47 | 48 | 49 | AllRules.ruleset 50 | 51 | 52 | 53 | 54 | 55 | Disabled 56 | ..\..\..\..\Osi\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) 57 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 58 | true 59 | EnableFastChecks 60 | MultiThreadedDebug 61 | 62 | 63 | Level3 64 | EditAndContinue 65 | 66 | 67 | $(OutDir)OsiExamplesBuild.exe 68 | true 69 | $(OutDir)OsiExamplesBuild.pdb 70 | Console 71 | false 72 | 73 | 74 | MachineX86 75 | 76 | 77 | 78 | 79 | ..\..\..\..\Osi\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) 80 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 81 | MultiThreaded 82 | 83 | 84 | Level3 85 | ProgramDatabase 86 | 87 | 88 | $(OutDir)OsiExamplesBuild.exe 89 | true 90 | Console 91 | true 92 | true 93 | false 94 | 95 | 96 | MachineX86 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | {c4867f15-438d-4ff8-8388-62fbaaa9786c} 105 | false 106 | 107 | 108 | {7d98e2cb-876e-4f75-9f71-77d3fe87e149} 109 | false 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /MSVisualStudio/v10/OsiExamplesSpecific/OsiExamplesSpecific.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {B5A702D5-C5F7-40EE-99E0-A500AE91528A} 15 | Win32Proj 16 | 17 | 18 | 19 | Application 20 | MultiByte 21 | 22 | 23 | Application 24 | MultiByte 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | <_ProjectFileVersion>10.0.30319.1 40 | $(SolutionDir)$(Platform)\$(Configuration)\ 41 | $(Platform)\$(Configuration)\ 42 | true 43 | $(SolutionDir)$(Platform)\$(Configuration)\ 44 | $(Platform)\$(Configuration)\ 45 | false 46 | AllRules.ruleset 47 | 48 | 49 | AllRules.ruleset 50 | 51 | 52 | 53 | 54 | 55 | Disabled 56 | ..\..\..\..\Osi\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) 57 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 58 | true 59 | EnableFastChecks 60 | MultiThreadedDebug 61 | 62 | 63 | Level3 64 | EditAndContinue 65 | 66 | 67 | $(OutDir)OsiExamplesSpecific.exe 68 | true 69 | $(OutDir)OsiExamplesSpecific.pdb 70 | Console 71 | false 72 | 73 | 74 | MachineX86 75 | 76 | 77 | 78 | 79 | ..\..\..\..\Osi\src\OsiClp;..\..\..\..\Osi\src;..\..\..\..\Clp\src;..\..\..\..\CoinUtils\src;..\..\..\..\BuildTools\headers;%(AdditionalIncludeDirectories) 80 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 81 | MultiThreaded 82 | 83 | 84 | Level3 85 | ProgramDatabase 86 | 87 | 88 | $(OutDir)OsiExamplesSpecific.exe 89 | true 90 | Console 91 | true 92 | true 93 | false 94 | 95 | 96 | MachineX86 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | {c4867f15-438d-4ff8-8388-62fbaaa9786c} 105 | false 106 | 107 | 108 | {7d98e2cb-876e-4f75-9f71-77d3fe87e149} 109 | false 110 | 111 | 112 | 113 | 114 | 115 | --------------------------------------------------------------------------------