A dynamically adjusting priority queue with causal influences.
Project description
Causal Priority Queue (CPQ)
Overview
Causal Priority Queue (CPQ) is a dynamically adjusting priority queue where:
- Priorities are not static but dynamically change based on causal influences.
- Items in the queue influence each other based on relationships.
- Designed for AI scheduling, intelligent load balancing, and real-time prioritization.
How It Works
Unlike traditional priority queues where elements have fixed priorities, CPQ:
- Stores influences as a graph where tasks affect each other.
- Adjusts priorities dynamically when tasks are processed.
- Ensures efficient priority updates using a heap-based structure.
Installation
You can install CPQ by cloning the repository:
git clone https://github.com/mukerjeejoy-github/causal-priority-queue.git
cd CausalPriorityQueue
Usage Example
from causal_priority_queue.cpq import CausalPriorityQueue
cpq = CausalPriorityQueue()
cpq.add_task("Task A", priority=3, influences=["Task B"], influence_weight=2)
cpq.add_task("Task B", priority=5)
cpq.add_task("Task C", priority=8)
print("Before popping:", cpq.get_tasks())
print("Popped:", cpq.pop_task())
print("After popping:", cpq.get_tasks())
🔍 Benchmarks
| Data Structure | Time Taken (10,000 tasks) |
|---|---|
| Causal Priority Queue (CPQ) | 0.019 sec |
| Standard Priority Queue (heapq) | 0.009 sec |
| SortedDict Priority Queue | 0.006 sec |
🤝 Contributing
- Fork the repository.
- Create a feature branch.
- Commit changes and create a pull request.
📜 License
This project is licensed under the MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file causal_priority_queue-1.0.0.tar.gz.
File metadata
- Download URL: causal_priority_queue-1.0.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59aa65b3b34be532a280b45f0d7e943914556d2828f1839b0e9003ba5ebee712
|
|
| MD5 |
ac92c60a4845532f64e5795aac623405
|
|
| BLAKE2b-256 |
4b5bb4b0bd0f79787ad78308fece1ad0ea4f89691d53836e6e9d9ecc89a68447
|
File details
Details for the file causal_priority_queue-1.0.0-py3-none-any.whl.
File metadata
- Download URL: causal_priority_queue-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e424ebacf5bd89bda1cfc02d5949438ca0962aa39e345b26cfe5603c332a0827
|
|
| MD5 |
c84ff35439e0794d14a14d63d2433a36
|
|
| BLAKE2b-256 |
3533255a42c9b4d115f8d5e5387ec3ee64d3bae5a8037ed4399eec61a9959335
|