Skip to content

Python-Bindings#85

Merged
c4v4 merged 21 commits intoc4v4:mainfrom
d-krupke:main
Feb 22, 2025
Merged

Python-Bindings#85
c4v4 merged 21 commits intoc4v4:mainfrom
d-krupke:main

Conversation

@d-krupke
Copy link
Collaborator

This PR creates Python-bindings to the algorithm. These are point-and-shoot bindings for quick and simple usage, though you can also (theoretically) access most parts of the original library directly.

from pyaccft import SetCoverSolver

solver = SetCoverSolver()
# Add sets with their respective costs
solver.add_set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], cost=10)
solver.add_set([0, 1, 2, 3, 4, 5], cost=5)
solver.add_set([0, 1, 2, 3, 4], cost=4)
solver.add_set([6, 7, 8, 9], cost=4)

# Solve the set cover problem
solver.solve()

# Retrieve and print the solution
solution = solver.get_solution()
print("The following sets have been selected:", solution)
print("The cost of the solution is:", solver.get_cost())
print("The lower bound of the solution is:", solver.get_lower_bound())

CI for building and deploying isn't set up yet but one can build via pip install --verbose .. CI for testing is added.

@d-krupke d-krupke requested a review from c4v4 February 16, 2025 16:00
Copy link
Owner

@c4v4 c4v4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much!

@c4v4 c4v4 merged commit 0b17d66 into c4v4:main Feb 22, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants