How do i create an AI program.? I think this question violates the Community Guidelines. Chat or rant, adult content, spam, insulting other members,show more. I think this question violates the Terms of Service. Harm to minors, violence or threats, harassment or privacy invasion, impersonation or misrepresentation, fraud or phishing, show more. If you believe your intellectual property has been infringed and would like to file a complaint, please see our Copyright/IP Policy. Using Artificial Intelligence to Write Self- Modifying/Improving Programs. This article is the first in a series of three. See also: Part 1, Part 2, Part 3. Introduction. Is it possible for a computer program to write its own programs? Could human software developers be replaced one day by the very computers that they master? Just like the farmer, the assembly line worker, and the telephone operator, could software developers be next? While this kind of idea seems far- fetched, it may actually be closer than we think. This article describes an experiment to produce an AI program, capable of developing its own programs, using a genetic algorithm implementation with self- modifying and self- improving code. The program created the above result in 2. The programming language is brainfuck. Using Artificial Intelligence to Write Self-Modifying. Intelligence to Write Self-Modifying/Improving. Adobe Illustrator can make an artist out of us all! Join us for this series of videos and discover how simple it is to create a personalized logo using vector based. Why this programming language? Read on. All code for the AI program is available at Git.
Hub. Artificial Intelligence Takes Up Coding. Artificial intelligence has been progressing steadily over the years, along with advances in computer technology, hardware, memory, and CPU speeds. As computers get faster, more computations can be performed, allowing increasing power for the computation- intensive processing required by many AI algorithms. An AI Hobby. It. The AI must learn, on its own, how to create a fully functioning program for a specific purpose. I initially began this venture in the late 1. This was a difficult task for a multitude of reasons. First, using if/then/else conditionals to write a random program doesn. Second, the number of computer instructions available in BASIC is far too great. Even more troublesome, some of the instructions are downright dangerous (Shell(! I also attempted to generate programs using C, C++, and a few other languages. However, this naive approach never produced a working child program. Although this was due not just from using simple if/then/else statements, but also because the selected programming language was intended to be usable by humans - not computers, and thus, far more complicated for an AI to automate. While the ultimate goal would be to produce a computer program capable of writing its own word processing software, image editing tool, web browser, or disk defragmenter, I was more- so interested in a simple proof- of- concept that demonstrated the idea was possible. A Lot of Monkeys and Broken Typewriters. My initial motivation behind the idea came from the infinite monkey theorem, which states if you have 1,0. This sounds ridiculous, but given enough time, surely the monkeys would end up hitting . Simplifying this idea, surely one of the monkeys would at least hit the first letter of a Shakespeare play somewhere in the banging of the keyboard; that? Each time one of the monkeys hits a correct key in the right sequence you reward him with a banana? After a long enough time, maybe the monkey would begin to pick up a pattern? A genetic algorithm is a type of artificial intelligence, modeled after biological evolution, that begins with no knowledge of the subject, aside from available tools and valid instructions. The AI picks a series of instructions at random (to serve as a piece of DNA) and checks the fitness of the result. It does this with a large population size, of say 1. Surely, some of the programs are better than others. Visit http:// The right hand side of the screen is my AI program. Those that have the best fitness are mated together to produce offspring. Each generation gets a bit of extra diversity from evolutionary techniques such as roulette selection, crossover, and mutation. The process is repeated with each child generation, hopefully producing better and better results, until a target solution is found. Genetic algorithms are programmatic implementations of survival of the fittest. They can also be classified as artificially intelligent search algorithms, with regard to how they search an immense problem space for a specific solution. Ok, But Why Brainf- ck? While the original experiments using BASIC, C, C++, and other languages failed to produce results, I was able to successfully generate AI written programs by combining a home- grown programming language (consisting of add, subtract, loop, etc) with genetic algorithms and neural networks. While this was interesting, the end result was simple math calculation and the programming language itself, was unknown and had severe limitations with what it could ultimately produce. I began searching for a simple programming language, with a limited number of instructions, that I could train an AI program to use. Assembly (ASM) is close, but still contains far too many permutations. As humorous as it sounds, I eventually experimented with brainf- ck and was finally able to successfully generate the code shown above. While brainf- ck is intended to be a joke programming language, due to how difficult it is for humans to work with, it actually has several distinct advantages for computers. Advantages of Brainf- ck as an AI Programming Language. A programming language with this capability opens up a vast array of possibilities. After all, most, if not all computer programs are designed to perform some kind of computation and output the result in some manner. It consists of a simplified set of only 8 instructions. The simplified instruction set reduces the search space in which a target program code can be found. As computers get faster, larger problem spaces can be searched. However, on a personal computer, the search space needs to be constrained. By limiting the programming instruction set to just 8 different characters, the AI can run much faster and obtain an optimal fitness score within a reasonable amount of time (ie., minutes, hours, or possibly even a day). By including the interpreter within the AI program + genetic algorithm itself, the code can be optimized to run much faster than if it had to call an outside compiler to execute each child program. This also provides security constraints, since the child programs are running within a controlled environment, within the AI program. The AI also gains access to the internal components of the interpreter, such as memory, instructions, and output. This is useful in calculating a fitness score. Whereas, with a 3rd- party compiler, these components would be far more difficult to access. Each instruction is 1 byte. The AI program used in this article is designed in C# . NET and uses an array of doubles to serve as a genome. Each double (gene) in the genome corresponds to an instruction in the programming language. Since each instruction is just 1 byte, it. Potential exists for the instructions to be expanded upon. Most interpreters for the programming language simply execute the code, maintain memory values, and include support for console input/output. Just think of the power you could give the AI to develop its own programs! In this manner, it can execute multiple fitness algorithms for multiple genomes in the population, upon each generation. This allows the program to utilize maximal CPU resources and take advantage of multiple CPU cores. The program also saves its state every 1. PC is shutdown, and it can continue searching from where it left off. The Fitness Method. The fitness method works by scoring the output of the generated program. The score is calculated by looking at each character output by the program (if any output was produced at all) and subtracting its value from the desired character: 1fitness += 2. Math. Abs(console. These are simply discarded, favoring programs that at least output something; and further guided and evolved until the output result is closer and closer to the desired solution. Interpreter Instruction Set. Brainf- ck consists of the following instruction set: 1. Increment the pointer.< Decrement the pointer.+ Increment the byte at the pointer.- Decrement the byte at the pointer. It produced the following code: 1+. Note the output. If we trim off the excess code, we see the following syntactically- valid code: 1+. You can see how the AI learned how to program in the target language and achieve the desired solution. The AI successfully wrote a program to output . It produced the following code: 1. The AI was able to overcome this by creating an inner- loop, within the problematic one, that successfully output the correct character, and continued processing. Hi! The AI successfully wrote a program to output . It produced the following code: 1> -- -- -- -- -- -< ++. Run it and you can see why (click Start Debugger and Run to Breakpoint). This is likely due to the characters used, which include a capital letter and a symbol. The other two examples used characters that are much closer in value in the ASCII system, which would be easier for the AI to find. The AI successfully wrote a program to output . It produced the following code: 1. It may have been tricky due to its length, or possibly due to the location of the d. The AI would repeatedly get stuck within a local maximum. A local maximum is when a genetic algorithm finds the best fitness that it can see within its current parameters, even though a better fitness may exist. The AI is unable to get out of its hole and achieve the better fitness because doing so would require the fitness to drop before increasing again, which is generally against the rules of a genetic algorithm. I was able to resolve this issue by including additional diversity in the mutation function. Previously, the mutation worked by simply altering a single instruction in the genome. Mutation was enhanced to include not just mutating a single bit (replacement mutation), but also shifting the bits up (insertion mutation), and shifting down (deletion mutation). This extra diversity allowed the AI to keep moving. This was produced after 5. It produced the following code: 1. It produced the following code: 1. The full length of the program code was not needed by the AI. It was able to write the program with just 2. Note, this solution took 1.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2016
Categories |