Skip to content

A local search algorithm to solve the Minimum-Weighted Vertex Cover (MWVC) problem.

License

Notifications You must be signed in to change notification settings

adamozh/fastwvc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastWVC

A local search algorithm to solve the NP-Hard Minimum-Weighted Vertex Cover (MWVC) problem. This is my C++ implementation of the original FastWVC algorithm with some slight changes, referenced from the paper Towards faster local search for minimum weight vertex cover on massive graphs, published in 2018. A copy of the paper is uploaded in this repository.

Stochastic Local Search

Instead of employing a typical deterministic universal, optimal or approximation algorithm, local search is a heuristic "stop anytime" method which moves between candidate solutions by applying local changes, until a candidate is deemed sufficiently optimal or until the time bound is reached. "Stochastic" implies an aspect of randomness in this process. In this case, local changes are applied by removing and then adding (somewhat random) candidate nodes from the current cover to reach a new candidate solution, until it has been running for 2 seconds. Details are commented in fastwvc.cpp.

Running the algorithm

This algorithm was developed for and tested on the Kattis problem Minimum Weighted Vertex Cover. It sets a time limit of 2 seconds. Specifics can be found here.

  1. Build the executable with your favourite C++ compiler
clang++ fastwvc.cpp -std=c++20 -o fastwvc
  1. Run the executable with the graph input
./fastwvc
8 9
1 1 999 1 1 1 999 100
0 1
1 2
1 4
2 3
2 5
3 6
4 5
5 6
6 7

Results

This implementation scores a 35.69/40 on Kattis, where 40 means an optimal result for all 40 input graphs.

About

A local search algorithm to solve the Minimum-Weighted Vertex Cover (MWVC) problem.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages