Learn to Create your * Problem Solving * Algorithms!
TODAY! w/ Machine Learning & Data Structures
Artificial Intelligence Series
Copyright 2016 - All rights reserved. In no way is it legal to reproduce, duplicate, or transmit any part of this document in either electronic means or in printed format. Recording of this publication is strictly prohibited and any storage of this document is not allowed unless with written permission from the publisher. All rights reserved. The information provided herein is stated to be truthful and consistent, in that any liability, in terms of inattention or otherwise, by any usage or abuse of any policies, processes, or directions contained within is the solitary and utter responsibility of the recipient reader. Under no circumstances will any legal responsibility or blame be held against the publisher for any reparation, damages, or monetary loss due to the information herein, either directly or indirectly.
Respective authors own all copyrights not held by the publisher. Legal Notice: This ebook is copyright protected. This is only for personal use. You cannot amend, distribute, sell, use, quote or paraphrase any part or the content within this ebook without the consent of the author or copyright owner. Legal action will be pursued if this is breached. Disclaimer Notice: Please note the information contained within this document is for educational and entertainment purposes only.
Every attempt has been made to provide accurate, up to date and reliable complete information. No warranties of any kind are expressed or implied. Readers acknowledge that the author is not engaging in the rendering of legal, financial, medical or professional advice. By reading this document, the reader agrees that under no circumstances are we responsible for any losses, direct or indirect, which are incurred as a result of the use of information contained within this document, including, but not limited to, errors, omissions, or inaccuracies. Table of Contents
Preface: JAVASCRIPT as Artificial Intelligence
========================= ====== Javascript has been making waves lately as one of the main Web Technologies (HTML, CSS, and Javascript). Some websites and web apps are fully embracing Javascript technology to carry out most web tasks.
The best part of all is that Javascript is a client-side language, meaning that your computer or mobile device does the computation - and not the Server itself. So this gives apps an opportunity stay usable even when servers arent. In the future, Javascript may be a first choice for multi-platform apps due to its universality and flexibility. Therefore, it will be worth your while to learn more advanced concepts using Javascript code. How youll progress through this book The goal of this book is to expand your programming skills onto a new paradigm - namely, the realm of artificial intelligence. You may be a skilled programmer hoping to learn new skills, or someone new to programming, or even both.
No matter what your programming skill level is, we hope you find some intriguing information within these pages. Youll see first-hand how algorithm procedures within AI make decisions and generate answers, given sets of data. First, well go over Constraint Satisfaction. Ever had schedule a night out with friends, but had to consider their availability throughout a day? Of course, youd ask what times theyre available. Now, try scheduling a meeting with thousands of people. Thatll be quire hard to do alone, wouldnt it? A Quick Start Included is a quick kit to cover Basic Javascript Programming.
Youll find what you need to get a good start in programming Javascript. Then, youll be prepared to use the many tools and components of AI throughout the book.
Introduction
==== ==== ==== ==== ==== Logic. Rationality. Reasoning. Analysis. Analysis.
Calculation. Decision-making. All this is within the mind of a human being, correct? Humanity has been blessed with the ability to think and act so intelligently. Then came Machine. Humanity has also blessed it the gift of intelligence. And in todays world, you can see firsthand what an intelligent mind can do for you; carry a conversation, give you directions to a certain location, play a video game as an opponent, and so on.
In essence, only our imaginations will limit us from whats truly possible An Artificial Intelligence Agent In terms of Artificial Intelligence, an agent can be anything that, given an environment to focus on, can think intelligently and act independently. It can continue observing and learning through experience. It can calculate and independently decide the best course of action, whether it has perfect knowledge of the situation or just a part of it. It can also take note and adapt to a changing environment. So you might wonder, how has mankind ever developed something so complex? Well, its not as complex as you think. If you understand the process of how a computer can observe, learn, and expand its knowledge - and how it can take all this information and come up with an ideal solution or decision - then an artificially created mind wont be as complex as you think.
Sometimes, it can take as little as a few lines of code to have a computer come up with solutions for you. Sometimes it can take hundreds. Sometimes, thousands.
Chapter 1: Algorithms: The Essentials
==== ==== ==== ==== ==== In essence, how an AI agent will contemplate, process, rationalize, apply logic, & ultimately generate solutions will mainly be through the use of algorithms. If youre new to programming, dont be intimidated. An algorithm is essentially a procedure to handle data.
As long as you understand how a certain algorithm processes its data, youll be fine. Algorithm Traits First, youll want your algorithms to satisfy four key factors: - Completeness - Optimization - Time Complexity - Space Complexity Now well go through each of these and explain them all. Afterwards, youll explore some algorithm ideas and determine how they fit in to each of these factors. Completeness If an algorithm is guaranteed to find at least one existing solution or conclusion within a certain time frame, we can say that an algorithm is complete. Optimization If an algorithm finds a solution and guarantees that it is the optimal one, then that algorithm is considered optimal. Time Complexity For an algorithm, this is an expression for the longest possible time it will take to complete.
In other words, the worst-case scenario when it runs and finds a suitable solution. Space Complexity This expression is similar to Time Complexity, but instead it represents the maximum amount of memory the algorithm may use in order to find a solution. This is also considered the worst-case scenario. Your Ideal Algorithm After discussing the traits your algorithm can have, youll get an idea in what to look for when creating an AI algorithm. You want to design yours to find at least one solution (completeness), and the best solution it can create given data it has (optimization) while using up as little computational effort as you can (Time & Space Complexity)
Javascript 01a: using AI to Solve Complex Time Scheduling
========================= ====== Imagine 5 of your friends trying to get together and have fun somewhere. It might sound simple at first, but it can become far more complicated than you think.
What if one of your friends has work at certain times? What if another friend has school? What if he/she has a prior engagement? Soccer practice? Dance classes? Study time? Sure, you can all get together and have fun. However, it has to be at a time when EVERYONE is available. So, given each friend you have, you need to lay out their time schedules, then cross out times that theyre busy. Afterwards, if there is some common available time among all your friends, everyone says theyre available, then you and your friends have fun. Lets have another example. How do you think a 32-team Sports League will schedule games throughout a year? For all 32 teams, they each need to match up with up to one other team to schedule a game.