A simple C++ library for reading Set Covering Problem (SCP) instances made available in OR-Library.
The installation require CMake to generate build files of the library.
Clone this repository, in command line, access the project directory. Create a folder to files generating by cmake.
$ mkdir build && cd build
Uses make to install locally the headers. In build directory, type
$ cmake ..
$ sudo make install
By default, the files are placed in /usr/local/include/scpxx/
.
Following problems existing in OR-Library that can be readed here are:
- Set covering problem (SCP)
Example using matrix class for set covering problem:
#include <iostream>
#include <scpxx/scp.h>
using namespace scpxx;
int main() {
SCPFile file("../scp41.txt");
// Read all numbers in file and copy to a vector
file.bufferize();
// Get the vector with all numbers
std::vector<int> vec = file.values();
std::cout << "Number of values: " << vec.size() << std::endl;
// The method generate_matrix build the matrix object
auto matrix = file.generate_matrix();
std::cout << matrix.num_rows() << " rows\n";
std::cout << matrix.num_columns() << " columns\n";
return 0;
}
Licensed under the MIT license.