2

I have a cplex code that works in cplex ide. I want to run that program inside c# code.

I added cplex libraries, but visual studio cannot understand it.

using ILOG.CPLEX;
using ILOG.Concert;

but these are red underlined. How can I connect cplex library to c# code? I want to run cplex code like a function, I mean:

int cost = run_cplex_output();
burak
  • 71
  • 6

1 Answers1

1

2 options:

  • 1) Use the Concert C# API
  • 2) Use the C# OPL API to call OPL from C#

In the CPLEX product you have examples for option 1 at

CPLEX_Studio129\cplex\examples\src\cs

and option 2 at

CPLEX_Studio129\opl\examples\opl_interfaces\dotnet\x64_windows_vs2017\CSharp

I suggest option 2 and see Mulprod.cs

Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15
  • 20: using ILOG.Concert; 21: using ILOG.CPLEX; 22: using ILOG.OPL; these are red underlined on my project. my code cannot understand cplex libraries. – burak Sep 12 '19 at 18:36