Git Product home page Git Product logo

setcover's Introduction

Time/Memory Linear greedy set cover

This version of the greedy set cover is a well optimized linear version.

input format

The input format is

10 5
5 7 8 9 10
5 7
1 3 6 10
4 6 7 9 10
1 2 8 10

10 = elements 5 = sets Every line represents one set by the ids

How to use

git clone https://github.com/martin-steinegger/setcover
cd setcover
make
./setcover testdatafile

The program can be called like ./setcover filename

Example output

$ ./setcover testdatafile 
start readin --- Done
init setcover --- Done
execute setcover --- Done
validate result  VALID  --- Done
write result setcover
set id 4 Element: 4, 6, 7, 9, 10,
set id 5 Element: 1, 2, 8,
set id 1 Element: 5,
set id 3 Element: 3,

Performance

The calculation for 40.000.000 sets with avg. 10 elements per set takes around 4 Minutes on a m2.2xlarge instance.

alt tag

setcover's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

setcover's Issues

No `main` defined

The README suggests that the code should compile to an executable. However, the source code does not contain main function, therefore the compilation process fails. I guess there's some file that was not commited to the repository…

Only accepts filename 'testdatafile'

Hi, first of all, this is a really great program. Thanks!! I installed on my 2017 macbook pro (running Sierra 10.12.6) and for some reason the code only will accept input with the filename 'testdatafile'. With any other filename for the input, I get the following error:

setcover(12637,0x7fffec1be3c0) malloc: *** mach_vm_map(size=18446744072364584960) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
libc++abi.dylib: terminating with uncaught exception of type std::bad_alloc: std::bad_alloc
Abort trap: 6

Lastly, it would be very nice if this code could be put into a python module so that I can access it directly from a python list of lists (where the lists are the sets), as opposed to having to print to file, run setcover, then read in the text file output from setcover back into python.

Thanks for the great code!!

Nick

What does this part of code do?

for (unsigned int i = 0; i <= element_size; i++) {
this->xorSwap(&element_size_lookup[0], &element_size_lookup[i + 1]);
element_size_lookup[i + 1] = last_element + element_size_lookup[i + 1];
last_element = element_size_lookup[i + 1];
}

I really have no idea what does it do. I figured out almost all the code do and only this part really confusing me. Can you help please?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.