Giter Site home page Giter Site logo

dleedev365 / aima_python_practices Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 8 KB

N-Queens Problem, CSP problem, Minisat, Min-Conflicts, Hill-Climbing Search, Backtracking Search

Python 100.00%
aima-python backtracking csp-problem hill-climbing min-conflict nqueens-problem

aima_python_practices's Introduction

aima_python_practices

N-Queens Problem, CSP problem, Minisat

The following files are to explore the Ice Breaker Problem: given a group of n people, what's the minimum number of teams they can be partitioned into such that no team has 2 (or more) people who are friends.

Premise

n people are named 0, 1, 2, …, n−1, and that we have what we will call a friendship graph, i.e. a graph with n nodes labeled 0 to n−1 (each node is a person), where nodes i and j are connected by an edge just when i and j are friends. Friendship is symmetric: if i is a friend of j, then j is a friend of i. Plus a person cannot be friends with themselves.

N-queens with SAT

use minisat to solve some constraint satisfaction problems.

make_queen_sat(N) generates a SAT sentence (as a Python string) that, when satisfied, will be a solution to the N-queens problem. draw_queen_sat_sol(sol) takes the output of minsat as a string and draws the resulting N-queens solution on the screen (using print). make_ice_breaker_sat(graph, k) takes a friendship graph as input (see assignment 2) and a positive integer k representing the number of possible teams (i.e. each node can be one of k colors). It returns, as a Python string, an encoding as a SAT problem that can be used as input to minisat. find_min_teams(graph) uses minisat to find the (exact) minimum number of teams the people can be divided into such that no team has any friends (teams of 1 are permitted). find_min_teams(graph) returns a single integer: the (exact) minimum number of teams.

aima_python_practices's People

Contributors

dleedev365 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.