Bui Thanh Binh
Bui Thanh Binh

Reputation: 103

Creating MILP Model in CPLEX automatically

I am trying to set up an MILP Problem in CPLEX. The model is created out of an input in the form of a "System Configuration" file and has to be created automatically within CPLEX since ten thousands of constraints and thousands of decision variables has to be created.

I had several ideas in mind: 1) Define the constraints as matrix/vector constraints in the form A*x = b by defining the corresponding matrix and vectors from the input. But I could not find any opportunity to do this in CPLEX.

2) I found out there is a possibility to build up linear constraints with IloLinearNumExpr but this is only possible in JAVA? I could not find the class anywhere in the C++ Interface.

3) At last, it is also possible to write the model in an LP file automatically and import it. Would you rather recommend this procedure since it is platform Independent and offers a better readable model instead of the exported model from CPLEX which uses x as the only variable name?

Best regards, Binh

Upvotes: 0

Views: 354

Answers (1)

TimChippingtonDerrick
TimChippingtonDerrick

Reputation: 2072

Do it via the API. There are APIs for lots of languages. In the CPLEX examples folder on my PC there are standard examples in C, C++, C# Java, Python and VB. Just read the appropriate part of the documentation.

Upvotes: 2

Related Questions