From f72c1cf5947d0d3601c842b0d92cfd2e49e6b9de Mon Sep 17 00:00:00 2001 From: John Forrest Date: Thu, 14 Mar 2024 10:40:15 +0000 Subject: [PATCH 1/8] take out change and fix for tiny problem --- src/ClpSimplexOther.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ClpSimplexOther.cpp b/src/ClpSimplexOther.cpp index 13c8eda6..1c3e4009 100644 --- a/src/ClpSimplexOther.cpp +++ b/src/ClpSimplexOther.cpp @@ -1786,7 +1786,7 @@ ClpSimplexOther::crunch(double *rhs, int *whichRow, int *whichColumn, } #else assert (numberRows_>=0); - bool takeOutSome=true; + bool takeOutSome=false;//true; #endif //#define CHECK_STATUS #ifdef CHECK_STATUS From 39eae0c4694c4ec11f6cac955c05dd899cbbdea5 Mon Sep 17 00:00:00 2001 From: John Forrest Date: Thu, 14 Mar 2024 11:24:17 +0000 Subject: [PATCH 2/8] fix wrong assert --- src/ClpSimplex.cpp | 4 ++-- src/ClpSimplexOther.cpp | 4 ++-- src/OsiClp/OsiClpSolverInterface.cpp | 10 ++++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ClpSimplex.cpp b/src/ClpSimplex.cpp index b053a2fc..01cd158e 100644 --- a/src/ClpSimplex.cpp +++ b/src/ClpSimplex.cpp @@ -11454,7 +11454,7 @@ int ClpSimplex::fathom(void *stuff) int *whichColumn = new int[2 * numberColumns_]; int nBound; bool tightenBounds = ((specialOptions_ & 64) == 0) ? false : true; - //numberRows_=-numberRows_;//!! flag to say do more work (if test in crunch) + numberRows_=-numberRows_;//!! flag to say do more work (if test in crunch) ClpSimplex *small = static_cast< ClpSimplexOther * >(this)->crunch(rhs, whichRow, whichColumn, nBound, false, tightenBounds); if (small) { @@ -12177,7 +12177,7 @@ int ClpSimplex::fathomMany(void *stuff) int *whichRow = new int[3 * numberRows_]; int *whichColumn = new int[2 * numberColumns_]; int nBound; - //numberRows_=-numberRows_;//!! flag to say do more work (if test in crunch) + numberRows_=-numberRows_;//!! flag to say do more work (if test in crunch) bool tightenBounds = ((specialOptions_ & 64) == 0) ? false : true; ClpSimplex *small = static_cast< ClpSimplexOther * >(this)->crunch(rhs, whichRow, whichColumn, nBound, false, tightenBounds); diff --git a/src/ClpSimplexOther.cpp b/src/ClpSimplexOther.cpp index 1c3e4009..46e372e2 100644 --- a/src/ClpSimplexOther.cpp +++ b/src/ClpSimplexOther.cpp @@ -1775,7 +1775,7 @@ ClpSimplex * ClpSimplexOther::crunch(double *rhs, int *whichRow, int *whichColumn, int &nBound, bool moreBounds, bool tightenBounds) { -#if 0 +#if 1 /* If you only want to find redundant rows before fathom then use this and set numberRows_ negative before this call (in ClpSimplex.cpp) */ @@ -1786,7 +1786,7 @@ ClpSimplexOther::crunch(double *rhs, int *whichRow, int *whichColumn, } #else assert (numberRows_>=0); - bool takeOutSome=false;//true; + bool takeOutSome=true; #endif //#define CHECK_STATUS #ifdef CHECK_STATUS diff --git a/src/OsiClp/OsiClpSolverInterface.cpp b/src/OsiClp/OsiClpSolverInterface.cpp index 893c9f19..26d2169c 100644 --- a/src/OsiClp/OsiClpSolverInterface.cpp +++ b/src/OsiClp/OsiClpSolverInterface.cpp @@ -7940,8 +7940,11 @@ void OsiClpSolverInterface::crunch() nBound, moreBounds, tightenBounds); #ifndef NDEBUG int nCopy = 3 * numberRows + 2 * numberColumns; - for (int i = 0; i < nCopy; i++) + for (int i = 0; i < nCopy; i++) { + if (i>=small->getNumRows()&&i= -CoinMax(numberRows, numberColumns) && whichRow[i] < CoinMax(numberRows, numberColumns)); + } #endif smallModel_ = small; spareArrays_ = spareArrays; @@ -7953,8 +7956,11 @@ void OsiClpSolverInterface::crunch() int nCopy = 3 * numberRows + 2 * numberColumns; nBound = whichRow[nCopy]; #ifndef NDEBUG - for (int i = 0; i < nCopy; i++) + for (int i = 0; i < nCopy; i++) { + if (i>=smallModel_->getNumRows()&&i= -CoinMax(numberRows, numberColumns) && whichRow[i] < CoinMax(numberRows, numberColumns)); + } #endif small = smallModel_; } From 7985d2cab47c25672d167deb022d4a5dc0ed1344 Mon Sep 17 00:00:00 2001 From: John Forrest Date: Fri, 15 Mar 2024 09:39:36 +0000 Subject: [PATCH 3/8] fix mistake in DEBUG mode --- src/OsiClp/OsiClpSolverInterface.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/OsiClp/OsiClpSolverInterface.cpp b/src/OsiClp/OsiClpSolverInterface.cpp index 26d2169c..5f8b0005 100644 --- a/src/OsiClp/OsiClpSolverInterface.cpp +++ b/src/OsiClp/OsiClpSolverInterface.cpp @@ -7939,11 +7939,13 @@ void OsiClpSolverInterface::crunch() small = static_cast< ClpSimplexOther * >(modelPtr_)->crunch(rhs, whichRow, whichColumn, nBound, moreBounds, tightenBounds); #ifndef NDEBUG - int nCopy = 3 * numberRows + 2 * numberColumns; - for (int i = 0; i < nCopy; i++) { - if (i>=small->getNumRows()&&i= -CoinMax(numberRows, numberColumns) && whichRow[i] < CoinMax(numberRows, numberColumns)); + if (small) { + int nCopy = 3 * numberRows + 2 * numberColumns; + for (int i = 0; i < nCopy; i++) { + if (i>=small->getNumRows()&&i= -CoinMax(numberRows, numberColumns) && whichRow[i] < CoinMax(numberRows, numberColumns)); + } } #endif smallModel_ = small; From 29b0bb8203d8e94cc40beecdb17ab35bbac54081 Mon Sep 17 00:00:00 2001 From: Jan-Willem Goossens Date: Fri, 15 Mar 2024 17:56:12 +0100 Subject: [PATCH 4/8] Update linux-ci and windows-ci for outdated actions and build issues For linux-ci, update actions and macos-13 linker error See https://github.com/coin-or/COIN-OR-OptimizationSuite/issues/26 For windows-ci, update actions and remove 32-bit builds via mingw32. See https://github.com/coin-or/COIN-OR-OptimizationSuite/issues/25 --- .github/workflows/linux-ci.yml | 12 ++++++------ .github/workflows/windows-ci.yml | 14 ++++++-------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml index b237bd52..5f22125d 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux-ci.yml @@ -29,17 +29,17 @@ jobs: download_requirements: brew install metis bash - os: macos-13 build_static: false - flags: CC=gcc-13 CXX=g++-13 OSX=13 + flags: CC=gcc-13 CXX=g++-13 OSX=13 ADD_CXXFLAGS=-Wl,-ld_classic download_requirements: brew install metis bash steps: - name: Checkout source - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: ${{ github.event.repository.name }} - name: Install required packages from package manager run: ${{ matrix.download_requirements }} - name: Checkout coinbrew - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: coin-or/coinbrew path: coinbrew @@ -66,7 +66,7 @@ jobs: cp ${{ github.event.repository.name }}/LICENSE dist/ tar -czvf release.tar.gz -C dist . - name: Checkout package name generation script - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: coin-or-tools/platform-analysis-tools path: tools @@ -81,9 +81,9 @@ jobs: echo "platform_string=${platform_str}" >> $GITHUB_ENV - name: Upload Artifact if: ${{ github.event_name == 'pull_request'}} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: ${{ github.event.repository.name }}-${{ github.head_ref }}-${{ env.platform_string }}.tar.gz + name: ${{ github.event.repository.name }}-${{ env.platform_string }}.tar.gz path: release.tar.gz if-no-files-found: error - name: Upload package to release diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index 74b1a1e8..60bfe9dd 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -22,19 +22,17 @@ jobs: include: [ { os: windows-2019, arch: x86_64, msystem: mingw64, debug: true, suffix: "-dbg" }, { os: windows-2019, arch: x86_64, msystem: mingw64, debug: false, suffix: "" }, - { os: windows-2019, arch: i686, msystem: mingw32, debug: true, suffix: "-dbg" }, - { os: windows-2019, arch: i686, msystem: mingw32, debug: false, suffix: "" }, { os: windows-2019, arch: msvc, msystem: mingw64, debug: false, suffix: "-md" }, { os: windows-2022, arch: msvc, msystem: mingw64, debug: false, suffix: "-md" }, { os: windows-2022, arch: msvs, msystem: mingw64, debug: false, suffix: "" }, ] steps: - name: Checkout source - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: ${{ github.event.repository.name }} - name: Checkout coinbrew - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: coin-or/coinbrew path: coinbrew @@ -43,7 +41,7 @@ jobs: uses: ilammy/msvc-dev-cmd@v1 - name: Set up for msvs if: ${{ matrix.arch == 'msvs' }} - uses: microsoft/setup-msbuild@v1.1 + uses: microsoft/setup-msbuild@v2 - name: Set correct host flag and install requirements if: ${{ matrix.arch != 'msvc' && matrix.arch != 'msvs' }} run: | @@ -115,7 +113,7 @@ jobs: cp ${{ github.event.repository.name }}/LICENSE dist/ shell: msys2 {0} - name: Upload failed build directory - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: ${{ matrix.os}}-{{ matrix.arch }}-debug=${{ matrix.debug }}-failedbuild @@ -133,9 +131,9 @@ jobs: if: ${{ matrix.arch != 'msvc' }} - name: Upload artifact if: ${{ github.event_name == 'pull_request'}} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: ${{ github.event.repository.name }}-${{ github.head_ref }}-${{ env.package_suffix }} + name: ${{ github.event.repository.name }}-${{ env.package_suffix }} path: dist if-no-files-found: error - name: Zip up dist contents for release From a566fee7554775e7de6a3c02b97ddbeddb7e12b5 Mon Sep 17 00:00:00 2001 From: Jan-Willem Goossens Date: Mon, 11 Mar 2024 23:21:38 +0100 Subject: [PATCH 5/8] Initialize variables for presolve to prevent MSVS error C4703 Potentially uninitialized local pointer variable used for flags, maxdown and maxup. --- src/ClpSimplexOther.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ClpSimplexOther.cpp b/src/ClpSimplexOther.cpp index 46e372e2..fb9407c3 100644 --- a/src/ClpSimplexOther.cpp +++ b/src/ClpSimplexOther.cpp @@ -1807,9 +1807,9 @@ ClpSimplexOther::crunch(double *rhs, int *whichRow, int *whichColumn, const int *row = matrix_->getIndices(); const CoinBigIndex *columnStart = matrix_->getVectorStarts(); const int *columnLength = matrix_->getVectorLengths(); - char * flags; - double * maxdown; - double * maxup; + char * flags = NULL; + double * maxdown = NULL; + double * maxup = NULL; if (takeOutSome) { flags = new char [numberRows_]; maxdown = new double [2*numberRows_]; From b3216cc59377a07943fbf3bb66fcf2d296908248 Mon Sep 17 00:00:00 2001 From: Jan-Willem Goossens Date: Fri, 15 Mar 2024 22:09:19 +0100 Subject: [PATCH 6/8] Update windows-ci to install for msvs as in stable --- .github/workflows/windows-ci.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index 60bfe9dd..aac56d40 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -88,14 +88,11 @@ jobs: copy ${{ github.event.repository.name }}\AUTHORS.* dist\. copy ${{ github.event.repository.name }}\LICENSE.* dist\. mkdir dist\bin - copy ${{ github.event.repository.name }}\MSVisualStudio\v17\x64\Release\*.exe dist\bin\. - mkdir dist\include\coin - copy ${{ github.event.repository.name }}\src\*.h dist\include\coin\. - copy ${{ github.event.repository.name }}\src\*.hpp dist\include\coin\. - mkdir dist\lib - copy ${{ github.event.repository.name }}\MSVisualStudio\v17\x64\Release\*.lib dist\lib\. - mkdir dist\share\coin\Data - xcopy Data dist\share\coin\Data\. /s /e + copy ${{ github.event.repository.name }}\MSVisualStudio\v17\x64\Release\*.exe dist\bin\ + mkdir dist\share + if exist .\Data\Sample xcopy .\Data\Sample dist\share\coin-or-sample /i + if exist .\Data\Netlib xcopy .\Data\Netlib dist\share\coin-or-netlib /i + if exist .\Data\Miplib3 xcopy .\Data\Miplib3 dist\share\coin-or-miplib3 /i - name: Build project using coinbrew if: ${{ matrix.arch != 'msvs' }} run: | From 576b37f9b78e73f93cc99cb00ced9433251f68aa Mon Sep 17 00:00:00 2001 From: Jan-Willem <56190178+jhmgoossens@users.noreply.github.com> Date: Sat, 16 Mar 2024 10:24:57 +0100 Subject: [PATCH 7/8] Update .gitignore for VS files --- .gitignore | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 0f12d9b6..5e0d02a5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,14 @@ - +# Ignore VS files +*.suo +*.db +*.bak +*.user +**/.vs/ +**/MSVisualStudio/**/Release/ +**/MSVisualStudio/**/ReleaseParallel/ +**/MSVisualStudio/**/Debug/ + # Ignore files created during unit tests -/MSVisualStudio/v17/*.mps -/MSVisualStudio/v17/*.lp -/MSVisualStudio/v17/*.out \ No newline at end of file +**/MSVisualStudio/**/*.mps +**/MSVisualStudio/**/*.lp +**/MSVisualStudio/**/*.out From 555b17bf4abc85be0c61b8f4fe5c4ab1cde19459 Mon Sep 17 00:00:00 2001 From: John Forrest Date: Fri, 22 Mar 2024 13:48:50 +0000 Subject: [PATCH 8/8] resolve in ClpSolve if primal infeasible --- src/ClpSolve.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ClpSolve.cpp b/src/ClpSolve.cpp index 000f0051..48b94919 100644 --- a/src/ClpSolve.cpp +++ b/src/ClpSolve.cpp @@ -3850,7 +3850,9 @@ int ClpSimplex::initialSolve(ClpSolve &options) int savePerturbation = perturbation(); if (savePerturbation == 50) setPerturbation(51); // small - if (!finalStatus || finalStatus == 2 || (moreSpecialOptions_ & 2) == 0 || fabs(sumDual) + fabs(sumPrimal) < 1.0e-3) { + if ((finalStatus>=0 && finalStatus <= 2) || + (moreSpecialOptions_ & 2) == 0 || + fabs(sumDual) + fabs(sumPrimal) < 1.0e-3) { if (finalStatus == 2) { if (sumDual > 1.0e-4) { // unbounded - get feasible first