Skip to content
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

CPLEX Integration with .NET #2470

Closed
akash-sambrekar opened this issue Mar 30, 2021 · 6 comments
Closed

CPLEX Integration with .NET #2470

akash-sambrekar opened this issue Mar 30, 2021 · 6 comments
Assignees
Labels
Lang: .NET .Net wrapper issue OS: Windows Windows OS Solver: CPLEX CPLEX Solver related issue
Milestone

Comments

@akash-sambrekar
Copy link

akash-sambrekar commented Mar 30, 2021

What version of OR-Tools and what language are you using?
Version: master/v7.3/v7.2 etc.
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 10

What did you do?
Steps to reproduce the behaviour
After cloning master branch, I execute the following commands
tools\make third_party
I added the WINDOWS_CPLEX_DIR = C:\Program Files\IBM\ILOG\CPLEX_Studio1210 in Makefile.Local
tools\make dotnet
If I try to run a examples with cplex with the following command , it doesn't work
make run SOURCE=examples/dotnet/BasicExample.cs

The project seems to work fine GLOP , SCIP but not with CPLEX
Error received:

WARNING: Logging before InitGoogleLogging() is written to STDERR
W00-1 -1:-1:-1.373535 20160 linear_solver.cc:609] Support for CPLEX not linked in, or the license was not found.
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at BasicExample.Main() in C:\or-tools\examples\dotnet\BasicExample.cs:line 12
make: *** [makefiles/Makefile.dotnet.mk:462: run] Error -1073741819
@lperron
Copy link
Collaborator

lperron commented Mar 31, 2021

can you try

make run SOURCE=examples/cpp/integer_programming.cc

@lperron lperron self-assigned this Mar 31, 2021
@lperron lperron added the Solver: CPLEX CPLEX Solver related issue label Mar 31, 2021
@Mizux Mizux added the Lang: .NET .Net wrapper issue label Mar 31, 2021
@Mizux Mizux added this to the v9.1 milestone Mar 31, 2021
@lperron
Copy link
Collaborator

lperron commented Mar 31, 2021

Check the process. Make sure make clean is called after adding the WINDOWS_CPLEX_DIR to Makefile.local

I just did a fresh compilation from scratch.

Both examples/cpp/integer_programming.cc and examples/dotnet/csinteger_programming.cs works fine

(note that I tweaked the C# example to add the cplex option)

@akash-sambrekar
Copy link
Author

Do I need to run tools\make clean_third_party or make clean after adding WINDOWS_CPLEX_DIR to Makefile.local ?

(Note :I have tweaked the C# example with the cplex option)

@lperron
Copy link
Collaborator

lperron commented Mar 31, 2021 via email

@akash-sambrekar
Copy link
Author

Yes it works now Laurent !..
Thank you for the help

@Mizux Mizux modified the milestones: v9.1, v9.0 Mar 31, 2021
@Mizux Mizux added the OS: Windows Windows OS label Mar 31, 2021
@Mizux
Copy link
Collaborator

Mizux commented Mar 31, 2021

For the record stable (8.2) contains an harcoded version

ifdef WINDOWS_CPLEX_DIR
CPLEX_INC = /I"$(WINDOWS_CPLEX_DIR)\\cplex\\include" /DUSE_CPLEX
CPLEX_SWIG = -I"$(WINDOWS_CPLEX_DIR)/cplex/include" -DUSE_CPLEX
STATIC_CPLEX_LNK = "$(WINDOWS_CPLEX_DIR)\\cplex\\lib\\x64_windows_msvc14\\stat_mda\\cplex12100.lib"
DYNAMIC_CPLEX_LNK = $(STATIC_CPLEX_LNK)
endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Lang: .NET .Net wrapper issue OS: Windows Windows OS Solver: CPLEX CPLEX Solver related issue
Projects
None yet
Development

No branches or pull requests

3 participants