{"id":16685316,"url":"https://github.com/wadaboa/randomkcnfsolver","last_synced_at":"2025-03-13T14:41:15.411Z","repository":{"id":87170681,"uuid":"166648017","full_name":"Wadaboa/RandomKCNFSolver","owner":"Wadaboa","description":"Random KCNF formulas generator and WalkSAT solver implementation for AI class at UNIFI","archived":false,"fork":false,"pushed_at":"2019-01-26T09:18:47.000Z","size":295,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-20T10:23:04.327Z","etag":null,"topics":["cnf-clauses","propositional-logic","random","sat-solver","walksat-algorithm"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Wadaboa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-20T10:18:29.000Z","updated_at":"2025-01-03T10:59:04.000Z","dependencies_parsed_at":"2023-03-13T19:44:50.855Z","dependency_job_id":null,"html_url":"https://github.com/Wadaboa/RandomKCNFSolver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wadaboa%2FRandomKCNFSolver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wadaboa%2FRandomKCNFSolver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wadaboa%2FRandomKCNFSolver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wadaboa%2FRandomKCNFSolver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wadaboa","download_url":"https://codeload.github.com/Wadaboa/RandomKCNFSolver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243428422,"owners_count":20289315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cnf-clauses","propositional-logic","random","sat-solver","walksat-algorithm"],"created_at":"2024-10-12T14:46:58.144Z","updated_at":"2025-03-13T14:41:15.388Z","avatar_url":"https://github.com/Wadaboa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RandomKCNFSolver\nThis repository provides tools to generate random K-CNF(M, N) formulas and check their satisfiability, by using a WalkSAT algorithm implementation. You can get a brief help on how to use these tools by running `python randomkcnfsolver.py --help` or `python randomkcnfsolver.py -h` from the command line.\n\nSoftware was made using python version 3.7.\nIf you have both python 2 and python 3 installed on your machine, you should run `python3 randomkcnfsolver.py`.\nFrom now on I'll call `python randomkcnfsolver.py` or `python3 randomkcnfsolver.py` → `\u003cheader\u003e`.\n\n# Prerequisites\nSoftware was made using the following libs:\n* NumPy (http://www.numpy.org/)\n* Matplotlib (https://matplotlib.org/)\n\n# Usage\nFirst of all, download the *Source Files* folder on your system. Now, open a terminal window and navigate to that folder. if you just run the program using `\u003cheader\u003e` it will automatically start as if you typed `\u003cheader\u003e -o plot` or `\u003cheader\u003e --output plot`. You can also start the software using the following, not required, options:\n1. `\u003cheader\u003e -o model` or `\u003cheader\u003e --output model`: Computes a single random K-CNF(M, N) formula and returns a model that satisfies it or failure. From now on I'll call `-o model` or `--output model` → `\u003cmodel\u003e`. You can also provide additional (optional) inputs and combine them together:\n    * `\u003cheader\u003e \u003cmodel\u003e -k K`: K represents the K factor in a single randomly generated K-CNF(M, N) formula. Defaults to 10.\n    * `\u003cheader\u003e \u003cmodel\u003e -m M`: M represents the M factor in a single randomly generated K-CNF(M, N) formula. Defaults to 10.\n    * `\u003cheader\u003e \u003cmodel\u003e -n N`: N represents the N factor in a single randomly generated K-CNF(M, N) formula. Defaults to 5.\n    * `\u003cheader\u003e \u003cmodel\u003e -p P`: Probability of going for a 'random walk' in WalkSAT. Defaults to 0.5.\n    * `\u003cheader\u003e \u003cmodel\u003e -f FLIPS` or `\u003cheader\u003e \u003cmodel\u003e --flips FLIPS`: Maximum number of iterations in WalkSAT. Defaults to 1000.\n1. `\u003cheader\u003e -o plot` or `\u003cheader\u003e --output plot`: Computes random K-CNF(M, N) formulas and displays two plots which relates M/N ratio with P(satisfiable) and WalkSAT runtime. From now on I'll call `-o plot` or `--output plot` → `\u003cplot\u003e`. You can also provide additional (optional) inputs and combine them together:\n    * `\u003cheader\u003e \u003cplot\u003e -k K`: As described above.\n    * `\u003cheader\u003e \u003cplot\u003e --max_m MAX_M`: Maximum M factor for a randomly generated M to use in a K-CNF(M, N) formula. Defaults to 100.\n    * `\u003cheader\u003e \u003cplot\u003e --max_n MAX_N`: Maximum N factor for a randomly generated M to use in a K-CNF(M, N) formula. Defaults to 50.\n    * `\u003cheader\u003e \u003cplot\u003e -p P`: As described above.\n    * `\u003cheader\u003e \u003cplot\u003e -f FLIPS` or `\u003cheader\u003e \u003cplot\u003e --flips FLIPS`: As described above.\n    * `\u003cheader\u003e \u003cplot\u003e -t TRIES` or `\u003cheader\u003e \u003cplot\u003e --tries TRIES`: Number of different tries to average P(satisfiable) per each M/N ratio. Defaults to 5.\n    * `\u003cheader\u003e \u003cplot\u003e -l LOOPS` or `\u003cheader\u003e \u003cplot\u003e --loops LOOPS`: Number of different M/N ratios to generate. Defaults to 30.\n    \nRemember to grant executable permissions for each file in the *Source Files* folder, using `chmod +x \u003csource_file.py\u003e`.\n\n# Use cases\nSome examples on how to actually use the software. Just copy and paste in a command line interface:\n1. `python randomkcnfsolver.py -o model -k 5 -m 40 -n 20`. If you obtain *failure* as result, try and tweak some of WalkSAT properties, like: `python randomkcnfsolver.py -o model -k 5 -m 40 -n 20 -f 2000 -p 0.7`.\n1. `python randomkcnfsolver.py -o plot -k 4 --max_m 200 --max_n 30`. If the resulting plot contains too much *P(satisfiable) = 0*, try and tweak some of WalkSAT properties, like: `python randomkcnfsolver.py -o plot -k 4 --max_m 200 --max_n 30 -f 2000 -p 0.7`. If you want more data to be processed, just run something like `python randomkcnfsolver.py -o plot -k 4 --max_m 200 --max_n 30 -l 100 -t 10`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwadaboa%2Frandomkcnfsolver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwadaboa%2Frandomkcnfsolver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwadaboa%2Frandomkcnfsolver/lists"}