21 #include "SolverConfig.h"
28 uint64_t numberOfVariables = A.numberOfColumns(), numberOfConstraints = A.numberOfRows();
29 if (numberOfVariables == 0 || numberOfConstraints == 0)
30 throw SolverException(caller(),
"Empty matrix 'A' of the ILP formulation!");
32 uint32_t cSize = max(c.size(), gurobiC.size());
33 if (numberOfVariables != x.size() || numberOfVariables != cSize)
34 throw SolverException(caller(),
"Invalid horizontal size of 'A', 'c', 'x'!");
36 if (numberOfConstraints != ops.size() || numberOfConstraints != b.size())
37 throw SolverException(caller(),
"Invalid vertical size of 'A', 'ops', 'b'!");
39 if (!varDesc.empty() && varDesc.size() != numberOfVariables)
40 throw SolverException(caller(),
"Incomplete description of variables!");
42 if (!conDesc.empty() && conDesc.size() != numberOfConstraints)
43 throw SolverException(caller(),
"Incomplete description of constraints!");
49 double densityOfMatrixA = A.densityOfMatrix();
50 uint64_t numberOfBinaryVariables = 0, numberOfFloatVariables = 0, numberOfIntegerVariables = 0;
51 for (uint64_t v = 0; v < numberOfVariables(); ++v) {
54 ++numberOfFloatVariables;
57 ++numberOfBinaryVariables;
60 ++numberOfIntegerVariables;
67 cout<<
"Number of variables: "<<numberOfVariables()<<endl;
68 cout<<
"Number of float variables: "<<numberOfFloatVariables<<endl;
69 cout<<
"Number of binary variables: "<<numberOfBinaryVariables<<endl;
70 cout<<
"Number of integer variables: "<<numberOfIntegerVariables<<endl;
71 cout<<
"Number of constraints: "<<numberOfConstraints()<<endl;
72 cout<<
"Density of matrix A: "<<densityOfMatrixA*100.0<<
" %"<<endl;
75 throw_with_nested(
InvalidArgument(caller(),
"Invalid dimensions of ILP formulation!"));
void printStatistics() const
It prints various statistics like density of A matrix and number of constraints to the standard outpu...
A general exception of the program.
The file defines extended exceptions for the better error handling in the program.
Exception is thrown if a method is given invalid parameters or a user provides invalid program argume...
General model for Integer Linear Programming problem.
void checkFormulation() const
It checks that sizes of vectors and the matrix are valid.