abcde123483
abcde123483

Reputation: 3905

Mixed Linear Integer Programming using Coin-OR CBC

I'm using CBC on the Windows command line for solving a Mixed Integer Linear Programming problem which works out pretty well as it solves the problem in a reasonable amount of time.

However, I can't figure out how to get CBC to print the values of the variables that forms the optimal solution.

Upvotes: 1

Views: 1070

Answers (2)

Bob
Bob

Reputation: 119

use

solu sol.txt

This will write the solution to a file named sol.txt. The variables that you don't see in the file take the value zero.

Upvotes: 0

Anders Gustafsson
Anders Gustafsson

Reputation: 15971

If I understand this example from the CBC User Guide correctly, you get the solution variables by using the const double * CbcModel::bestSolution() function.

Additionally, you should be able to identify the context of each variable by using these functions:

bool isBinary(int colIndex) const
bool isContinuous(int colIndex) const
bool isInteger(int colIndex) const

Upvotes: 2

Related Questions