Skip to content

Latest commit

 

History

History
71 lines (46 loc) · 1.89 KB

README.md

File metadata and controls

71 lines (46 loc) · 1.89 KB

SCPxx

build Codacy Badge License: MIT

A simple C++ library for reading Set Covering Problem (SCP) instances made available in OR-Library.

Installation

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/.

List of problems

Following problems existing in OR-Library that can be readed here are:

  • Set covering problem (SCP)

Usage

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;
}

License

Licensed under the MIT license.