Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom build not working with CPLEX and .NET #3685

Closed
alexandredias3d opened this issue Feb 23, 2023 · 1 comment
Closed

Custom build not working with CPLEX and .NET #3685

alexandredias3d opened this issue Feb 23, 2023 · 1 comment
Assignees
Milestone

Comments

@alexandredias3d
Copy link

What version of OR-Tools and what language are you using?
Version: v9.5 (92eab40)
Language: C#

Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)
CPLEX

What operating system (Linux, Windows, ...) and version?
Windows 11

What did you do?
Steps to reproduce the behavior:

  1. Clone https://github.com/google/or-tools.
  2. Change FindCPLEX.cmake to update CPLEX version to 20.10.
diff --git a/cmake/FindCPLEX.cmake b/cmake/FindCPLEX.cmake
index b47cc8556a..82fe089bb2 100644
--- a/cmake/FindCPLEX.cmake
+++ b/cmake/FindCPLEX.cmake
@@ -85,7 +85,7 @@ if(CPLEX_FOUND AND NOT TARGET CPLEX::CPLEX)
       IMPORTED_LOCATION "${CPLEX_ROOT}/cplex/lib/x86-64_linux/static_pic/libcplex.a")
   elseif(MSVC)
     set_target_properties(CPLEX::CPLEX PROPERTIES
-      IMPORTED_LOCATION "${CPLEX_ROOT}/cplex/lib/x64_windows_msvc14/stat_mda/cplex12100.lib")
+      IMPORTED_LOCATION "${CPLEX_ROOT}/cplex/lib/x64_windows_msvc14/stat_mda/cplex2010.lib")
   else()
     message(FATAL_ERROR "CPLEX not supported for ${CMAKE_SYSTEM}")
   endif()

3 Configure.

cmake -S. -Bbuild -G "Visual Studio 17 2022" -A x64  
            -DCMAKE_BUILD_TYPE=Release 
            -DBUILD_DEPS=ON 
            -DBUILD_DOTNET=ON 
            -DBUILD_SAMPLES=ON 
            -DBUILD_EXAMPLES=ON 
            -DUSE_SCIP=ON 
            -DUSE_XPRESS=ON 
            -DXPRESS_ROOT="C://tool/xpress/xpress900" 
            -DUSE_CPLEX=ON -DCPLEX_ROOT="C://Program Files/IBM/ILOG/CPLEX_Studio201"
  1. Build.
cmake --build build --config Release --target ALL_BUILD  
  1. Added the OR-Tools packages (generated at or-tools\build\dotnet\packages ) to my project.

What did you expect to see
Correct initialization of the solver using the CPLEX backend.

What did you see instead?

WARNING: Logging before InitGoogleLogging() is written to STDERR
W0223 08:02:05.859726  4572 linear_solver.cc:645] Support for CPLEX not linked in, or the license was not found.

Anything else we should know about your project / environment
It seems that CPLEX support was built correctly since this test works:

I0221 13:09:36.278439 10628 linear_programming.cc:31] ---- Linear programming example with CPLEX_LP ----
I0221 13:09:36.279101 10628 linear_programming.cc:78] Number of variables = 3
I0221 13:09:36.279178 10628 linear_programming.cc:79] Number of constraints = 3
I0221 13:09:36.295479 10628 linear_programming.cc:88] Problem solved in 17 milliseconds
I0221 13:09:36.295574 10628 linear_programming.cc:91] Optimal objective value = 733.333
I0221 13:09:36.295615 10628 linear_programming.cc:94] x1 = 33.3333
I0221 13:09:36.295644 10628 linear_programming.cc:95] x2 = 66.6667
I0221 13:09:36.295673 10628 linear_programming.cc:96] x3 = 0
I0221 13:09:36.295704 10628 linear_programming.cc:98] Advanced usage:
I0221 13:09:36.295729 10628 linear_programming.cc:99] Problem solved in 2 iterations
I0221 13:09:36.296060 10628 linear_programming.cc:100] x1: reduced cost = 0
I0221 13:09:36.296100 10628 linear_programming.cc:101] x2: reduced cost = 0
I0221 13:09:36.296118 10628 linear_programming.cc:102] x3: reduced cost = -2.66667
I0221 13:09:36.296135 10628 linear_programming.cc:104] c0: dual value = 3.33333 activity = 100
I0221 13:09:36.296154 10628 linear_programming.cc:106] c1: dual value = 0.666667 activity = 600
I0221 13:09:36.296172 10628 linear_programming.cc:108] c2: dual value = -0 activity = 200

Also, I can confirm that I am using the custom dotnet package because Xpress works normally.

WARNING: Logging before InitGoogleLogging() is written to STDERR
W0223 08:12:37.446219 29332 xpress_interface.cc:287] XpressInterface : Initialising xpress-MP with parameter C:\tool\xpress\xpress900
W0223 08:12:37.893987 29332 xpress_interface.cc:297] XpressInterface : Xpress banner :
FICO Xpress Solver 64bit v9.0.0 Oct 17 2022
(c) Copyright Fair Isaac Corporation 1983-2022. All rights reserved

This is possible a duplicate of #3475, but I could not find the solution to the problem.

@lperron
Copy link
Collaborator

lperron commented Feb 23, 2023

We do not support cplex ourselves. So I will move this to discussions/linear solver. PR welcomes.

@google google locked and limited conversation to collaborators Feb 23, 2023
@lperron lperron converted this issue into discussion #3686 Feb 23, 2023
@Mizux Mizux added this to the v9.6 milestone Mar 10, 2023
@Mizux Mizux self-assigned this Mar 10, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants