semvec/pypi-packages huggingface dataset:
CSP-Solver 0.1.2
Library to solve Constraint satisfation problems
Requires Python: >=3.0.0


# Generic Constraint Satisfaction Problem Solver

CSP Solver is a library designed to provide the functionalities to solve contstraint satisfactions problems without the need of going through the hassle of writing the code to do so. As of now, it supports a variety of methods including but not restricted to Hill Climbing with greedy biasing, Arc Consistent backtracking etc. 

## Supported Methods!
> Depth first serch  
> solve_dfs(self: CSP, timeout: int)

> Backtracking  
> solve_BackTrack(self: CSP, timeout: int)

> Forward Checking  
> solve_ForwardChecking(self: CSP, timeout: int)

> Forward Checking with MRV ordering  
> solve_ForwardChecking_MRV(self: CSP, timeout: int)

> Forward checking with MRV & LCV ordering  
> solve_ForwardChecking_MRV_LCV(self:CSP, timeout:int)

> Classical Hill Climbing (Taking best available option)  
> solve_HillClimbing_chooseBest(self:CSP, memoization:bool, iterations:int, allowedSideMoves:int, tabuSize:int, timeout:int)

> Hill Climbing with random choice biased towards better choices  
> solve_HillClimbing_greedyBias(self:CSP, memoization:bool, iterations:int, allowedSideMoves:int, tabuSize:int, timeout:int)

> Hill Climbing with random choice  
> solve_HillClimbing_chooseRandom(self:CSP, memoization:bool, iterations:int, allowedSideMoves:int, tabuSize:int, timeout:int)

> Genetic Algorithm  
> solve_GeneticAlgo(self:CSP, populationSize:int, generations:int, timeout:int)

> Local beam search  
> solve_local_beam_search(self:CSP, beams:int, timeout:int)

> Simulated Annealing  
> solve_Simulated_Annealing(self:CSP, iterations:int, initialTemperature:int, cooling_coefficient:int, timeout:int)

> Arc consistent Backtracking  
> solve_ArcConsistent_BackTracking(self: CSP, timeout: int)

> Novel Approach  
> solve_novelAlgorithm(self, split:int, allowedSideMoves:int, tabuSize:int, tries:int, timeout:int)

> Run all methods on default parameters  
> testAllDefaultParams(self: CSP, timeout:int)

### Example
* *Initializing the class*
```python
import CSP_Solver as CS
task = CS.CSP(variables=..., solution_path=..., problem_name=...)
```
* *Adding constraints specifying domains*
```python
'''
Make sure that your constraint is python friendly
'''
task.addConstraint('value[1] != value[2]') # Example constraint
# You may use this if the domain is common for all variables
task.commonDomain(domain=[1,2,5,4]) 
# You may want to add constraints sperately
task.seperateDomain(variable=1,domain=[1,2]) 
# You may want to set value of some variable
task.setValue(variable=1, value=2)
task.testAllDefaultParams(timeout=10)
```
### Reports
* [Report](https://drive.google.com/file/d/1MkcQGpeX8d3Qng5sB2CW_B0oS5HVSeKy/view?usp=sharing)
* [Presentation](https://drive.google.com/file/d/1gMElklxYo2P_uIFUzBrgsuGk1OvaAOQR/view?usp=sharing)

### Installation
Install package from Pypi
```bash
$ pip install CSP-Solver
```

To test examples

```bash
$ git clone https://github.com/LezendarySandwich/Generic-CSP-Solver.git
$ cd Generic-CSP-Solver/Examples
$ python3 [Example]
```
License
----

MIT
oList 0.0.3
A Python 'Object List'. It's basically your standard python list that additionally lets you attach data to it that doesn't affect the actual list items itself.
Requires Python: >=3.6

# oList
##### A Python 'Object List'. It's basically your standard python list that additionally lets you attach data to it that doesn't affect the actual list items itself.<br>
##### Treat the oList as you would a normal list:<br>
```python
my_list = oList([-10,3,4,-11,7,14])
my_list.sort()
for list_item in my_list:
    print(str(list_item))
```
## oList Methods:
``` python
oList.attach('data') # can be of any type
oList.get_attachments() # returns a list or the object itself if the attachments are only 1
oList.as_dict(_attachments=True) # returns a dict, access values being index, _attachment=True will add attachment data to the dict
oList.as_tuple() # returns tuple
```
## Example Usage:
``` python
intel_list = oList([
    'i5-9600k',
    'i9-10910',
    'i9-10900K',
]).attach({
    'carrier': 'Intel',
    'description': 'A nice little list of some intel Cpus.'
})

ryzen_list = oList([
    'Ryzen 3 1200',
    'Ryzen 5 1400',
    'Ryzen 5 3600x'
]).attach({
    'carrier': 'AMD',
    'description': 'A nice little list of some Ryzen Cpus.'
})

cpu_list = oList([intel_list, ryzen_list]).attach('List of Intel and Ryzen Cpus')

# .... later on in the program ....

print("--- " + cpu_list.get_attachments() + " ---\n")

for cpus in cpu_list:
    print(cpus.get_attachments())
    for cpu in cpus:
        print(cpus.get_attachments()['carrier'] + ' - ' + cpu)
    print('')


# OUTPUT:
# --- List of Intel and Ryzen Cpus ---
#
# {'carrier': 'Intel', 'description': 'A nice little list of some intel Cpus.'}
# Intel - i5-9600k
# Intel - i9-10910
# Intel - i9-10900K
#
# {'carrier': 'AMD', 'description': 'A nice little list of some Ryzen Cpus.'}
# AMD - Ryzen 3 1200
# AMD - Ryzen 5 1400
# AMD - Ryzen 5 3600x
```
song-and-spell 0.20.0
A configurable, mutable toddler radio that encourages spelling

# song-and-spell

### tl;dr

A key-logger that triggers playing an audio track when a sequence of keys are pressed and  a web-app to configure the words and songs.

Requires VLC to be installed on the host and an X server to be running.

### install on raspberry-pi 400

##### With a screen attached
We need to force the  X-server to start when the HDMI cable is not plugged in (for the pynput key-logger). The easiest way I found is to run `sudo raspi-config`, then select Advanced, Screen and pick any screen resolution except for the default one.

Pair, trust and connect your bluetooth speaker. There are many guides for this,  [here is one](https://raspberrydiy.com/connect-raspberry-pi-bluetooth-speaker/).

To install the app, add a systemd-service so that it starts on start-up  and make some other changes so that it can headlessly connect to a bluetooth speaker, download and install the [install script](/scripts/install_rpi.sh) on your raspberry-pi 400. In a terminal:

**Note: this script will only work on a raspberry-pi (or any debian-derived OS with a bluetooth transciever and a normal user `pi` that is in the audio and bluetooth groups).**

```
curl -L https://raw.githubusercontent.com/cboddy/song-and-spell/master/scripts/install_rpi.sh | sudo bash
```

Note: this will restart your raspberry-pi. Turn on your speaker and it should automatically connect and go to the web-ui running on port 5000. It should look like the image below.

### web-ui
![](https://github.com/cboddy/song-and-spell/blob/master/images/song_and_spell_webui.png)

### todo 
* volume-normalisation?

### notes
* the pynput library requires an X server to be running. Set default resolution in `raspi-config` (anything other than default) to force the X server to start. 

### development

```
python3 -m venv
. bin/venv/activate
python3 setup.py develop
```