#### Overview of this book

Artificial intelligence (AI) plays an integral role in automating problem-solving. This involves predicting and classifying data and training agents to execute tasks successfully. This book will teach you how to solve complex problems with the help of independent and insightful recipes ranging from the essentials to advanced methods that have just come out of research. Artificial Intelligence with Python Cookbook starts by showing you how to set up your Python environment and taking you through the fundamentals of data exploration. Moving ahead, you’ll be able to implement heuristic search techniques and genetic algorithms. In addition to this, you'll apply probabilistic models, constraint optimization, and reinforcement learning. As you advance through the book, you'll build deep learning models for text, images, video, and audio, and then delve into algorithmic bias, style transfer, music generation, and AI use cases in the healthcare and insurance industries. Throughout the book, you’ll learn about a variety of tools for problem-solving and gain the knowledge needed to effectively approach complex problems. By the end of this book on AI, you will have the skills you need to write AI and machine learning algorithms, test them, and deploy them for production.
Table of Contents (13 chapters)
Preface
Getting Started with Artificial Intelligence in Python
Free Chapter
Advanced Topics in Supervised Machine Learning
Patterns, Outliers, and Recommendations
Probabilistic Modeling
Heuristic Search Techniques and Logical Inference
Deep Reinforcement Learning
Advanced Image Applications
Working with Moving Images
Deep Learning in Audio and Speech
Natural Language Processing
Artificial Intelligence in Production
Other Books You May Enjoy

# Solving the n-queens problem

In mathematical logic, satisfiability is about whether a formula can be valid under some interpretation (parameters). We say that a formula is unsatisfiable if it can't be true under any interpretation. A Boolean satisfiability problem, or SAT, is all about whether a Boolean formula is valid (satisfiable) under any of the values of its parameters. Since many problems can be reduced to SAT problems, and solvers and optimizations for it exist, it is an important class of problems.

SAT problems have been proven to be NP-complete. NP-completeness (short for nondeterministic polynomial time) means that a solution to a problem can be verified in polynomial time. Note that this doesn't mean that a solution can be found quickly, only that a solution can be verified quickly. NP-complete problems are often approached with search heuristics and algorithms.

In this recipe, we'll address a SAT problem in various ways. We'll take a relatively simple...