Skip to main content

A Multidimensional Fitness Heuristic solver for Set Covering Problems.

Project description

mdfh-scp

A Multidimensional Fitness Heuristic solver for Set Covering Problems.

Overview

mdfh-scp is a lightweight Python implementation of a Multidimensional Fitness Heuristic for Set Covering Problems.

The implementation is inspired by the heuristic algorithm presented in:

Hashemi et al. (2025), "A multidimensional fitness function based heuristic algorithm for set covering problems", Applied Soft Computing.

Installation

pip install mdfh-scp

Development installation

git clone https://github.com/gsadra/mdfh-scp.git
cd mdfh-scp
pip install -e .[dev]

Usage

from mdfh import MDFHSetCoverSolver

variables = ["x1", "x2", "x3"]

fitness_cost_component = {
"x1": 10.0,
"x2": 8.0,
"x3": 6.0,
}

fitness_time_component = {
"x1": 1.0,
"x2": 1.0,
"x3": 1.0,
}

fitness_route_component = {
"x1": 1.0,
"x2": 1.0,
"x3": 1.0,
}

coverage_weight = {
"x1": {"x2"},
"x2": {"x1", "x3"},
"x3": {"x3"},
}

solver = MDFHSetCoverSolver(
variables=variables,
fitness_cost_component=fitness_cost_component,
fitness_time_component=fitness_time_component,
fitness_route_component=fitness_route_component,
coverage_weight=coverage_weight,
include_self=True,
)

result = solver.solve(verbose=True)

print(result.selected_variables)
print(result.objective_value)
print(result.is_feasible)

API

MDFHSetCoverSolver

MDFHSetCoverSolver(
variables,
fitness_cost_component,
fitness_time_component,
fitness_route_component,
coverage_weight,
include_self=True,
)

Parameters

  • variables: List of variable identifiers.
  • fitness_cost_component: Cost-related fitness component.
  • fitness_time_component: Time-related fitness component.
  • fitness_route_component: Route-related fitness component.
  • coverage_weight: Mapping of each variable to the variables it covers.
  • include_self: If True, each variable covers itself.

solve(verbose=False)

Runs the MDFH heuristic and returns an MDFHResult.

Result Object

The solver returns:

MDFHResult(
selected_variables,
covered_variables,
uncovered_variables,
is_feasible,
objective_value,
solve_duration,
)

Exceptions

  • MDFHValidationError: Raised for invalid input data.
  • MDFHSolverError: Raised when the solver cannot continue.
  • MDFHBaseException: Base class for MDFH exceptions.

Citation

@article{hashemi2025multidimensional,
  title = {A multidimensional fitness function based heuristic algorithm for set covering problems},
  author = {Hashemi, A. and Gholami, H. and Delorme, X. and Wong, K. Y.},
  journal = {Applied Soft Computing},
  volume = {174},
  pages = {113038},
  year = {2025},
  issn = {1568-4946},
  doi = {10.1016/j.asoc.2025.113038}
}

Disclaimer

This is an independent implementation and is not an official implementation provided by the authors of the referenced paper.

Contributing

Contributions are welcome. If you would like to improve this project, fix bugs, add features, improve documentation, or add tests, please follow the steps below.

Fork the Repository

Click the Fork button at the top-right of the repository page on GitHub.

This creates a copy of the repository under your own GitHub account.

Make Your Changes

You can contribute by:

  • Fixing bugs
  • Adding new examples
  • Improving documentation
  • Adding tests
  • Improving code structure
  • Adding new features
  • Improving validation or error handling

Please keep the code clear, readable, and well documented.

Reporting Issues

If you find a bug or have a suggestion, please open an issue on GitHub:

https://github.com/sadraagholami/mdfh-scp/issues

When reporting a bug, please include:

- A clear description of the problem
- Steps to reproduce the issue
- Expected behavior
- Actual behavior
- Python version
- Operating system
- Any relevant error messages

License

MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdfh_scp-1.0.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mdfh_scp-1.0.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file mdfh_scp-1.0.0.tar.gz.

File metadata

  • Download URL: mdfh_scp-1.0.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for mdfh_scp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 360d0f9843e9c9b440eb5d4260abcc6e92b4d328bf411bff88eac6d8c46880c1
MD5 d06822fb0e4cebc330274d7d8636a902
BLAKE2b-256 f27e33f19299394a9608a81f848448f588b8ab5acfee0ffcec5d9587da06f09f

See more details on using hashes here.

File details

Details for the file mdfh_scp-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mdfh_scp-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for mdfh_scp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed0feb1c0022a477614b85ab0fe9e60ee6d9faa38d863347a1703a4d90014e23
MD5 d2e9ac1d5c1825831e0cd0f424385e30
BLAKE2b-256 45b4444d48214d959e2f4d20d885a7b29f5a60a9c4cb2166753e972c77b3fd46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page