├── _config.yml ├── Ackley ├── Ackley.pdf ├── cross over │ ├── uniform │ │ └── uniform_files │ │ │ └── require.min.js.download │ └── one point │ │ └── onepoint_files │ │ └── require.min.js.download ├── first population │ ├── random │ │ └── random_files │ │ │ └── require.min.js.download │ └── Heuristic │ │ └── Heuristic_files │ │ └── require.min.js.download ├── select parents │ ├── Relative │ │ ├── Relative_files │ │ │ └── require.min.js.download │ │ └── Relative.ipynb │ └── computation │ │ └── computation_files │ │ └── require.min.js.download └── Akley.ipynb ├── 8-Queen ├── 8 queen.pdf ├── cross over │ └── one point │ │ └── one point_files │ │ └── require.min.js.download └── select parents │ └── Relative │ └── Relative_files │ └── require.min.js.download ├── Hopfield ├── Hopfield.docx ├── Hopfield.pdf ├── characters.txt ├── hopfield.cpp └── noise.txt ├── Perceptron ├── .DS_Store ├── تمرین 1 - پرسپترون - حل تمرین.pdf ├── font.txt └── perceptron - font.ipynb ├── McCulloch-Pitts ├── code │ └── McCulloch-Pitts.py └── work-report.md ├── LICENSE.md ├── work-report.md └── README.md /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-time-machine 2 | -------------------------------------------------------------------------------- /Ackley/Ackley.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hosseindamavandi/Computational-Intelligence/HEAD/Ackley/Ackley.pdf -------------------------------------------------------------------------------- /8-Queen/8 queen.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hosseindamavandi/Computational-Intelligence/HEAD/8-Queen/8 queen.pdf -------------------------------------------------------------------------------- /Hopfield/Hopfield.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hosseindamavandi/Computational-Intelligence/HEAD/Hopfield/Hopfield.docx -------------------------------------------------------------------------------- /Hopfield/Hopfield.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hosseindamavandi/Computational-Intelligence/HEAD/Hopfield/Hopfield.pdf -------------------------------------------------------------------------------- /Perceptron/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hosseindamavandi/Computational-Intelligence/HEAD/Perceptron/.DS_Store -------------------------------------------------------------------------------- /Perceptron/تمرین 1 - پرسپترون - حل تمرین.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hosseindamavandi/Computational-Intelligence/HEAD/Perceptron/تمرین 1 - پرسپترون - حل تمرین.pdf -------------------------------------------------------------------------------- /McCulloch-Pitts/code/McCulloch-Pitts.py: -------------------------------------------------------------------------------- 1 | a1 = int(input()) 2 | a2 = int(input()) 3 | a3 = int(input()) 4 | a4 = int(input()) 5 | 6 | w1 = float(input()) 7 | w2 = float(input()) 8 | w3 = float(input()) 9 | w4 = float(input()) 10 | 11 | soma = float(input()) 12 | 13 | sum = (a1 * w1) + (a2 * w2) + (a3 * w3) + (a4 * w4) 14 | 15 | if sum > soma : 16 | print(1) 17 | 18 | else: 19 | print(0) 20 | -------------------------------------------------------------------------------- /Hopfield/characters.txt: -------------------------------------------------------------------------------- 1 | 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 2 | 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 0 0 0 1 1 0 0 0 1 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 0 0 0 1 1 1 0 0 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 0 3 | 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 4 | 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 0 0 1 1 0 0 0 0 1 1 1 0 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 0 0 5 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Hossein Damavandi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /work-report.md: -------------------------------------------------------------------------------- 1 | ## Hosein Damavandi 2 | 3 | ### Assignment 1 : 4 | 5 | --- 6 | 7 | #### Questions: 8 | 9 | ![image](https://user-images.githubusercontent.com/83751182/133993994-2c2ec93c-678d-482e-8883-b6aff540ce2b.png) 10 | 11 | 12 | | **number** | **Neuron Weights** |**soma**| 13 | |:-------------|:----------------------|:-------| 14 | | run 1 |[ 2 , -3 , 1 , 0 ] | 1.5 | 15 | | run 2 |[ -2 , -2 , -2 , -2 ] | -2.5 | 16 | | run 3 |[ 2 , -1 , 1.5 , -5 ] | 1 | 17 | | run 4 |[ 1 , 1 , 1 , 1 ] | -1.5 | 18 | | run 5 |[ 0.5 , -0.5 , 0 , -1 ]| 0 | 19 | 20 | 21 | 22 | #### Answers: 23 | 24 | python: 25 | ```py 26 | # get Neuron 27 | a1 = int(input()) 28 | a2 = int(input()) 29 | a3 = int(input()) 30 | a4 = int(input()) 31 | 32 | # get weight for each Neuron 33 | w1 = float(input()) 34 | w2 = float(input()) 35 | w3 = float(input()) 36 | w4 = float(input()) 37 | 38 | # get soma 39 | soma = float(input()) 40 | 41 | # Calculate the sum of neuron input and its weight 42 | sum = (a1 * w1) + (a2 * w2) + (a3 * w3) + (a4 * w4) 43 | 44 | # Output condition 45 | if sum > soma : 46 | print(1) 47 | 48 | else: 49 | print(0) 50 | 51 | ``` 52 | 53 | | - |1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16| 54 | |:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---| 55 | | - |0|0|0|0|0|0|0|0|1|1 |1 |1 |1 |1 |1 |1 | 56 | | - |0|0|0|0|1|1|1|1|0|0 |0 |0 |1 |1 |1 |1 | 57 | | - |0|0|1|1|0|0|1|1|0|0 |1 |1 |0 |0 |1 |1 | 58 | | - |0|1|0|1|0|1|0|1|0|1 |0 |1 |0 |1 |0 |1 | 59 | | run 1 |0|0|0|0|0|0|0|0|1|1 |1 |1 |0 |0 |0 |0 | 60 | | run 2 |1|1|1|0|1|0|0|0|1|0 |0 |0 |0 |0 |0 |0 | 61 | | run 3 |0|0|1|0|0|0|0|0|1|0 |1 |0 |0 |0 |1 |0 | 62 | | run 4 |1|1|1|1|1|1|1|1|1|1 |1 |1 |1 |1 |1 |1 | 63 | | run 5 |0|0|0|0|0|0|0|0|1|0 |1 |0 |0 |0 |0 |0 | 64 | 65 | ![image](https://user-images.githubusercontent.com/83751182/134060360-e49c5e20-c27e-4ea0-a41f-89cac861a1a3.png) 66 | -------------------------------------------------------------------------------- /McCulloch-Pitts/work-report.md: -------------------------------------------------------------------------------- 1 | ## Hosein Damavandi 2 | 3 | ### Assignment 1 : 4 | 5 | --- 6 | 7 | #### Questions: 8 | 9 | ![image](https://user-images.githubusercontent.com/83751182/133993994-2c2ec93c-678d-482e-8883-b6aff540ce2b.png) 10 | 11 | 12 | | **number** | **Neuron Weights** |**soma**| 13 | |:-------------|:----------------------|:-------| 14 | | run 1 |[ 2 , -3 , 1 , 0 ] | 1.5 | 15 | | run 2 |[ -2 , -2 , -2 , -2 ] | -2.5 | 16 | | run 3 |[ 2 , -1 , 1.5 , -5 ] | 1 | 17 | | run 4 |[ 1 , 1 , 1 , 1 ] | -1.5 | 18 | | run 5 |[ 0.5 , -0.5 , 0 , -1 ]| 0 | 19 | 20 | 21 | 22 | #### Answers: 23 | 24 | python: 25 | ```py 26 | # get Neuron 27 | a1 = int(input()) 28 | a2 = int(input()) 29 | a3 = int(input()) 30 | a4 = int(input()) 31 | 32 | # get weight for each Neuron 33 | w1 = float(input()) 34 | w2 = float(input()) 35 | w3 = float(input()) 36 | w4 = float(input()) 37 | 38 | # get soma 39 | soma = float(input()) 40 | 41 | # Calculate the sum of neuron input and its weight 42 | sum = (a1 * w1) + (a2 * w2) + (a3 * w3) + (a4 * w4) 43 | 44 | # Output condition 45 | if sum > soma : 46 | print(1) 47 | 48 | else: 49 | print(0) 50 | 51 | ``` 52 | 53 | | - |1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16| 54 | |:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---| 55 | | - |0|0|0|0|0|0|0|0|1|1 |1 |1 |1 |1 |1 |1 | 56 | | - |0|0|0|0|1|1|1|1|0|0 |0 |0 |1 |1 |1 |1 | 57 | | - |0|0|1|1|0|0|1|1|0|0 |1 |1 |0 |0 |1 |1 | 58 | | - |0|1|0|1|0|1|0|1|0|1 |0 |1 |0 |1 |0 |1 | 59 | | run 1 |0|0|0|0|0|0|0|0|1|1 |1 |1 |0 |0 |0 |0 | 60 | | run 2 |1|1|1|0|1|0|0|0|1|0 |0 |0 |0 |0 |0 |0 | 61 | | run 3 |0|0|1|0|0|0|0|0|1|0 |1 |0 |0 |0 |1 |0 | 62 | | run 4 |1|1|1|1|1|1|1|1|1|1 |1 |1 |1 |1 |1 |1 | 63 | | run 5 |0|0|0|0|0|0|0|0|1|0 |1 |0 |0 |0 |0 |0 | 64 | 65 | ![image](https://user-images.githubusercontent.com/83751182/134060360-e49c5e20-c27e-4ea0-a41f-89cac861a1a3.png) 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🧠 Computational-Intelligence 2 | Computational Intelligence Assignment 3 | 4 | [View All of my assignment on GitHub](https://github.com/hoseindamavandi/Computational-Intelligence) 5 | 6 | ## 📖 Table of Contents 7 | 8 | | Assignment | Topic | Concept | Source Code | Work Report | 9 | | ---------------------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | 10 | | Assignment-1 | [McCulloch-Pitts](https://github.com/hoseindamavandi/Computational-Intelligence/tree/gh-pages/McCulloch-Pitts) | ANN | [McCulloch-Pitts](https://github.com/hoseindamavandi/Computational-Intelligence/blob/gh-pages/McCulloch-Pitts/code/McCulloch-Pitts.py) | [Work-Report](https://github.com/hoseindamavandi/Computational-Intelligence/blob/gh-pages/McCulloch-Pitts/work-report.md) | 11 | | Assignment-2 | [Ackley](https://github.com/hoseindamavandi/Computational-Intelligence/tree/gh-pages/Ackley) | GA | [Ackley](https://github.com/hoseindamavandi/Computational-Intelligence/blob/gh-pages/Ackley/Akley.ipynb) | [Work-Report](https://github.com/hoseindamavandi/Computational-Intelligence/blob/gh-pages/Ackley/Ackley.pdf) 12 | | Assignment-2 | [8-Queen](https://github.com/hoseindamavandi/Computational-Intelligence/tree/gh-pages/Ackley) | GA | [8-Queen](https://github.com/hoseindamavandi/Computational-Intelligence/blob/gh-pages/8-Queen/8%20Queens.ipynb) | [Work-Report](https://github.com/hoseindamavandi/Computational-Intelligence/blob/gh-pages/8-Queen/8%20queen.pdf) 13 | | TA-Assignment-1 | [Perceptron](https://github.com/hoseindamavandi/Computational-Intelligence/tree/gh-pages/Perceptron) | ANN | [Perceptron (Character Recognition)](https://github.com/hoseindamavandi/Computational-Intelligence/blob/gh-pages/Perceptron/perceptron%20-%20font.ipynb) | [Work-Report](https://github.com/hoseindamavandi/Computational-Intelligence/blob/gh-pages/Perceptron/%D8%AA%D9%85%D8%B1%DB%8C%D9%86%201%20-%20%D9%BE%D8%B1%D8%B3%D9%BE%D8%AA%D8%B1%D9%88%D9%86%20-%20%D8%AD%D9%84%20%D8%AA%D9%85%D8%B1%DB%8C%D9%86.pdf) 14 | | TA-Assignment-2 | [Hopfield](https://github.com/hoseindamavandi/Computational-Intelligence/tree/gh-pages/Hopfield) | ANN | [Hopfield (Restore Characters)](https://github.com/hoseindamavandi/Computational-Intelligence/blob/gh-pages/Hopfield/hopfield.cpp) | [Work-Report](https://github.com/hoseindamavandi/Computational-Intelligence/blob/gh-pages/Hopfield/Hopfield.pdf) 15 | 16 | -------------------------------------------------------------------------------- /Perceptron/font.txt: -------------------------------------------------------------------------------- 1 | A1 -1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,1,1,1,1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,1,1,1,-1,1,1,1, 2 | B1 1,1,1,1,1,1,-1,-1,1,-1,-1,-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-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,1,1,1,1,1,1 25 | J3 -1,-1,-1,-1,1,1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,1,-1,-1 26 | K3 1,1,1,-1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,1 -------------------------------------------------------------------------------- /Hopfield/hopfield.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | void SHOW(int a[]) 6 | { 7 | for(int i=0;i<100;i++) 8 | { 9 | if(i%10==0) 10 | cout<0) 81 | Y[i]=1; 82 | else 83 | Y[i]=0; 84 | } 85 | 86 | SHOW(Y_NOISE); 87 | cout<<"\n\n\n Rebuilding... \n\n"; 88 | SHOW(Y); 89 | system("pause>n"); 90 | return 0; 91 | } 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /Hopfield/noise.txt: -------------------------------------------------------------------------------- 1 | A 2 | 3 | 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0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 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0 43 | 40% 44 | 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 45 | 50% -------------------------------------------------------------------------------- /Perceptron/perceptron - font.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 11, 6 | "id": "af67a8b4-1059-498a-b5c8-5437f1db9fc9", 7 | "metadata": {}, 8 | "outputs": [], 9 | "source": [ 10 | "import math\n", 11 | "import numpy as np" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 12, 17 | "id": "3d3a422e-55e2-47da-982c-a68cb594d967", 18 | "metadata": {}, 19 | "outputs": [], 20 | "source": [ 21 | "def equal(w1, w2):\n", 22 | " \n", 23 | " for i in range(63):\n", 24 | " for j in range(7):\n", 25 | " if w1[i][j] != w2[i][j]:\n", 26 | " return False;\n", 27 | " \n", 28 | " return True;" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": 13, 34 | "id": "b0105834-1de3-4c21-b05f-b0735d5dd7a4", 35 | "metadata": {}, 36 | "outputs": [], 37 | "source": [ 38 | "def copy(w1,w2):\n", 39 | " for i in range(63):\n", 40 | " for j in range(7):\n", 41 | " w1[i][j] = w2[i][j]" 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": 14, 47 | "id": "107ca0d6-8b94-4bb2-9f54-91ed07fc0e88", 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [ 51 | "target = [[1,-1,-1,-1,-1,-1,-1],\n", 52 | " [-1,1,-1,-1,-1,-1,-1],\n", 53 | " [-1,-1,1,-1,-1,-1,-1],\n", 54 | " [-1,-1,-1,1,-1,-1,-1],\n", 55 | " [-1,-1,-1,-1,1,-1,-1],\n", 56 | " [-1,-1,-1,-1,-1,1,-1],\n", 57 | " [-1,-1,-1,-1,-1,-1,1]]" 58 | ] 59 | }, 60 | { 61 | "cell_type": "code", 62 | "execution_count": 15, 63 | "id": "727d4199-ff91-461a-9eb2-064cb3d1aad2", 64 | "metadata": {}, 65 | "outputs": [], 66 | "source": [ 67 | "sample = [[-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,1,1,1,1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,1,1,1,-1,1,1,1],\n", 68 | " [1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,1,1,1,1,1,-1],\n", 69 | " [-1,-1,1,1,1,1,1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,-1],\n", 70 | " [1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,-1,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-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,1,-1,-1],\n", 77 | " [1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,1,1,1,-1,-1],\n", 78 | " [1,1,1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1],\n", 79 | " [-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,1,-1,-1],\n", 80 | " [1,-1,-1,-1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,1,-1]]\n" 81 | ] 82 | }, 83 | { 84 | "cell_type": "code", 85 | "execution_count": 16, 86 | "id": "78a9cf35-1f60-48b8-bdbf-86a9b5309575", 87 | "metadata": {}, 88 | "outputs": [], 89 | "source": [ 90 | "w1 = np.zeros([63, 7], dtype=int)\n", 91 | "w2 = np.ones([63, 7], dtype=int)\n", 92 | "yin = []\n", 93 | "y = []\n", 94 | "epoch = 0\n", 95 | "flag = True" 96 | ] 97 | }, 98 | { 99 | "cell_type": "code", 100 | "execution_count": 17, 101 | "id": "9bd7aac6-3857-40ad-bf94-41a9e352d399", 102 | "metadata": {}, 103 | "outputs": [ 104 | { 105 | "name": "stdout", 106 | "output_type": "stream", 107 | "text": [ 108 | "number: 1\n", 109 | "number: 2\n", 110 | "number: 3\n" 111 | ] 112 | } 113 | ], 114 | "source": [ 115 | "while flag:\n", 116 | " flag = False\n", 117 | " epoch += 1\n", 118 | " print('number: ',epoch)\n", 119 | "\n", 120 | " for i in range(14):\n", 121 | " yin = np.zeros([7], dtype=int)\n", 122 | " y = np.zeros([7], dtype=int)\n", 123 | "\n", 124 | " for j in range(7):\n", 125 | " for k in range(63):\n", 126 | " yin[j] += sample[i][k] * w1[k][j]\n", 127 | "\n", 128 | " if yin[j] > 0:\n", 129 | " y[j] = 1\n", 130 | " else:\n", 131 | " y[j] = -1\n", 132 | "\n", 133 | " if i < 7:\n", 134 | " if y[j] != target[i][j]:\n", 135 | " for h in range(63):\n", 136 | " w1[h][j] += sample[i][h] * target[i][j]\n", 137 | " else:\n", 138 | " if y[j] != target[i-7][j]:\n", 139 | " for h in range(63):\n", 140 | " w1[h][j] += sample[i][h] * target[i-7][j]\n", 141 | " \n", 142 | "\n", 143 | "\n", 144 | " if equal(w1, w2) == False:\n", 145 | " copy(w2,w1)\n", 146 | " flag = True" 147 | ] 148 | }, 149 | { 150 | "cell_type": "code", 151 | "execution_count": 21, 152 | "id": "bdbdb337-86cf-452c-8039-08fba7a0a29e", 153 | "metadata": { 154 | "tags": [] 155 | }, 156 | "outputs": [ 157 | { 158 | "name": "stdout", 159 | "output_type": "stream", 160 | "text": [ 161 | "-1 -1 1 -1 -1 -1 -1 \n", 162 | "\n", 163 | "this charactor is C \n", 164 | "\n" 165 | ] 166 | } 167 | ], 168 | "source": [ 169 | "test = [-1,-1,1,1,1,1,1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,-1]\n", 170 | "\n", 171 | "\n", 172 | "yin = np.zeros([7], dtype=int)\n", 173 | "y = np.zeros([7], dtype=int)\n", 174 | "\n", 175 | "for j in range(7):\n", 176 | " for k in range(63):\n", 177 | " yin[j] += test[k] * w1[k][j]\n", 178 | " if yin[j] > 0:\n", 179 | " y[j] = 1\n", 180 | " else:\n", 181 | " y[j] = -1\n", 182 | " \n", 183 | "for i in range(7):\n", 184 | " print(y[i],end=' ')\n", 185 | " \n", 186 | "for i in range(7):\n", 187 | " if y[i]==1:\n", 188 | " if i==0:\n", 189 | " print('\\n\\nthis charactor is A \\n')\n", 190 | " if i==1:\n", 191 | " print('\\n\\nthis charactor is B \\n')\n", 192 | " if i==2:\n", 193 | " print('\\n\\nthis charactor is C \\n')\n", 194 | " if i==3:\n", 195 | " print('\\n\\nthis charactor is D \\n')\n", 196 | " if i==4:\n", 197 | " print('\\n\\nthis charactor is E \\n')\n", 198 | " if i==5:\n", 199 | " print('\\n\\nthis charactor is J \\n')\n", 200 | " if i==6:\n", 201 | " print('\\n\\nthis charactor is K \\n')\n" 202 | ] 203 | }, 204 | { 205 | "cell_type": "code", 206 | "execution_count": null, 207 | "id": "96c5f04d-2159-4500-96a4-3659144b9c99", 208 | "metadata": {}, 209 | "outputs": [], 210 | "source": [] 211 | }, 212 | { 213 | "cell_type": "code", 214 | "execution_count": null, 215 | "id": "c64e6ca0-3ee9-44bb-ba93-b307358dfafb", 216 | "metadata": {}, 217 | "outputs": [], 218 | "source": [] 219 | } 220 | ], 221 | "metadata": { 222 | "kernelspec": { 223 | "display_name": "Python 3 (ipykernel)", 224 | "language": "python", 225 | "name": "python3" 226 | }, 227 | "language_info": { 228 | "codemirror_mode": { 229 | "name": "ipython", 230 | "version": 3 231 | }, 232 | "file_extension": ".py", 233 | "mimetype": "text/x-python", 234 | "name": "python", 235 | "nbconvert_exporter": "python", 236 | "pygments_lexer": "ipython3", 237 | "version": "3.9.6" 238 | } 239 | }, 240 | "nbformat": 4, 241 | "nbformat_minor": 5 242 | } 243 | -------------------------------------------------------------------------------- /Ackley/cross over/uniform/uniform_files/require.min.js.download: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS 2.1.10 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | var requirejs,require,define; 7 | (function(ca){function G(b){return"[object Function]"===N.call(b)}function H(b){return"[object Array]"===N.call(b)}function v(b,c){if(b){var d;for(d=0;dthis.depCount&&!this.defined){if(G(c)){if(this.events.error&&this.map.isDefine||h.onError!==da)try{f=i.execCb(b,c,e,f)}catch(d){a=d}else f=i.execCb(b,c,e,f);this.map.isDefine&&void 0===f&&((e=this.module)?f=e.exports:this.usingExports&& 19 | (f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=c;this.exports=f;if(this.map.isDefine&&!this.ignore&&(p[b]=f,h.onResourceLoad))h.onResourceLoad(i,this.map,this.depMaps);y(b);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a= 20 | this.map,b=a.id,d=m(a.prefix);this.depMaps.push(d);r(d,"defined",t(this,function(f){var d,g;g=j(ba,this.map.id);var J=this.map.name,u=this.map.parentMap?this.map.parentMap.name:null,p=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(J=f.normalize(J,function(a){return c(a,u,!0)})||""),f=m(a.prefix+"!"+J,this.map.parentMap),r(f,"defined",t(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),g=j(k,f.id)){this.depMaps.push(f); 21 | if(this.events.error)g.on("error",t(this,function(a){this.emit("error",a)}));g.enable()}}else g?(this.map.url=i.nameToUrl(g),this.load()):(d=t(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),d.error=t(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(k,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),d.fromText=t(this,function(f,c){var g=a.name,J=m(g),k=O;c&&(f=c);k&&(O=!1);q(J);s(l.config,b)&&(l.config[g]=l.config[b]);try{h.exec(f)}catch(j){return w(C("fromtexteval", 22 | "fromText eval for "+b+" failed: "+j,j,[b]))}k&&(O=!0);this.depMaps.push(J);i.completeLoad(g);p([g],d)}),f.load(a.name,p,d,l))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){W[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,t(this,function(a,b){var c,f;if("string"===typeof a){a=m(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=j(K,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;r(a,"defined",t(this,function(a){this.defineDep(b, 23 | a);this.check()}));this.errback&&r(a,"error",t(this,this.errback))}c=a.id;f=k[c];!s(K,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,t(this,function(a){var b=j(k,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:l,contextName:b,registry:k,defined:p,urlFetched:T,defQueue:A,Module:$,makeModuleMap:m, 24 | nextTick:h.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=l.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(l[b]||(l[b]={}),V(l[b],a,!0,!0)):l[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(ba[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),l.shim=b);a.packages&&v(a.packages,function(a){var b, 25 | a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(l.paths[b]=a.location);l.pkgs[b]=a.name+"/"+(a.main||"main").replace(ja,"").replace(R,"")});B(k,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=m(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ca,arguments));return b||a.exports&&ea(a.exports)}},makeRequire:function(a,e){function g(f,c,d){var j,l;e.enableBuildCallback&&(c&&G(c))&&(c.__requireJsBuild= 26 | !0);if("string"===typeof f){if(G(c))return w(C("requireargs","Invalid require call"),d);if(a&&s(K,f))return K[f](k[a.id]);if(h.get)return h.get(i,f,a,g);j=m(f,a,!1,!0);j=j.id;return!s(p,j)?w(C("notloaded",'Module name "'+j+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):p[j]}M();i.nextTick(function(){M();l=q(m(null,a));l.skipMap=e.skipMap;l.init(f,c,d,{enabled:!0});D()});return g}e=e||{};V(g,{isBrowser:z,toUrl:function(b){var e,d=b.lastIndexOf("."),g=b.split("/")[0];if(-1!== 27 | d&&(!("."===g||".."===g)||1g.attachEvent.toString().indexOf("[native code"))&&!Z?(O=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)): 34 | (g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=d,M=g,D?y.insertBefore(g,D):y.appendChild(g),M=null,g;if(fa)try{importScripts(d),b.completeLoad(c)}catch(j){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,j,[c]))}};z&&!r.skipDataMain&&U(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(L=b.getAttribute("data-main"))return q=L,r.baseUrl||(E=q.split("/"),q=E.pop(),Q=E.length?E.join("/")+"/":"./",r.baseUrl= 35 | Q),q=q.replace(R,""),h.jsExtRegExp.test(q)&&(q=L),r.deps=r.deps?r.deps.concat(q):[q],!0});define=function(b,c,d){var g,h;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(la,"").replace(ma,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(O){if(!(g=M))P&&"interactive"===P.readyState||U(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),g=P;g&&(b|| 36 | (b=g.getAttribute("data-requiremodule")),h=F[g.getAttribute("data-requirecontext")])}(h?h.defQueue:S).push([b,c,d])};define.amd={jQuery:!0};h.exec=function(b){return eval(b)};h(r)}})(this); 37 | -------------------------------------------------------------------------------- /8-Queen/cross over/one point/one point_files/require.min.js.download: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS 2.1.10 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | var requirejs,require,define; 7 | (function(ca){function G(b){return"[object Function]"===N.call(b)}function H(b){return"[object Array]"===N.call(b)}function v(b,c){if(b){var d;for(d=0;dthis.depCount&&!this.defined){if(G(c)){if(this.events.error&&this.map.isDefine||h.onError!==da)try{f=i.execCb(b,c,e,f)}catch(d){a=d}else f=i.execCb(b,c,e,f);this.map.isDefine&&void 0===f&&((e=this.module)?f=e.exports:this.usingExports&& 19 | (f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=c;this.exports=f;if(this.map.isDefine&&!this.ignore&&(p[b]=f,h.onResourceLoad))h.onResourceLoad(i,this.map,this.depMaps);y(b);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a= 20 | this.map,b=a.id,d=m(a.prefix);this.depMaps.push(d);r(d,"defined",t(this,function(f){var d,g;g=j(ba,this.map.id);var J=this.map.name,u=this.map.parentMap?this.map.parentMap.name:null,p=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(J=f.normalize(J,function(a){return c(a,u,!0)})||""),f=m(a.prefix+"!"+J,this.map.parentMap),r(f,"defined",t(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),g=j(k,f.id)){this.depMaps.push(f); 21 | if(this.events.error)g.on("error",t(this,function(a){this.emit("error",a)}));g.enable()}}else g?(this.map.url=i.nameToUrl(g),this.load()):(d=t(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),d.error=t(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(k,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),d.fromText=t(this,function(f,c){var g=a.name,J=m(g),k=O;c&&(f=c);k&&(O=!1);q(J);s(l.config,b)&&(l.config[g]=l.config[b]);try{h.exec(f)}catch(j){return w(C("fromtexteval", 22 | "fromText eval for "+b+" failed: "+j,j,[b]))}k&&(O=!0);this.depMaps.push(J);i.completeLoad(g);p([g],d)}),f.load(a.name,p,d,l))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){W[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,t(this,function(a,b){var c,f;if("string"===typeof a){a=m(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=j(K,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;r(a,"defined",t(this,function(a){this.defineDep(b, 23 | a);this.check()}));this.errback&&r(a,"error",t(this,this.errback))}c=a.id;f=k[c];!s(K,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,t(this,function(a){var b=j(k,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:l,contextName:b,registry:k,defined:p,urlFetched:T,defQueue:A,Module:$,makeModuleMap:m, 24 | nextTick:h.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=l.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(l[b]||(l[b]={}),V(l[b],a,!0,!0)):l[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(ba[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),l.shim=b);a.packages&&v(a.packages,function(a){var b, 25 | a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(l.paths[b]=a.location);l.pkgs[b]=a.name+"/"+(a.main||"main").replace(ja,"").replace(R,"")});B(k,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=m(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ca,arguments));return b||a.exports&&ea(a.exports)}},makeRequire:function(a,e){function g(f,c,d){var j,l;e.enableBuildCallback&&(c&&G(c))&&(c.__requireJsBuild= 26 | !0);if("string"===typeof f){if(G(c))return w(C("requireargs","Invalid require call"),d);if(a&&s(K,f))return K[f](k[a.id]);if(h.get)return h.get(i,f,a,g);j=m(f,a,!1,!0);j=j.id;return!s(p,j)?w(C("notloaded",'Module name "'+j+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):p[j]}M();i.nextTick(function(){M();l=q(m(null,a));l.skipMap=e.skipMap;l.init(f,c,d,{enabled:!0});D()});return g}e=e||{};V(g,{isBrowser:z,toUrl:function(b){var e,d=b.lastIndexOf("."),g=b.split("/")[0];if(-1!== 27 | d&&(!("."===g||".."===g)||1g.attachEvent.toString().indexOf("[native code"))&&!Z?(O=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)): 34 | (g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=d,M=g,D?y.insertBefore(g,D):y.appendChild(g),M=null,g;if(fa)try{importScripts(d),b.completeLoad(c)}catch(j){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,j,[c]))}};z&&!r.skipDataMain&&U(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(L=b.getAttribute("data-main"))return q=L,r.baseUrl||(E=q.split("/"),q=E.pop(),Q=E.length?E.join("/")+"/":"./",r.baseUrl= 35 | Q),q=q.replace(R,""),h.jsExtRegExp.test(q)&&(q=L),r.deps=r.deps?r.deps.concat(q):[q],!0});define=function(b,c,d){var g,h;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(la,"").replace(ma,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(O){if(!(g=M))P&&"interactive"===P.readyState||U(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),g=P;g&&(b|| 36 | (b=g.getAttribute("data-requiremodule")),h=F[g.getAttribute("data-requirecontext")])}(h?h.defQueue:S).push([b,c,d])};define.amd={jQuery:!0};h.exec=function(b){return eval(b)};h(r)}})(this); 37 | -------------------------------------------------------------------------------- /Ackley/cross over/one point/onepoint_files/require.min.js.download: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS 2.1.10 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | var requirejs,require,define; 7 | (function(ca){function G(b){return"[object Function]"===N.call(b)}function H(b){return"[object Array]"===N.call(b)}function v(b,c){if(b){var d;for(d=0;dthis.depCount&&!this.defined){if(G(c)){if(this.events.error&&this.map.isDefine||h.onError!==da)try{f=i.execCb(b,c,e,f)}catch(d){a=d}else f=i.execCb(b,c,e,f);this.map.isDefine&&void 0===f&&((e=this.module)?f=e.exports:this.usingExports&& 19 | (f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=c;this.exports=f;if(this.map.isDefine&&!this.ignore&&(p[b]=f,h.onResourceLoad))h.onResourceLoad(i,this.map,this.depMaps);y(b);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a= 20 | this.map,b=a.id,d=m(a.prefix);this.depMaps.push(d);r(d,"defined",t(this,function(f){var d,g;g=j(ba,this.map.id);var J=this.map.name,u=this.map.parentMap?this.map.parentMap.name:null,p=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(J=f.normalize(J,function(a){return c(a,u,!0)})||""),f=m(a.prefix+"!"+J,this.map.parentMap),r(f,"defined",t(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),g=j(k,f.id)){this.depMaps.push(f); 21 | if(this.events.error)g.on("error",t(this,function(a){this.emit("error",a)}));g.enable()}}else g?(this.map.url=i.nameToUrl(g),this.load()):(d=t(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),d.error=t(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(k,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),d.fromText=t(this,function(f,c){var g=a.name,J=m(g),k=O;c&&(f=c);k&&(O=!1);q(J);s(l.config,b)&&(l.config[g]=l.config[b]);try{h.exec(f)}catch(j){return w(C("fromtexteval", 22 | "fromText eval for "+b+" failed: "+j,j,[b]))}k&&(O=!0);this.depMaps.push(J);i.completeLoad(g);p([g],d)}),f.load(a.name,p,d,l))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){W[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,t(this,function(a,b){var c,f;if("string"===typeof a){a=m(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=j(K,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;r(a,"defined",t(this,function(a){this.defineDep(b, 23 | a);this.check()}));this.errback&&r(a,"error",t(this,this.errback))}c=a.id;f=k[c];!s(K,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,t(this,function(a){var b=j(k,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:l,contextName:b,registry:k,defined:p,urlFetched:T,defQueue:A,Module:$,makeModuleMap:m, 24 | nextTick:h.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=l.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(l[b]||(l[b]={}),V(l[b],a,!0,!0)):l[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(ba[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),l.shim=b);a.packages&&v(a.packages,function(a){var b, 25 | a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(l.paths[b]=a.location);l.pkgs[b]=a.name+"/"+(a.main||"main").replace(ja,"").replace(R,"")});B(k,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=m(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ca,arguments));return b||a.exports&&ea(a.exports)}},makeRequire:function(a,e){function g(f,c,d){var j,l;e.enableBuildCallback&&(c&&G(c))&&(c.__requireJsBuild= 26 | !0);if("string"===typeof f){if(G(c))return w(C("requireargs","Invalid require call"),d);if(a&&s(K,f))return K[f](k[a.id]);if(h.get)return h.get(i,f,a,g);j=m(f,a,!1,!0);j=j.id;return!s(p,j)?w(C("notloaded",'Module name "'+j+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):p[j]}M();i.nextTick(function(){M();l=q(m(null,a));l.skipMap=e.skipMap;l.init(f,c,d,{enabled:!0});D()});return g}e=e||{};V(g,{isBrowser:z,toUrl:function(b){var e,d=b.lastIndexOf("."),g=b.split("/")[0];if(-1!== 27 | d&&(!("."===g||".."===g)||1g.attachEvent.toString().indexOf("[native code"))&&!Z?(O=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)): 34 | (g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=d,M=g,D?y.insertBefore(g,D):y.appendChild(g),M=null,g;if(fa)try{importScripts(d),b.completeLoad(c)}catch(j){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,j,[c]))}};z&&!r.skipDataMain&&U(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(L=b.getAttribute("data-main"))return q=L,r.baseUrl||(E=q.split("/"),q=E.pop(),Q=E.length?E.join("/")+"/":"./",r.baseUrl= 35 | Q),q=q.replace(R,""),h.jsExtRegExp.test(q)&&(q=L),r.deps=r.deps?r.deps.concat(q):[q],!0});define=function(b,c,d){var g,h;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(la,"").replace(ma,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(O){if(!(g=M))P&&"interactive"===P.readyState||U(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),g=P;g&&(b|| 36 | (b=g.getAttribute("data-requiremodule")),h=F[g.getAttribute("data-requirecontext")])}(h?h.defQueue:S).push([b,c,d])};define.amd={jQuery:!0};h.exec=function(b){return eval(b)};h(r)}})(this); 37 | -------------------------------------------------------------------------------- /Ackley/first population/random/random_files/require.min.js.download: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS 2.1.10 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | var requirejs,require,define; 7 | (function(ca){function G(b){return"[object Function]"===N.call(b)}function H(b){return"[object Array]"===N.call(b)}function v(b,c){if(b){var d;for(d=0;dthis.depCount&&!this.defined){if(G(c)){if(this.events.error&&this.map.isDefine||h.onError!==da)try{f=i.execCb(b,c,e,f)}catch(d){a=d}else f=i.execCb(b,c,e,f);this.map.isDefine&&void 0===f&&((e=this.module)?f=e.exports:this.usingExports&& 19 | (f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=c;this.exports=f;if(this.map.isDefine&&!this.ignore&&(p[b]=f,h.onResourceLoad))h.onResourceLoad(i,this.map,this.depMaps);y(b);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a= 20 | this.map,b=a.id,d=m(a.prefix);this.depMaps.push(d);r(d,"defined",t(this,function(f){var d,g;g=j(ba,this.map.id);var J=this.map.name,u=this.map.parentMap?this.map.parentMap.name:null,p=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(J=f.normalize(J,function(a){return c(a,u,!0)})||""),f=m(a.prefix+"!"+J,this.map.parentMap),r(f,"defined",t(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),g=j(k,f.id)){this.depMaps.push(f); 21 | if(this.events.error)g.on("error",t(this,function(a){this.emit("error",a)}));g.enable()}}else g?(this.map.url=i.nameToUrl(g),this.load()):(d=t(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),d.error=t(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(k,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),d.fromText=t(this,function(f,c){var g=a.name,J=m(g),k=O;c&&(f=c);k&&(O=!1);q(J);s(l.config,b)&&(l.config[g]=l.config[b]);try{h.exec(f)}catch(j){return w(C("fromtexteval", 22 | "fromText eval for "+b+" failed: "+j,j,[b]))}k&&(O=!0);this.depMaps.push(J);i.completeLoad(g);p([g],d)}),f.load(a.name,p,d,l))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){W[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,t(this,function(a,b){var c,f;if("string"===typeof a){a=m(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=j(K,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;r(a,"defined",t(this,function(a){this.defineDep(b, 23 | a);this.check()}));this.errback&&r(a,"error",t(this,this.errback))}c=a.id;f=k[c];!s(K,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,t(this,function(a){var b=j(k,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:l,contextName:b,registry:k,defined:p,urlFetched:T,defQueue:A,Module:$,makeModuleMap:m, 24 | nextTick:h.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=l.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(l[b]||(l[b]={}),V(l[b],a,!0,!0)):l[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(ba[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),l.shim=b);a.packages&&v(a.packages,function(a){var b, 25 | a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(l.paths[b]=a.location);l.pkgs[b]=a.name+"/"+(a.main||"main").replace(ja,"").replace(R,"")});B(k,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=m(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ca,arguments));return b||a.exports&&ea(a.exports)}},makeRequire:function(a,e){function g(f,c,d){var j,l;e.enableBuildCallback&&(c&&G(c))&&(c.__requireJsBuild= 26 | !0);if("string"===typeof f){if(G(c))return w(C("requireargs","Invalid require call"),d);if(a&&s(K,f))return K[f](k[a.id]);if(h.get)return h.get(i,f,a,g);j=m(f,a,!1,!0);j=j.id;return!s(p,j)?w(C("notloaded",'Module name "'+j+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):p[j]}M();i.nextTick(function(){M();l=q(m(null,a));l.skipMap=e.skipMap;l.init(f,c,d,{enabled:!0});D()});return g}e=e||{};V(g,{isBrowser:z,toUrl:function(b){var e,d=b.lastIndexOf("."),g=b.split("/")[0];if(-1!== 27 | d&&(!("."===g||".."===g)||1g.attachEvent.toString().indexOf("[native code"))&&!Z?(O=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)): 34 | (g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=d,M=g,D?y.insertBefore(g,D):y.appendChild(g),M=null,g;if(fa)try{importScripts(d),b.completeLoad(c)}catch(j){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,j,[c]))}};z&&!r.skipDataMain&&U(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(L=b.getAttribute("data-main"))return q=L,r.baseUrl||(E=q.split("/"),q=E.pop(),Q=E.length?E.join("/")+"/":"./",r.baseUrl= 35 | Q),q=q.replace(R,""),h.jsExtRegExp.test(q)&&(q=L),r.deps=r.deps?r.deps.concat(q):[q],!0});define=function(b,c,d){var g,h;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(la,"").replace(ma,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(O){if(!(g=M))P&&"interactive"===P.readyState||U(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),g=P;g&&(b|| 36 | (b=g.getAttribute("data-requiremodule")),h=F[g.getAttribute("data-requirecontext")])}(h?h.defQueue:S).push([b,c,d])};define.amd={jQuery:!0};h.exec=function(b){return eval(b)};h(r)}})(this); 37 | -------------------------------------------------------------------------------- /8-Queen/select parents/Relative/Relative_files/require.min.js.download: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS 2.1.10 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | var requirejs,require,define; 7 | (function(ca){function G(b){return"[object Function]"===N.call(b)}function H(b){return"[object Array]"===N.call(b)}function v(b,c){if(b){var d;for(d=0;dthis.depCount&&!this.defined){if(G(c)){if(this.events.error&&this.map.isDefine||h.onError!==da)try{f=i.execCb(b,c,e,f)}catch(d){a=d}else f=i.execCb(b,c,e,f);this.map.isDefine&&void 0===f&&((e=this.module)?f=e.exports:this.usingExports&& 19 | (f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=c;this.exports=f;if(this.map.isDefine&&!this.ignore&&(p[b]=f,h.onResourceLoad))h.onResourceLoad(i,this.map,this.depMaps);y(b);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a= 20 | this.map,b=a.id,d=m(a.prefix);this.depMaps.push(d);r(d,"defined",t(this,function(f){var d,g;g=j(ba,this.map.id);var J=this.map.name,u=this.map.parentMap?this.map.parentMap.name:null,p=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(J=f.normalize(J,function(a){return c(a,u,!0)})||""),f=m(a.prefix+"!"+J,this.map.parentMap),r(f,"defined",t(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),g=j(k,f.id)){this.depMaps.push(f); 21 | if(this.events.error)g.on("error",t(this,function(a){this.emit("error",a)}));g.enable()}}else g?(this.map.url=i.nameToUrl(g),this.load()):(d=t(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),d.error=t(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(k,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),d.fromText=t(this,function(f,c){var g=a.name,J=m(g),k=O;c&&(f=c);k&&(O=!1);q(J);s(l.config,b)&&(l.config[g]=l.config[b]);try{h.exec(f)}catch(j){return w(C("fromtexteval", 22 | "fromText eval for "+b+" failed: "+j,j,[b]))}k&&(O=!0);this.depMaps.push(J);i.completeLoad(g);p([g],d)}),f.load(a.name,p,d,l))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){W[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,t(this,function(a,b){var c,f;if("string"===typeof a){a=m(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=j(K,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;r(a,"defined",t(this,function(a){this.defineDep(b, 23 | a);this.check()}));this.errback&&r(a,"error",t(this,this.errback))}c=a.id;f=k[c];!s(K,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,t(this,function(a){var b=j(k,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:l,contextName:b,registry:k,defined:p,urlFetched:T,defQueue:A,Module:$,makeModuleMap:m, 24 | nextTick:h.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=l.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(l[b]||(l[b]={}),V(l[b],a,!0,!0)):l[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(ba[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),l.shim=b);a.packages&&v(a.packages,function(a){var b, 25 | a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(l.paths[b]=a.location);l.pkgs[b]=a.name+"/"+(a.main||"main").replace(ja,"").replace(R,"")});B(k,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=m(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ca,arguments));return b||a.exports&&ea(a.exports)}},makeRequire:function(a,e){function g(f,c,d){var j,l;e.enableBuildCallback&&(c&&G(c))&&(c.__requireJsBuild= 26 | !0);if("string"===typeof f){if(G(c))return w(C("requireargs","Invalid require call"),d);if(a&&s(K,f))return K[f](k[a.id]);if(h.get)return h.get(i,f,a,g);j=m(f,a,!1,!0);j=j.id;return!s(p,j)?w(C("notloaded",'Module name "'+j+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):p[j]}M();i.nextTick(function(){M();l=q(m(null,a));l.skipMap=e.skipMap;l.init(f,c,d,{enabled:!0});D()});return g}e=e||{};V(g,{isBrowser:z,toUrl:function(b){var e,d=b.lastIndexOf("."),g=b.split("/")[0];if(-1!== 27 | d&&(!("."===g||".."===g)||1g.attachEvent.toString().indexOf("[native code"))&&!Z?(O=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)): 34 | (g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=d,M=g,D?y.insertBefore(g,D):y.appendChild(g),M=null,g;if(fa)try{importScripts(d),b.completeLoad(c)}catch(j){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,j,[c]))}};z&&!r.skipDataMain&&U(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(L=b.getAttribute("data-main"))return q=L,r.baseUrl||(E=q.split("/"),q=E.pop(),Q=E.length?E.join("/")+"/":"./",r.baseUrl= 35 | Q),q=q.replace(R,""),h.jsExtRegExp.test(q)&&(q=L),r.deps=r.deps?r.deps.concat(q):[q],!0});define=function(b,c,d){var g,h;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(la,"").replace(ma,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(O){if(!(g=M))P&&"interactive"===P.readyState||U(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),g=P;g&&(b|| 36 | (b=g.getAttribute("data-requiremodule")),h=F[g.getAttribute("data-requirecontext")])}(h?h.defQueue:S).push([b,c,d])};define.amd={jQuery:!0};h.exec=function(b){return eval(b)};h(r)}})(this); 37 | -------------------------------------------------------------------------------- /Ackley/first population/Heuristic/Heuristic_files/require.min.js.download: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS 2.1.10 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | var requirejs,require,define; 7 | (function(ca){function G(b){return"[object Function]"===N.call(b)}function H(b){return"[object Array]"===N.call(b)}function v(b,c){if(b){var d;for(d=0;dthis.depCount&&!this.defined){if(G(c)){if(this.events.error&&this.map.isDefine||h.onError!==da)try{f=i.execCb(b,c,e,f)}catch(d){a=d}else f=i.execCb(b,c,e,f);this.map.isDefine&&void 0===f&&((e=this.module)?f=e.exports:this.usingExports&& 19 | (f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=c;this.exports=f;if(this.map.isDefine&&!this.ignore&&(p[b]=f,h.onResourceLoad))h.onResourceLoad(i,this.map,this.depMaps);y(b);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a= 20 | this.map,b=a.id,d=m(a.prefix);this.depMaps.push(d);r(d,"defined",t(this,function(f){var d,g;g=j(ba,this.map.id);var J=this.map.name,u=this.map.parentMap?this.map.parentMap.name:null,p=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(J=f.normalize(J,function(a){return c(a,u,!0)})||""),f=m(a.prefix+"!"+J,this.map.parentMap),r(f,"defined",t(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),g=j(k,f.id)){this.depMaps.push(f); 21 | if(this.events.error)g.on("error",t(this,function(a){this.emit("error",a)}));g.enable()}}else g?(this.map.url=i.nameToUrl(g),this.load()):(d=t(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),d.error=t(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(k,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),d.fromText=t(this,function(f,c){var g=a.name,J=m(g),k=O;c&&(f=c);k&&(O=!1);q(J);s(l.config,b)&&(l.config[g]=l.config[b]);try{h.exec(f)}catch(j){return w(C("fromtexteval", 22 | "fromText eval for "+b+" failed: "+j,j,[b]))}k&&(O=!0);this.depMaps.push(J);i.completeLoad(g);p([g],d)}),f.load(a.name,p,d,l))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){W[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,t(this,function(a,b){var c,f;if("string"===typeof a){a=m(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=j(K,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;r(a,"defined",t(this,function(a){this.defineDep(b, 23 | a);this.check()}));this.errback&&r(a,"error",t(this,this.errback))}c=a.id;f=k[c];!s(K,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,t(this,function(a){var b=j(k,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:l,contextName:b,registry:k,defined:p,urlFetched:T,defQueue:A,Module:$,makeModuleMap:m, 24 | nextTick:h.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=l.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(l[b]||(l[b]={}),V(l[b],a,!0,!0)):l[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(ba[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),l.shim=b);a.packages&&v(a.packages,function(a){var b, 25 | a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(l.paths[b]=a.location);l.pkgs[b]=a.name+"/"+(a.main||"main").replace(ja,"").replace(R,"")});B(k,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=m(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ca,arguments));return b||a.exports&&ea(a.exports)}},makeRequire:function(a,e){function g(f,c,d){var j,l;e.enableBuildCallback&&(c&&G(c))&&(c.__requireJsBuild= 26 | !0);if("string"===typeof f){if(G(c))return w(C("requireargs","Invalid require call"),d);if(a&&s(K,f))return K[f](k[a.id]);if(h.get)return h.get(i,f,a,g);j=m(f,a,!1,!0);j=j.id;return!s(p,j)?w(C("notloaded",'Module name "'+j+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):p[j]}M();i.nextTick(function(){M();l=q(m(null,a));l.skipMap=e.skipMap;l.init(f,c,d,{enabled:!0});D()});return g}e=e||{};V(g,{isBrowser:z,toUrl:function(b){var e,d=b.lastIndexOf("."),g=b.split("/")[0];if(-1!== 27 | d&&(!("."===g||".."===g)||1g.attachEvent.toString().indexOf("[native code"))&&!Z?(O=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)): 34 | (g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=d,M=g,D?y.insertBefore(g,D):y.appendChild(g),M=null,g;if(fa)try{importScripts(d),b.completeLoad(c)}catch(j){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,j,[c]))}};z&&!r.skipDataMain&&U(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(L=b.getAttribute("data-main"))return q=L,r.baseUrl||(E=q.split("/"),q=E.pop(),Q=E.length?E.join("/")+"/":"./",r.baseUrl= 35 | Q),q=q.replace(R,""),h.jsExtRegExp.test(q)&&(q=L),r.deps=r.deps?r.deps.concat(q):[q],!0});define=function(b,c,d){var g,h;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(la,"").replace(ma,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(O){if(!(g=M))P&&"interactive"===P.readyState||U(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),g=P;g&&(b|| 36 | (b=g.getAttribute("data-requiremodule")),h=F[g.getAttribute("data-requirecontext")])}(h?h.defQueue:S).push([b,c,d])};define.amd={jQuery:!0};h.exec=function(b){return eval(b)};h(r)}})(this); 37 | -------------------------------------------------------------------------------- /Ackley/select parents/Relative/Relative_files/require.min.js.download: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS 2.1.10 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | var requirejs,require,define; 7 | (function(ca){function G(b){return"[object Function]"===N.call(b)}function H(b){return"[object Array]"===N.call(b)}function v(b,c){if(b){var d;for(d=0;dthis.depCount&&!this.defined){if(G(c)){if(this.events.error&&this.map.isDefine||h.onError!==da)try{f=i.execCb(b,c,e,f)}catch(d){a=d}else f=i.execCb(b,c,e,f);this.map.isDefine&&void 0===f&&((e=this.module)?f=e.exports:this.usingExports&& 19 | (f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=c;this.exports=f;if(this.map.isDefine&&!this.ignore&&(p[b]=f,h.onResourceLoad))h.onResourceLoad(i,this.map,this.depMaps);y(b);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a= 20 | this.map,b=a.id,d=m(a.prefix);this.depMaps.push(d);r(d,"defined",t(this,function(f){var d,g;g=j(ba,this.map.id);var J=this.map.name,u=this.map.parentMap?this.map.parentMap.name:null,p=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(J=f.normalize(J,function(a){return c(a,u,!0)})||""),f=m(a.prefix+"!"+J,this.map.parentMap),r(f,"defined",t(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),g=j(k,f.id)){this.depMaps.push(f); 21 | if(this.events.error)g.on("error",t(this,function(a){this.emit("error",a)}));g.enable()}}else g?(this.map.url=i.nameToUrl(g),this.load()):(d=t(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),d.error=t(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(k,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),d.fromText=t(this,function(f,c){var g=a.name,J=m(g),k=O;c&&(f=c);k&&(O=!1);q(J);s(l.config,b)&&(l.config[g]=l.config[b]);try{h.exec(f)}catch(j){return w(C("fromtexteval", 22 | "fromText eval for "+b+" failed: "+j,j,[b]))}k&&(O=!0);this.depMaps.push(J);i.completeLoad(g);p([g],d)}),f.load(a.name,p,d,l))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){W[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,t(this,function(a,b){var c,f;if("string"===typeof a){a=m(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=j(K,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;r(a,"defined",t(this,function(a){this.defineDep(b, 23 | a);this.check()}));this.errback&&r(a,"error",t(this,this.errback))}c=a.id;f=k[c];!s(K,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,t(this,function(a){var b=j(k,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:l,contextName:b,registry:k,defined:p,urlFetched:T,defQueue:A,Module:$,makeModuleMap:m, 24 | nextTick:h.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=l.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(l[b]||(l[b]={}),V(l[b],a,!0,!0)):l[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(ba[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),l.shim=b);a.packages&&v(a.packages,function(a){var b, 25 | a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(l.paths[b]=a.location);l.pkgs[b]=a.name+"/"+(a.main||"main").replace(ja,"").replace(R,"")});B(k,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=m(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ca,arguments));return b||a.exports&&ea(a.exports)}},makeRequire:function(a,e){function g(f,c,d){var j,l;e.enableBuildCallback&&(c&&G(c))&&(c.__requireJsBuild= 26 | !0);if("string"===typeof f){if(G(c))return w(C("requireargs","Invalid require call"),d);if(a&&s(K,f))return K[f](k[a.id]);if(h.get)return h.get(i,f,a,g);j=m(f,a,!1,!0);j=j.id;return!s(p,j)?w(C("notloaded",'Module name "'+j+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):p[j]}M();i.nextTick(function(){M();l=q(m(null,a));l.skipMap=e.skipMap;l.init(f,c,d,{enabled:!0});D()});return g}e=e||{};V(g,{isBrowser:z,toUrl:function(b){var e,d=b.lastIndexOf("."),g=b.split("/")[0];if(-1!== 27 | d&&(!("."===g||".."===g)||1g.attachEvent.toString().indexOf("[native code"))&&!Z?(O=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)): 34 | (g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=d,M=g,D?y.insertBefore(g,D):y.appendChild(g),M=null,g;if(fa)try{importScripts(d),b.completeLoad(c)}catch(j){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,j,[c]))}};z&&!r.skipDataMain&&U(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(L=b.getAttribute("data-main"))return q=L,r.baseUrl||(E=q.split("/"),q=E.pop(),Q=E.length?E.join("/")+"/":"./",r.baseUrl= 35 | Q),q=q.replace(R,""),h.jsExtRegExp.test(q)&&(q=L),r.deps=r.deps?r.deps.concat(q):[q],!0});define=function(b,c,d){var g,h;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(la,"").replace(ma,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(O){if(!(g=M))P&&"interactive"===P.readyState||U(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),g=P;g&&(b|| 36 | (b=g.getAttribute("data-requiremodule")),h=F[g.getAttribute("data-requirecontext")])}(h?h.defQueue:S).push([b,c,d])};define.amd={jQuery:!0};h.exec=function(b){return eval(b)};h(r)}})(this); 37 | -------------------------------------------------------------------------------- /Ackley/select parents/computation/computation_files/require.min.js.download: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS 2.1.10 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | var requirejs,require,define; 7 | (function(ca){function G(b){return"[object Function]"===N.call(b)}function H(b){return"[object Array]"===N.call(b)}function v(b,c){if(b){var d;for(d=0;dthis.depCount&&!this.defined){if(G(c)){if(this.events.error&&this.map.isDefine||h.onError!==da)try{f=i.execCb(b,c,e,f)}catch(d){a=d}else f=i.execCb(b,c,e,f);this.map.isDefine&&void 0===f&&((e=this.module)?f=e.exports:this.usingExports&& 19 | (f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=c;this.exports=f;if(this.map.isDefine&&!this.ignore&&(p[b]=f,h.onResourceLoad))h.onResourceLoad(i,this.map,this.depMaps);y(b);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a= 20 | this.map,b=a.id,d=m(a.prefix);this.depMaps.push(d);r(d,"defined",t(this,function(f){var d,g;g=j(ba,this.map.id);var J=this.map.name,u=this.map.parentMap?this.map.parentMap.name:null,p=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(J=f.normalize(J,function(a){return c(a,u,!0)})||""),f=m(a.prefix+"!"+J,this.map.parentMap),r(f,"defined",t(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),g=j(k,f.id)){this.depMaps.push(f); 21 | if(this.events.error)g.on("error",t(this,function(a){this.emit("error",a)}));g.enable()}}else g?(this.map.url=i.nameToUrl(g),this.load()):(d=t(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),d.error=t(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(k,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),d.fromText=t(this,function(f,c){var g=a.name,J=m(g),k=O;c&&(f=c);k&&(O=!1);q(J);s(l.config,b)&&(l.config[g]=l.config[b]);try{h.exec(f)}catch(j){return w(C("fromtexteval", 22 | "fromText eval for "+b+" failed: "+j,j,[b]))}k&&(O=!0);this.depMaps.push(J);i.completeLoad(g);p([g],d)}),f.load(a.name,p,d,l))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){W[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,t(this,function(a,b){var c,f;if("string"===typeof a){a=m(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=j(K,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;r(a,"defined",t(this,function(a){this.defineDep(b, 23 | a);this.check()}));this.errback&&r(a,"error",t(this,this.errback))}c=a.id;f=k[c];!s(K,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,t(this,function(a){var b=j(k,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:l,contextName:b,registry:k,defined:p,urlFetched:T,defQueue:A,Module:$,makeModuleMap:m, 24 | nextTick:h.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=l.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(l[b]||(l[b]={}),V(l[b],a,!0,!0)):l[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(ba[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),l.shim=b);a.packages&&v(a.packages,function(a){var b, 25 | a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(l.paths[b]=a.location);l.pkgs[b]=a.name+"/"+(a.main||"main").replace(ja,"").replace(R,"")});B(k,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=m(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ca,arguments));return b||a.exports&&ea(a.exports)}},makeRequire:function(a,e){function g(f,c,d){var j,l;e.enableBuildCallback&&(c&&G(c))&&(c.__requireJsBuild= 26 | !0);if("string"===typeof f){if(G(c))return w(C("requireargs","Invalid require call"),d);if(a&&s(K,f))return K[f](k[a.id]);if(h.get)return h.get(i,f,a,g);j=m(f,a,!1,!0);j=j.id;return!s(p,j)?w(C("notloaded",'Module name "'+j+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):p[j]}M();i.nextTick(function(){M();l=q(m(null,a));l.skipMap=e.skipMap;l.init(f,c,d,{enabled:!0});D()});return g}e=e||{};V(g,{isBrowser:z,toUrl:function(b){var e,d=b.lastIndexOf("."),g=b.split("/")[0];if(-1!== 27 | d&&(!("."===g||".."===g)||1g.attachEvent.toString().indexOf("[native code"))&&!Z?(O=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)): 34 | (g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=d,M=g,D?y.insertBefore(g,D):y.appendChild(g),M=null,g;if(fa)try{importScripts(d),b.completeLoad(c)}catch(j){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,j,[c]))}};z&&!r.skipDataMain&&U(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(L=b.getAttribute("data-main"))return q=L,r.baseUrl||(E=q.split("/"),q=E.pop(),Q=E.length?E.join("/")+"/":"./",r.baseUrl= 35 | Q),q=q.replace(R,""),h.jsExtRegExp.test(q)&&(q=L),r.deps=r.deps?r.deps.concat(q):[q],!0});define=function(b,c,d){var g,h;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(la,"").replace(ma,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(O){if(!(g=M))P&&"interactive"===P.readyState||U(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),g=P;g&&(b|| 36 | (b=g.getAttribute("data-requiremodule")),h=F[g.getAttribute("data-requirecontext")])}(h?h.defQueue:S).push([b,c,d])};define.amd={jQuery:!0};h.exec=function(b){return eval(b)};h(r)}})(this); 37 | -------------------------------------------------------------------------------- /Ackley/Akley.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 81, 6 | "id": "01d68de3-adb6-402a-932a-40f1f87c5a9c", 7 | "metadata": {}, 8 | "outputs": [], 9 | "source": [ 10 | "import random\n", 11 | "import numpy as np\n", 12 | "import math\n", 13 | "import matplotlib.pyplot as plt" 14 | ] 15 | }, 16 | { 17 | "cell_type": "code", 18 | "execution_count": 82, 19 | "id": "4951dfa4-8a79-4e59-bd09-4983598af488", 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [ 23 | "sx = 100" 24 | ] 25 | }, 26 | { 27 | "cell_type": "code", 28 | "execution_count": 83, 29 | "id": "0b687aa1-a409-4241-915c-265e656a0cb7", 30 | "metadata": {}, 31 | "outputs": [], 32 | "source": [ 33 | "class point:\n", 34 | " \n", 35 | " def __init__(self, x , y):\n", 36 | " self.x = x\n", 37 | " self.y = y\n", 38 | " self.h = fitness_value(x, y)\n", 39 | " self.xbin = to_binary(x)\n", 40 | " self.ybin = to_binary(y)\n", 41 | " self.x_dec_place = to_binary_NoneSigin(x)\n", 42 | " self.y_dec_place = to_binary_NoneSigin(y)\n", 43 | " \n", 44 | " " 45 | ] 46 | }, 47 | { 48 | "cell_type": "code", 49 | "execution_count": 84, 50 | "id": "57ac7f40-07f0-4640-a8a1-5d85edd466c6", 51 | "metadata": {}, 52 | "outputs": [], 53 | "source": [ 54 | "def print_population(populations):\n", 55 | " population = []\n", 56 | " population = populations\n", 57 | " for i in range(len(population)):\n", 58 | " print(i+1,\":\\n\")\n", 59 | " \n", 60 | " print(\"x: \",population[i].x)\n", 61 | " print(\"y: \",population[i].y)\n", 62 | " print(\"h: \",population[i].h,end='\\n\\n')\n", 63 | " \n", 64 | "# print(\"x_binary: \",population[i].xbin,\"\\n\")\n", 65 | "# print(\"y_binary: \",population[i].ybin,\"\\n\")\n", 66 | "# print(population[i].y_dec_place)\n", 67 | " " 68 | ] 69 | }, 70 | { 71 | "cell_type": "code", 72 | "execution_count": 85, 73 | "id": "49e33646-6f6d-467f-9328-f407d5d11dcd", 74 | "metadata": {}, 75 | "outputs": [], 76 | "source": [ 77 | "def fitness_value(x, y):\n", 78 | "\n", 79 | " value = -20.0 * np.exp(-0.2 * np.sqrt(0.5 * (x**2 + y**2))) - np.exp(0.5 * (np.cos(2 * np.pi * x) + np.cos(2 * np.pi * y))) + np.e + 20\n", 80 | " \n", 81 | " return value" 82 | ] 83 | }, 84 | { 85 | "cell_type": "code", 86 | "execution_count": 86, 87 | "id": "9a9248ed-b853-46e3-a931-b06bc73f11e9", 88 | "metadata": {}, 89 | "outputs": [], 90 | "source": [ 91 | "def to_binary(num):\n", 92 | " x = num\n", 93 | " if x < 0 :\n", 94 | " x = x * -1\n", 95 | " \n", 96 | " x_bin = \"{0:b}\".format(int(x))\n", 97 | " x_str = ['0','0','0','0','0']\n", 98 | " \n", 99 | " j = 0\n", 100 | " for i in range(len(x_str) - len(x_bin) , 5):\n", 101 | " x_str[i] = x_bin[j]\n", 102 | " j +=1\n", 103 | " \n", 104 | " if num >= 0 :\n", 105 | " x_str.insert(0,'0')\n", 106 | " else :\n", 107 | " x_str.insert(0,'1')\n", 108 | " \n", 109 | " return x_str" 110 | ] 111 | }, 112 | { 113 | "cell_type": "code", 114 | "execution_count": 87, 115 | "id": "d6605309-3d7a-46ba-ba89-934db59adf79", 116 | "metadata": {}, 117 | "outputs": [], 118 | "source": [ 119 | "\n", 120 | "def to_binary_NoneSigin(x): \n", 121 | " \n", 122 | " x = round(x,4)\n", 123 | " x2 = str(x) \n", 124 | "\n", 125 | " temp = ''\n", 126 | " for i in range(len(x2)):\n", 127 | " if x2[i] == '.':\n", 128 | " index = i\n", 129 | " break\n", 130 | "\n", 131 | " for i in range(index + 1 , len(x2)): \n", 132 | " temp = temp + x2[i]\n", 133 | " \n", 134 | " while len(temp) < 4:\n", 135 | " temp = '0' + str(temp)\n", 136 | " \n", 137 | " x_bin = \"{0:b}\".format(int(temp))\n", 138 | " \n", 139 | " x_str = ['0','0','0','0','0','0','0','0','0','0','0','0','0','0']\n", 140 | " \n", 141 | " j = 0\n", 142 | " for i in range(len(x_str) - len(x_bin) , 14):\n", 143 | " x_str[i] = x_bin[j]\n", 144 | " j +=1\n", 145 | " \n", 146 | " return x_str\n", 147 | " \n", 148 | " \n", 149 | " " 150 | ] 151 | }, 152 | { 153 | "cell_type": "code", 154 | "execution_count": 88, 155 | "id": "1c33b22e", 156 | "metadata": {}, 157 | "outputs": [], 158 | "source": [ 159 | "def to_decimal(xbin, x_dec_place) :\n", 160 | " \n", 161 | " x = to_decimal_z(xbin)\n", 162 | " x += to_decimal_place(x_dec_place)\n", 163 | "\n", 164 | " if xbin[0] == '1':\n", 165 | " x *= -1\n", 166 | " \n", 167 | " return x" 168 | ] 169 | }, 170 | { 171 | "cell_type": "code", 172 | "execution_count": 89, 173 | "id": "252a6673", 174 | "metadata": {}, 175 | "outputs": [], 176 | "source": [ 177 | "def to_decimal_z(xbin) :\n", 178 | " \n", 179 | " x=''\n", 180 | " for i in range(1,len(xbin)):\n", 181 | " x = x[:len(xbin)] + xbin[i] + x[len(xbin):]\n", 182 | " \n", 183 | " x = int(x, 2)\n", 184 | " \n", 185 | " return x" 186 | ] 187 | }, 188 | { 189 | "cell_type": "code", 190 | "execution_count": 90, 191 | "id": "3a1a322b", 192 | "metadata": {}, 193 | "outputs": [], 194 | "source": [ 195 | "def to_decimal_place(x_dec_place) :\n", 196 | "\n", 197 | " x=''\n", 198 | " for i in range(0,len(x_dec_place)):\n", 199 | " x = x[:len(x_dec_place)] + x_dec_place[i] + x[len(x_dec_place):]\n", 200 | " \n", 201 | " x = int(x, 2)\n", 202 | "\n", 203 | " return x * (10 ** -4)" 204 | ] 205 | }, 206 | { 207 | "cell_type": "code", 208 | "execution_count": 91, 209 | "id": "6958cf4d-cdee-41e8-a040-304cc9da45cd", 210 | "metadata": {}, 211 | "outputs": [], 212 | "source": [ 213 | "def first_population(size):\n", 214 | " popu = []\n", 215 | " for i in range(size):\n", 216 | " x = random.uniform(-30 , 30)\n", 217 | " y = random.uniform(-30 , 30)\n", 218 | " popu.append(point(x,y))\n", 219 | " \n", 220 | " return popu" 221 | ] 222 | }, 223 | { 224 | "cell_type": "code", 225 | "execution_count": 92, 226 | "id": "9dfd337d-275b-4556-aabf-56d84d10e27b", 227 | "metadata": {}, 228 | "outputs": [], 229 | "source": [ 230 | "def select_parents(population,size):\n", 231 | " \n", 232 | " All_Parent = []\n", 233 | " sort_population = []\n", 234 | " weights = []\n", 235 | " sort_population = sorted(population, key=lambda p: p.h, reverse=True)\n", 236 | " \n", 237 | " for i in range(len(sort_population)):\n", 238 | " weights.append(i+1)\n", 239 | " \n", 240 | " All_Parent = random.choices(sort_population, weights = weights , k = size)\n", 241 | " \n", 242 | " return All_Parent" 243 | ] 244 | }, 245 | { 246 | "cell_type": "code", 247 | "execution_count": 93, 248 | "id": "ba109579", 249 | "metadata": {}, 250 | "outputs": [], 251 | "source": [ 252 | "def select_parents_computation(population,size):\n", 253 | " \n", 254 | " All_Parent = []\n", 255 | " sort_population = []\n", 256 | " \n", 257 | " \n", 258 | " for i in range(0,size) :\n", 259 | " temp_population = population.copy()\n", 260 | " random_population = []\n", 261 | " for j in range(0,len(population)//5) :\n", 262 | " index = random.randint(0,len(population)-1-j)\n", 263 | " random_population.append(temp_population[index])\n", 264 | " temp_population.pop(index)\n", 265 | " \n", 266 | " sort_population = sorted(random_population, key=lambda p: p.h, reverse=False)\n", 267 | " All_Parent.append(sort_population[0])\n", 268 | " \n", 269 | " \n", 270 | " return All_Parent" 271 | ] 272 | }, 273 | { 274 | "cell_type": "code", 275 | "execution_count": 94, 276 | "id": "299bb210", 277 | "metadata": {}, 278 | "outputs": [], 279 | "source": [ 280 | "def cross_one_point_z(parent1, parent2) :\n", 281 | " index = random.choice([1,2,3,4,5])\n", 282 | " child = []\n", 283 | "\n", 284 | " for i in range(0,len(parent1)) :\n", 285 | " if i < index :\n", 286 | " child.append(parent1[i])\n", 287 | " else :\n", 288 | " child.append(parent2[i])\n", 289 | " \n", 290 | " return child" 291 | ] 292 | }, 293 | { 294 | "cell_type": "code", 295 | "execution_count": 95, 296 | "id": "edabdfde", 297 | "metadata": {}, 298 | "outputs": [], 299 | "source": [ 300 | "def cross_one_point_palce(parent1, parent2) : \n", 301 | " index = random.choice([0,1,2,3,4,5,6,7,8,9,10,11,12,13])\n", 302 | " child = []\n", 303 | "\n", 304 | " for i in range(0,len(parent1)) :\n", 305 | " if i < index :\n", 306 | " child.append(parent1[i])\n", 307 | " else :\n", 308 | " child.append(parent2[i])\n", 309 | "\n", 310 | " return child" 311 | ] 312 | }, 313 | { 314 | "cell_type": "code", 315 | "execution_count": 96, 316 | "id": "11ecd918", 317 | "metadata": {}, 318 | "outputs": [], 319 | "source": [ 320 | "def cross_uniform_z(parent1, parent2) :\n", 321 | " child = []\n", 322 | "\n", 323 | " for i in range(0,len(parent1)) :\n", 324 | " if random.choice(['1', '2']) == '1' :\n", 325 | " child.append(parent1[i])\n", 326 | " else :\n", 327 | " child.append(parent2[i])\n", 328 | " \n", 329 | " return child" 330 | ] 331 | }, 332 | { 333 | "cell_type": "code", 334 | "execution_count": 97, 335 | "id": "c4fa26e7", 336 | "metadata": {}, 337 | "outputs": [], 338 | "source": [ 339 | "def cross_uniform_palce(parent1, parent2) :\n", 340 | " child = []\n", 341 | "\n", 342 | " for i in range(0,len(parent1)) :\n", 343 | " if random.choice(['1', '2']) == '1' :\n", 344 | " child.append(parent1[i])\n", 345 | " else :\n", 346 | " child.append(parent2[i])\n", 347 | " \n", 348 | " return child" 349 | ] 350 | }, 351 | { 352 | "cell_type": "code", 353 | "execution_count": 98, 354 | "id": "0e0f3e6b", 355 | "metadata": {}, 356 | "outputs": [], 357 | "source": [ 358 | "def cross_over(parents) : \n", 359 | " childeren = []\n", 360 | " for i in range(0,len(parents)-1) :\n", 361 | "\n", 362 | "# xbin_child1 = cross_one_point_z(parents[i].xbin,parents[i+1].xbin)\n", 363 | " xbin_child1 = cross_uniform_z(parents[i].xbin,parents[i+1].xbin)\n", 364 | " xbin_child2 = xbin_child1[::-1]\n", 365 | "# ybin_child1 = cross_one_point_z(parents[i].ybin,parents[i+1].ybin)\n", 366 | " ybin_child1 = cross_uniform_z(parents[i].ybin,parents[i+1].ybin)\n", 367 | " ybin_child2 = ybin_child1[::-1]\n", 368 | " \n", 369 | "# x_dec_place_child1 = cross_one_point_palce(parents[i].x_dec_place,parents[i+1].x_dec_place)\n", 370 | " x_dec_place_child1 = cross_uniform_palce(parents[i].x_dec_place,parents[i+1].x_dec_place)\n", 371 | " x_dec_place_child2 = x_dec_place_child1[::-1]\n", 372 | "# y_dec_place_child1 = cross_one_point_palce(parents[i].y_dec_place,parents[i+1].y_dec_place)\n", 373 | " y_dec_place_child1 = cross_uniform_palce(parents[i].y_dec_place,parents[i+1].y_dec_place)\n", 374 | " y_dec_place_child2 = y_dec_place_child1[::-1]\n", 375 | " \n", 376 | " x_child1 = to_decimal(xbin_child1,x_dec_place_child1)\n", 377 | " y_child1 = to_decimal(ybin_child1,y_dec_place_child1)\n", 378 | " x_child2 = to_decimal(xbin_child2,x_dec_place_child2)\n", 379 | " y_child2 = to_decimal(ybin_child2,y_dec_place_child2)\n", 380 | " \n", 381 | " childeren.append(point(x_child1,y_child1))\n", 382 | " childeren.append(point(x_child2,y_child2))\n", 383 | " \n", 384 | " i += 1\n", 385 | " \n", 386 | " \n", 387 | " return childeren" 388 | ] 389 | }, 390 | { 391 | "cell_type": "code", 392 | "execution_count": 99, 393 | "id": "ea1bd2fd", 394 | "metadata": {}, 395 | "outputs": [], 396 | "source": [ 397 | "def mutate(childeren):\n", 398 | " mutatant = childeren\n", 399 | " \n", 400 | " for i in range(0,len(mutatant)) :\n", 401 | " index = random.randint(0,len(mutatant[i].xbin)-1)\n", 402 | " if random.choice(['0', '1']) == '1' :\n", 403 | " if random.random() < 0.2:\n", 404 | " mutatant[i].xbin[index] = random.choice(['0', '1'])\n", 405 | " else :\n", 406 | " if random.random() < 0.2:\n", 407 | " mutatant[i].ybin[index] = random.choice(['0', '1'])\n", 408 | " \n", 409 | " \n", 410 | " for i in range(0,len(mutatant)) :\n", 411 | " index = random.randint(0,len(mutatant[i].x_dec_place)-1)\n", 412 | " if random.choice(['0', '1']) == '1' :\n", 413 | " if random.random() < 0.2:\n", 414 | " mutatant[i].x_dec_place[index] = random.choice(['0', '1'])\n", 415 | " else :\n", 416 | " if random.random() < 0.2:\n", 417 | " mutatant[i].y_dec_place[index] = random.choice(['0', '1'])\n", 418 | " \n", 419 | " return mutatant" 420 | ] 421 | }, 422 | { 423 | "cell_type": "code", 424 | "execution_count": 100, 425 | "id": "aac9059d", 426 | "metadata": {}, 427 | "outputs": [], 428 | "source": [ 429 | "def replacement(population, parents, childeren) :\n", 430 | " population_copy = population.copy()\n", 431 | " parents_copy = parents.copy()\n", 432 | " childeren_copy = childeren.copy()\n", 433 | " \n", 434 | " newlistChild = []\n", 435 | " newlistParent = []\n", 436 | " newlistChild = sorted(childeren_copy, key=lambda ch: ch.h, reverse=False) #STEP 6\n", 437 | " newlistParent = sorted(parents_copy, key=lambda p: p.h, reverse=True)\n", 438 | "\n", 439 | " for i in range(0,int((len(parents_copy)*30/100)+0.5)) :\n", 440 | " newlistParent[i] = newlistChild[i]\n", 441 | " \n", 442 | " newpopulation = newlistParent\n", 443 | " sort_pop = sorted(population_copy, key=lambda p: p.h, reverse=True)\n", 444 | " \n", 445 | " for i in range(0,len(newpopulation)) :\n", 446 | " sort_pop[i] = newpopulation[i]\n", 447 | " \n", 448 | " return sort_pop" 449 | ] 450 | }, 451 | { 452 | "cell_type": "code", 453 | "execution_count": 101, 454 | "id": "15f28c42", 455 | "metadata": {}, 456 | "outputs": [], 457 | "source": [ 458 | "def GetBest(population) :\n", 459 | " pop = sorted(population, key=lambda ch: ch.h, reverse=False)\n", 460 | " print(\"x of best point in population: \",pop[0].x)\n", 461 | " print(\"y of best point in population: \",pop[0].y)\n", 462 | " print(\"fitness of best point in population: \",pop[0].h,end='\\n\\n')\n", 463 | " return pop[0].h" 464 | ] 465 | }, 466 | { 467 | "cell_type": "code", 468 | "execution_count": 105, 469 | "id": "7565d57c-e067-4ca4-a391-c9822d790104", 470 | "metadata": {}, 471 | "outputs": [], 472 | "source": [ 473 | "def main():\n", 474 | " draw_fitness = [] #for draw result\n", 475 | " cnt=0 # for count number of repeat best in generations\n", 476 | " Best=100 # maximum of ackley\n", 477 | " gen=0 # for count number of generations\n", 478 | " target=0 # minimum of ackley\n", 479 | " \n", 480 | " firstpopulation = first_population(sx) #STEP 1\n", 481 | " current_population = firstpopulation #STEP 2\n", 482 | " \n", 483 | " while True :\n", 484 | " if gen > 1000 :\n", 485 | " break\n", 486 | " \n", 487 | " if cnt == 800 :\n", 488 | " break\n", 489 | " \n", 490 | " parents = select_parents(current_population,sx//2) #STEP 3\n", 491 | "# parents = select_parents_computation(current_population,sx//2) #STEP 3\n", 492 | "# print_population(current_population)\n", 493 | "\n", 494 | " childeren = cross_over(parents) #STEP 4\n", 495 | "\n", 496 | " childeren = mutate(childeren) #STEP 5\n", 497 | " \n", 498 | " next_population = replacement(current_population, parents, childeren) #STEP 6 \n", 499 | "\n", 500 | " BestNew = GetBest(current_population) #STEP 7\n", 501 | " \n", 502 | " if Best == BestNew :\n", 503 | " cnt += 1\n", 504 | " elif Best > BestNew :\n", 505 | " cnt=0\n", 506 | " Best = BestNew\n", 507 | " else :\n", 508 | " cnt = 0\n", 509 | " \n", 510 | " print('gen :', gen)\n", 511 | " print(\"Best (in gen \",gen,\") :\",Best)\n", 512 | " print(\"********************\")\n", 513 | " draw_fitness.append(Best)\n", 514 | " if Best == target :\n", 515 | " break\n", 516 | " \n", 517 | " current_population = next_population\n", 518 | " gen += 1\n", 519 | " hist = draw_fitness\n", 520 | " plt.plot(hist)" 521 | ] 522 | }, 523 | { 524 | "cell_type": "code", 525 | "execution_count": 109, 526 | "id": "78d0b7d8-27da-4a5f-9725-a00cb27f4ecd", 527 | "metadata": { 528 | "scrolled": true 529 | }, 530 | "outputs": [ 531 | { 532 | "name": "stdout", 533 | "output_type": "stream", 534 | "text": [ 535 | "x of best point in population: 0.9863671282114836\n", 536 | "y of best point in population: -5.81294244388344\n", 537 | "fitness of best point in population: 12.03529647150577\n", 538 | "\n", 539 | "gen : 0\n", 540 | "Best (in gen 0 ) : 12.03529647150577\n", 541 | "********************\n", 542 | "x of best point in population: -3.3236\n", 543 | "y of best point in population: 1.8826\n", 544 | "fitness of best point in population: 9.907275585399821\n", 545 | "\n", 546 | "gen : 1\n", 547 | "Best (in gen 1 ) : 9.907275585399821\n", 548 | "********************\n", 549 | "x of best point in population: -0.8738\n", 550 | "y of best point in population: -2.335\n", 551 | "fitness of best point in population: 7.559730340118854\n", 552 | "\n", 553 | "gen : 2\n", 554 | "Best (in gen 2 ) : 7.559730340118854\n", 555 | "********************\n", 556 | "x of best point in population: 1.0656\n", 557 | "y of best point in population: -0.0993\n", 558 | "fitness of best point in population: 3.1549228312879407\n", 559 | "\n", 560 | "gen : 3\n", 561 | "Best (in gen 3 ) : 3.1549228312879407\n", 562 | "********************\n", 563 | "x of best point in population: 0.17200000000000001\n", 564 | "y of best point in population: -0.0993\n", 565 | "fitness of best point in population: 1.3735484359229382\n", 566 | "\n", 567 | "gen : 4\n", 568 | "Best (in gen 4 ) : 1.3735484359229382\n", 569 | "********************\n", 570 | "x of best point in population: -0.0176\n", 571 | "y of best point in population: -0.0037\n", 572 | "fitness of best point in population: 0.059459166617973125\n", 573 | "\n", 574 | "gen : 5\n", 575 | "Best (in gen 5 ) : 0.059459166617973125\n", 576 | "********************\n", 577 | "x of best point in population: -0.0176\n", 578 | "y of best point in population: -0.0037\n", 579 | "fitness of best point in population: 0.059459166617973125\n", 580 | "\n", 581 | "gen : 6\n", 582 | "Best (in gen 6 ) : 0.059459166617973125\n", 583 | "********************\n", 584 | "x of best point in population: -0.0176\n", 585 | "y of best point in population: -0.0037\n", 586 | "fitness of best point in population: 0.059459166617973125\n", 587 | "\n", 588 | "gen : 7\n", 589 | "Best (in gen 7 ) : 0.059459166617973125\n", 590 | "********************\n", 591 | "x of best point in population: -0.0054\n", 592 | "y of best point in population: -0.0008\n", 593 | "fitness of best point in population: 0.0162335414824355\n", 594 | "\n", 595 | "gen : 8\n", 596 | "Best (in gen 8 ) : 0.0162335414824355\n", 597 | "********************\n", 598 | "x of best point in population: -0.0008\n", 599 | "y of best point in population: -0.0009000000000000001\n", 600 | "fitness of best point in population: 0.003444488048362615\n", 601 | "\n", 602 | "gen : 9\n", 603 | "Best (in gen 9 ) : 0.003444488048362615\n", 604 | "********************\n", 605 | "x of best point in population: -0.0008\n", 606 | "y of best point in population: -0.0009000000000000001\n", 607 | "fitness of best point in population: 0.003444488048362615\n", 608 | "\n", 609 | "gen : 10\n", 610 | "Best (in gen 10 ) : 0.003444488048362615\n", 611 | "********************\n", 612 | "x of best point in population: -0.0008\n", 613 | "y of best point in population: -0.0009000000000000001\n", 614 | "fitness of best point in population: 0.003444488048362615\n", 615 | "\n", 616 | "gen : 11\n", 617 | "Best (in gen 11 ) : 0.003444488048362615\n", 618 | "********************\n", 619 | "x of best point in population: -0.0008\n", 620 | "y of best point in population: -0.0009000000000000001\n", 621 | "fitness of best point in population: 0.003444488048362615\n", 622 | "\n", 623 | "gen : 12\n", 624 | "Best (in gen 12 ) : 0.003444488048362615\n", 625 | "********************\n", 626 | "x of best point in population: -0.0001\n", 627 | "y of best point in population: -0.0001\n", 628 | "fitness of best point in population: 0.00040053256728356246\n", 629 | "\n", 630 | "gen : 13\n", 631 | "Best (in gen 13 ) : 0.00040053256728356246\n", 632 | "********************\n", 633 | "x of best point in population: -0.0\n", 634 | "y of best point in population: -0.0\n", 635 | "fitness of best point in population: 0.0\n", 636 | "\n", 637 | "gen : 14\n", 638 | "Best (in gen 14 ) : 0.0\n", 639 | "********************\n" 640 | ] 641 | }, 642 | { 643 | "data": { 644 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAapklEQVR4nO3de3xU9Z3/8ddnZkLCHYEk3OUqGUAQjFeqVoKKyk+0u27V6uq2+6OP/lq1tdVKtbZdr11dq621lqrV/lZpXbwrioi4LFVREJBLuImI3MNV5BIT8tk/MiC3kMvM5MyZvJ+PB4/MnDnJeT/mEd45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cKqZtUh8X5SQwX90TXgJuDrx+GrgxQCz1MrMRlE9BHiRu+8KOk9N3H2+uxe4e8/E/7fVwLDE93RSMr7AE3+k2Ld4cinwTAYvnjwcuIrqs9m5iX8XBB0qi1wLPGVmHwEnAHcFG6dmid8UJgIfAvOp/r+WMVO/zWwC8C7Q38xWm9l3gHuAc8xsGdW/QdwTZMYD1ZD3IaA1MCXxf+2RQEMm1JA1PcfK3N86RETkaDL+DFxERI5MBS4iElIqcBGRkFKBi4iElApcRCSkVOAiIiGlAhcRCan/BR6pFm3qdvVGAAAAAElFTkSuQmCC\n", 645 | "text/plain": [ 646 | "
" 647 | ] 648 | }, 649 | "metadata": { 650 | "needs_background": "light" 651 | }, 652 | "output_type": "display_data" 653 | } 654 | ], 655 | "source": [ 656 | "main()" 657 | ] 658 | }, 659 | { 660 | "cell_type": "code", 661 | "execution_count": null, 662 | "id": "62bd5daf", 663 | "metadata": {}, 664 | "outputs": [], 665 | "source": [] 666 | }, 667 | { 668 | "cell_type": "code", 669 | "execution_count": null, 670 | "id": "84a20dfa-b32d-4da2-b701-099a9a2eb597", 671 | "metadata": {}, 672 | "outputs": [], 673 | "source": [] 674 | } 675 | ], 676 | "metadata": { 677 | "kernelspec": { 678 | "display_name": "Python 3 (ipykernel)", 679 | "language": "python", 680 | "name": "python3" 681 | }, 682 | "language_info": { 683 | "codemirror_mode": { 684 | "name": "ipython", 685 | "version": 3 686 | }, 687 | "file_extension": ".py", 688 | "mimetype": "text/x-python", 689 | "name": "python", 690 | "nbconvert_exporter": "python", 691 | "pygments_lexer": "ipython3", 692 | "version": "3.9.6" 693 | } 694 | }, 695 | "nbformat": 4, 696 | "nbformat_minor": 5 697 | } 698 | -------------------------------------------------------------------------------- /Ackley/select parents/Relative/Relative.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 81, 6 | "id": "01d68de3-adb6-402a-932a-40f1f87c5a9c", 7 | "metadata": {}, 8 | "outputs": [], 9 | "source": [ 10 | "import random\n", 11 | "import numpy as np\n", 12 | "import math\n", 13 | "import matplotlib.pyplot as plt" 14 | ] 15 | }, 16 | { 17 | "cell_type": "code", 18 | "execution_count": 82, 19 | "id": "4951dfa4-8a79-4e59-bd09-4983598af488", 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [ 23 | "sx = 100" 24 | ] 25 | }, 26 | { 27 | "cell_type": "code", 28 | "execution_count": 83, 29 | "id": "0b687aa1-a409-4241-915c-265e656a0cb7", 30 | "metadata": {}, 31 | "outputs": [], 32 | "source": [ 33 | "class point:\n", 34 | " \n", 35 | " def __init__(self, x , y):\n", 36 | " self.x = x\n", 37 | " self.y = y\n", 38 | " self.h = fitness_value(x, y)\n", 39 | " self.xbin = to_binary(x)\n", 40 | " self.ybin = to_binary(y)\n", 41 | " self.x_dec_place = to_binary_NoneSigin(x)\n", 42 | " self.y_dec_place = to_binary_NoneSigin(y)\n", 43 | " \n", 44 | " " 45 | ] 46 | }, 47 | { 48 | "cell_type": "code", 49 | "execution_count": 84, 50 | "id": "57ac7f40-07f0-4640-a8a1-5d85edd466c6", 51 | "metadata": {}, 52 | "outputs": [], 53 | "source": [ 54 | "def print_population(populations):\n", 55 | " population = []\n", 56 | " population = populations\n", 57 | " for i in range(len(population)):\n", 58 | " print(i+1,\":\\n\")\n", 59 | " \n", 60 | " print(\"x: \",population[i].x)\n", 61 | " print(\"y: \",population[i].y)\n", 62 | " print(\"h: \",population[i].h,end='\\n\\n')\n", 63 | " \n", 64 | "# print(\"x_binary: \",population[i].xbin,\"\\n\")\n", 65 | "# print(\"y_binary: \",population[i].ybin,\"\\n\")\n", 66 | "# print(population[i].y_dec_place)\n", 67 | " " 68 | ] 69 | }, 70 | { 71 | "cell_type": "code", 72 | "execution_count": 85, 73 | "id": "49e33646-6f6d-467f-9328-f407d5d11dcd", 74 | "metadata": {}, 75 | "outputs": [], 76 | "source": [ 77 | "def fitness_value(x, y):\n", 78 | "\n", 79 | " value = -20.0 * np.exp(-0.2 * np.sqrt(0.5 * (x**2 + y**2))) - np.exp(0.5 * (np.cos(2 * np.pi * x) + np.cos(2 * np.pi * y))) + np.e + 20\n", 80 | " \n", 81 | " return value" 82 | ] 83 | }, 84 | { 85 | "cell_type": "code", 86 | "execution_count": 86, 87 | "id": "9a9248ed-b853-46e3-a931-b06bc73f11e9", 88 | "metadata": {}, 89 | "outputs": [], 90 | "source": [ 91 | "def to_binary(num):\n", 92 | " x = num\n", 93 | " if x < 0 :\n", 94 | " x = x * -1\n", 95 | " \n", 96 | " x_bin = \"{0:b}\".format(int(x))\n", 97 | " x_str = ['0','0','0','0','0']\n", 98 | " \n", 99 | " j = 0\n", 100 | " for i in range(len(x_str) - len(x_bin) , 5):\n", 101 | " x_str[i] = x_bin[j]\n", 102 | " j +=1\n", 103 | " \n", 104 | " if num >= 0 :\n", 105 | " x_str.insert(0,'0')\n", 106 | " else :\n", 107 | " x_str.insert(0,'1')\n", 108 | " \n", 109 | " return x_str" 110 | ] 111 | }, 112 | { 113 | "cell_type": "code", 114 | "execution_count": 87, 115 | "id": "d6605309-3d7a-46ba-ba89-934db59adf79", 116 | "metadata": {}, 117 | "outputs": [], 118 | "source": [ 119 | "\n", 120 | "def to_binary_NoneSigin(x): \n", 121 | " \n", 122 | " x = round(x,4)\n", 123 | " x2 = str(x) \n", 124 | "\n", 125 | " temp = ''\n", 126 | " for i in range(len(x2)):\n", 127 | " if x2[i] == '.':\n", 128 | " index = i\n", 129 | " break\n", 130 | "\n", 131 | " for i in range(index + 1 , len(x2)): \n", 132 | " temp = temp + x2[i]\n", 133 | " \n", 134 | " while len(temp) < 4:\n", 135 | " temp = '0' + str(temp)\n", 136 | " \n", 137 | " x_bin = \"{0:b}\".format(int(temp))\n", 138 | " \n", 139 | " x_str = ['0','0','0','0','0','0','0','0','0','0','0','0','0','0']\n", 140 | " \n", 141 | " j = 0\n", 142 | " for i in range(len(x_str) - len(x_bin) , 14):\n", 143 | " x_str[i] = x_bin[j]\n", 144 | " j +=1\n", 145 | " \n", 146 | " return x_str\n", 147 | " \n", 148 | " \n", 149 | " " 150 | ] 151 | }, 152 | { 153 | "cell_type": "code", 154 | "execution_count": 88, 155 | "id": "1c33b22e", 156 | "metadata": {}, 157 | "outputs": [], 158 | "source": [ 159 | "def to_decimal(xbin, x_dec_place) :\n", 160 | " \n", 161 | " x = to_decimal_z(xbin)\n", 162 | " x += to_decimal_place(x_dec_place)\n", 163 | "\n", 164 | " if xbin[0] == '1':\n", 165 | " x *= -1\n", 166 | " \n", 167 | " return x" 168 | ] 169 | }, 170 | { 171 | "cell_type": "code", 172 | "execution_count": 89, 173 | "id": "252a6673", 174 | "metadata": {}, 175 | "outputs": [], 176 | "source": [ 177 | "def to_decimal_z(xbin) :\n", 178 | " \n", 179 | " x=''\n", 180 | " for i in range(1,len(xbin)):\n", 181 | " x = x[:len(xbin)] + xbin[i] + x[len(xbin):]\n", 182 | " \n", 183 | " x = int(x, 2)\n", 184 | " \n", 185 | " return x" 186 | ] 187 | }, 188 | { 189 | "cell_type": "code", 190 | "execution_count": 90, 191 | "id": "3a1a322b", 192 | "metadata": {}, 193 | "outputs": [], 194 | "source": [ 195 | "def to_decimal_place(x_dec_place) :\n", 196 | "\n", 197 | " x=''\n", 198 | " for i in range(0,len(x_dec_place)):\n", 199 | " x = x[:len(x_dec_place)] + x_dec_place[i] + x[len(x_dec_place):]\n", 200 | " \n", 201 | " x = int(x, 2)\n", 202 | "\n", 203 | " return x * (10 ** -4)" 204 | ] 205 | }, 206 | { 207 | "cell_type": "code", 208 | "execution_count": 91, 209 | "id": "6958cf4d-cdee-41e8-a040-304cc9da45cd", 210 | "metadata": {}, 211 | "outputs": [], 212 | "source": [ 213 | "def first_population(size):\n", 214 | " popu = []\n", 215 | " for i in range(size):\n", 216 | " x = random.uniform(-30 , 30)\n", 217 | " y = random.uniform(-30 , 30)\n", 218 | " popu.append(point(x,y))\n", 219 | " \n", 220 | " return popu" 221 | ] 222 | }, 223 | { 224 | "cell_type": "code", 225 | "execution_count": 92, 226 | "id": "9dfd337d-275b-4556-aabf-56d84d10e27b", 227 | "metadata": {}, 228 | "outputs": [], 229 | "source": [ 230 | "def select_parents(population,size):\n", 231 | " \n", 232 | " All_Parent = []\n", 233 | " sort_population = []\n", 234 | " weights = []\n", 235 | " sort_population = sorted(population, key=lambda p: p.h, reverse=True)\n", 236 | " \n", 237 | " for i in range(len(sort_population)):\n", 238 | " weights.append(i+1)\n", 239 | " \n", 240 | " All_Parent = random.choices(sort_population, weights = weights , k = size)\n", 241 | " \n", 242 | " return All_Parent" 243 | ] 244 | }, 245 | { 246 | "cell_type": "code", 247 | "execution_count": 93, 248 | "id": "ba109579", 249 | "metadata": {}, 250 | "outputs": [], 251 | "source": [ 252 | "def select_parents_computation(population,size):\n", 253 | " \n", 254 | " All_Parent = []\n", 255 | " sort_population = []\n", 256 | " \n", 257 | " \n", 258 | " for i in range(0,size) :\n", 259 | " temp_population = population.copy()\n", 260 | " random_population = []\n", 261 | " for j in range(0,len(population)//5) :\n", 262 | " index = random.randint(0,len(population)-1-j)\n", 263 | " random_population.append(temp_population[index])\n", 264 | " temp_population.pop(index)\n", 265 | " \n", 266 | " sort_population = sorted(random_population, key=lambda p: p.h, reverse=False)\n", 267 | " All_Parent.append(sort_population[0])\n", 268 | " \n", 269 | " \n", 270 | " return All_Parent" 271 | ] 272 | }, 273 | { 274 | "cell_type": "code", 275 | "execution_count": 94, 276 | "id": "299bb210", 277 | "metadata": {}, 278 | "outputs": [], 279 | "source": [ 280 | "def cross_one_point_z(parent1, parent2) :\n", 281 | " index = random.choice([1,2,3,4,5])\n", 282 | " child = []\n", 283 | "\n", 284 | " for i in range(0,len(parent1)) :\n", 285 | " if i < index :\n", 286 | " child.append(parent1[i])\n", 287 | " else :\n", 288 | " child.append(parent2[i])\n", 289 | " \n", 290 | " return child" 291 | ] 292 | }, 293 | { 294 | "cell_type": "code", 295 | "execution_count": 95, 296 | "id": "edabdfde", 297 | "metadata": {}, 298 | "outputs": [], 299 | "source": [ 300 | "def cross_one_point_palce(parent1, parent2) : \n", 301 | " index = random.choice([0,1,2,3,4,5,6,7,8,9,10,11,12,13])\n", 302 | " child = []\n", 303 | "\n", 304 | " for i in range(0,len(parent1)) :\n", 305 | " if i < index :\n", 306 | " child.append(parent1[i])\n", 307 | " else :\n", 308 | " child.append(parent2[i])\n", 309 | "\n", 310 | " return child" 311 | ] 312 | }, 313 | { 314 | "cell_type": "code", 315 | "execution_count": 96, 316 | "id": "11ecd918", 317 | "metadata": {}, 318 | "outputs": [], 319 | "source": [ 320 | "def cross_uniform_z(parent1, parent2) :\n", 321 | " child = []\n", 322 | "\n", 323 | " for i in range(0,len(parent1)) :\n", 324 | " if random.choice(['1', '2']) == '1' :\n", 325 | " child.append(parent1[i])\n", 326 | " else :\n", 327 | " child.append(parent2[i])\n", 328 | " \n", 329 | " return child" 330 | ] 331 | }, 332 | { 333 | "cell_type": "code", 334 | "execution_count": 97, 335 | "id": "c4fa26e7", 336 | "metadata": {}, 337 | "outputs": [], 338 | "source": [ 339 | "def cross_uniform_palce(parent1, parent2) :\n", 340 | " child = []\n", 341 | "\n", 342 | " for i in range(0,len(parent1)) :\n", 343 | " if random.choice(['1', '2']) == '1' :\n", 344 | " child.append(parent1[i])\n", 345 | " else :\n", 346 | " child.append(parent2[i])\n", 347 | " \n", 348 | " return child" 349 | ] 350 | }, 351 | { 352 | "cell_type": "code", 353 | "execution_count": 98, 354 | "id": "0e0f3e6b", 355 | "metadata": {}, 356 | "outputs": [], 357 | "source": [ 358 | "def cross_over(parents) : \n", 359 | " childeren = []\n", 360 | " for i in range(0,len(parents)-1) :\n", 361 | "\n", 362 | "# xbin_child1 = cross_one_point_z(parents[i].xbin,parents[i+1].xbin)\n", 363 | " xbin_child1 = cross_uniform_z(parents[i].xbin,parents[i+1].xbin)\n", 364 | " xbin_child2 = xbin_child1[::-1]\n", 365 | "# ybin_child1 = cross_one_point_z(parents[i].ybin,parents[i+1].ybin)\n", 366 | " ybin_child1 = cross_uniform_z(parents[i].ybin,parents[i+1].ybin)\n", 367 | " ybin_child2 = ybin_child1[::-1]\n", 368 | " \n", 369 | "# x_dec_place_child1 = cross_one_point_palce(parents[i].x_dec_place,parents[i+1].x_dec_place)\n", 370 | " x_dec_place_child1 = cross_uniform_palce(parents[i].x_dec_place,parents[i+1].x_dec_place)\n", 371 | " x_dec_place_child2 = x_dec_place_child1[::-1]\n", 372 | "# y_dec_place_child1 = cross_one_point_palce(parents[i].y_dec_place,parents[i+1].y_dec_place)\n", 373 | " y_dec_place_child1 = cross_uniform_palce(parents[i].y_dec_place,parents[i+1].y_dec_place)\n", 374 | " y_dec_place_child2 = y_dec_place_child1[::-1]\n", 375 | " \n", 376 | " x_child1 = to_decimal(xbin_child1,x_dec_place_child1)\n", 377 | " y_child1 = to_decimal(ybin_child1,y_dec_place_child1)\n", 378 | " x_child2 = to_decimal(xbin_child2,x_dec_place_child2)\n", 379 | " y_child2 = to_decimal(ybin_child2,y_dec_place_child2)\n", 380 | " \n", 381 | " childeren.append(point(x_child1,y_child1))\n", 382 | " childeren.append(point(x_child2,y_child2))\n", 383 | " \n", 384 | " i += 1\n", 385 | " \n", 386 | " \n", 387 | " return childeren" 388 | ] 389 | }, 390 | { 391 | "cell_type": "code", 392 | "execution_count": 99, 393 | "id": "ea1bd2fd", 394 | "metadata": {}, 395 | "outputs": [], 396 | "source": [ 397 | "def mutate(childeren):\n", 398 | " mutatant = childeren\n", 399 | " \n", 400 | " for i in range(0,len(mutatant)) :\n", 401 | " index = random.randint(0,len(mutatant[i].xbin)-1)\n", 402 | " if random.choice(['0', '1']) == '1' :\n", 403 | " if random.random() < 0.2:\n", 404 | " mutatant[i].xbin[index] = random.choice(['0', '1'])\n", 405 | " else :\n", 406 | " if random.random() < 0.2:\n", 407 | " mutatant[i].ybin[index] = random.choice(['0', '1'])\n", 408 | " \n", 409 | " \n", 410 | " for i in range(0,len(mutatant)) :\n", 411 | " index = random.randint(0,len(mutatant[i].x_dec_place)-1)\n", 412 | " if random.choice(['0', '1']) == '1' :\n", 413 | " if random.random() < 0.2:\n", 414 | " mutatant[i].x_dec_place[index] = random.choice(['0', '1'])\n", 415 | " else :\n", 416 | " if random.random() < 0.2:\n", 417 | " mutatant[i].y_dec_place[index] = random.choice(['0', '1'])\n", 418 | " \n", 419 | " return mutatant" 420 | ] 421 | }, 422 | { 423 | "cell_type": "code", 424 | "execution_count": 100, 425 | "id": "aac9059d", 426 | "metadata": {}, 427 | "outputs": [], 428 | "source": [ 429 | "def replacement(population, parents, childeren) :\n", 430 | " population_copy = population.copy()\n", 431 | " parents_copy = parents.copy()\n", 432 | " childeren_copy = childeren.copy()\n", 433 | " \n", 434 | " newlistChild = []\n", 435 | " newlistParent = []\n", 436 | " newlistChild = sorted(childeren_copy, key=lambda ch: ch.h, reverse=False) #STEP 6\n", 437 | " newlistParent = sorted(parents_copy, key=lambda p: p.h, reverse=True)\n", 438 | "\n", 439 | " for i in range(0,int((len(parents_copy)*30/100)+0.5)) :\n", 440 | " newlistParent[i] = newlistChild[i]\n", 441 | " \n", 442 | " newpopulation = newlistParent\n", 443 | " sort_pop = sorted(population_copy, key=lambda p: p.h, reverse=True)\n", 444 | " \n", 445 | " for i in range(0,len(newpopulation)) :\n", 446 | " sort_pop[i] = newpopulation[i]\n", 447 | " \n", 448 | " return sort_pop" 449 | ] 450 | }, 451 | { 452 | "cell_type": "code", 453 | "execution_count": 101, 454 | "id": "15f28c42", 455 | "metadata": {}, 456 | "outputs": [], 457 | "source": [ 458 | "def GetBest(population) :\n", 459 | " pop = sorted(population, key=lambda ch: ch.h, reverse=False)\n", 460 | " print(\"x of best point in population: \",pop[0].x)\n", 461 | " print(\"y of best point in population: \",pop[0].y)\n", 462 | " print(\"fitness of best point in population: \",pop[0].h,end='\\n\\n')\n", 463 | " return pop[0].h" 464 | ] 465 | }, 466 | { 467 | "cell_type": "code", 468 | "execution_count": 105, 469 | "id": "7565d57c-e067-4ca4-a391-c9822d790104", 470 | "metadata": {}, 471 | "outputs": [], 472 | "source": [ 473 | "def main():\n", 474 | " draw_fitness = [] #for draw result\n", 475 | " cnt=0 # for count number of repeat best in generations\n", 476 | " Best=100 # maximum of ackley\n", 477 | " gen=0 # for count number of generations\n", 478 | " target=0 # minimum of ackley\n", 479 | " \n", 480 | " firstpopulation = first_population(sx) #STEP 1\n", 481 | " current_population = firstpopulation #STEP 2\n", 482 | " \n", 483 | " while True :\n", 484 | " if gen > 1000 :\n", 485 | " break\n", 486 | " \n", 487 | " if cnt == 800 :\n", 488 | " break\n", 489 | " \n", 490 | " parents = select_parents(current_population,sx//2) #STEP 3\n", 491 | "# parents = select_parents_computation(current_population,sx//2) #STEP 3\n", 492 | "# print_population(current_population)\n", 493 | "\n", 494 | " childeren = cross_over(parents) #STEP 4\n", 495 | "\n", 496 | " childeren = mutate(childeren) #STEP 5\n", 497 | " \n", 498 | " next_population = replacement(current_population, parents, childeren) #STEP 6 \n", 499 | "\n", 500 | " BestNew = GetBest(current_population) #STEP 7\n", 501 | " \n", 502 | " if Best == BestNew :\n", 503 | " cnt += 1\n", 504 | " elif Best > BestNew :\n", 505 | " cnt=0\n", 506 | " Best = BestNew\n", 507 | " else :\n", 508 | " cnt = 0\n", 509 | " \n", 510 | " print('gen :', gen)\n", 511 | " print(\"Best (in gen \",gen,\") :\",Best)\n", 512 | " print(\"********************\")\n", 513 | " draw_fitness.append(Best)\n", 514 | " if Best == target :\n", 515 | " break\n", 516 | " \n", 517 | " current_population = next_population\n", 518 | " gen += 1\n", 519 | " hist = draw_fitness\n", 520 | " plt.plot(hist)" 521 | ] 522 | }, 523 | { 524 | "cell_type": "code", 525 | "execution_count": 109, 526 | "id": "78d0b7d8-27da-4a5f-9725-a00cb27f4ecd", 527 | "metadata": { 528 | "scrolled": true 529 | }, 530 | "outputs": [ 531 | { 532 | "name": "stdout", 533 | "output_type": "stream", 534 | "text": [ 535 | "x of best point in population: 0.9863671282114836\n", 536 | "y of best point in population: -5.81294244388344\n", 537 | "fitness of best point in population: 12.03529647150577\n", 538 | "\n", 539 | "gen : 0\n", 540 | "Best (in gen 0 ) : 12.03529647150577\n", 541 | "********************\n", 542 | "x of best point in population: -3.3236\n", 543 | "y of best point in population: 1.8826\n", 544 | "fitness of best point in population: 9.907275585399821\n", 545 | "\n", 546 | "gen : 1\n", 547 | "Best (in gen 1 ) : 9.907275585399821\n", 548 | "********************\n", 549 | "x of best point in population: -0.8738\n", 550 | "y of best point in population: -2.335\n", 551 | "fitness of best point in population: 7.559730340118854\n", 552 | "\n", 553 | "gen : 2\n", 554 | "Best (in gen 2 ) : 7.559730340118854\n", 555 | "********************\n", 556 | "x of best point in population: 1.0656\n", 557 | "y of best point in population: -0.0993\n", 558 | "fitness of best point in population: 3.1549228312879407\n", 559 | "\n", 560 | "gen : 3\n", 561 | "Best (in gen 3 ) : 3.1549228312879407\n", 562 | "********************\n", 563 | "x of best point in population: 0.17200000000000001\n", 564 | "y of best point in population: -0.0993\n", 565 | "fitness of best point in population: 1.3735484359229382\n", 566 | "\n", 567 | "gen : 4\n", 568 | "Best (in gen 4 ) : 1.3735484359229382\n", 569 | "********************\n", 570 | "x of best point in population: -0.0176\n", 571 | "y of best point in population: -0.0037\n", 572 | "fitness of best point in population: 0.059459166617973125\n", 573 | "\n", 574 | "gen : 5\n", 575 | "Best (in gen 5 ) : 0.059459166617973125\n", 576 | "********************\n", 577 | "x of best point in population: -0.0176\n", 578 | "y of best point in population: -0.0037\n", 579 | "fitness of best point in population: 0.059459166617973125\n", 580 | "\n", 581 | "gen : 6\n", 582 | "Best (in gen 6 ) : 0.059459166617973125\n", 583 | "********************\n", 584 | "x of best point in population: -0.0176\n", 585 | "y of best point in population: -0.0037\n", 586 | "fitness of best point in population: 0.059459166617973125\n", 587 | "\n", 588 | "gen : 7\n", 589 | "Best (in gen 7 ) : 0.059459166617973125\n", 590 | "********************\n", 591 | "x of best point in population: -0.0054\n", 592 | "y of best point in population: -0.0008\n", 593 | "fitness of best point in population: 0.0162335414824355\n", 594 | "\n", 595 | "gen : 8\n", 596 | "Best (in gen 8 ) : 0.0162335414824355\n", 597 | "********************\n", 598 | "x of best point in population: -0.0008\n", 599 | "y of best point in population: -0.0009000000000000001\n", 600 | "fitness of best point in population: 0.003444488048362615\n", 601 | "\n", 602 | "gen : 9\n", 603 | "Best (in gen 9 ) : 0.003444488048362615\n", 604 | "********************\n", 605 | "x of best point in population: -0.0008\n", 606 | "y of best point in population: -0.0009000000000000001\n", 607 | "fitness of best point in population: 0.003444488048362615\n", 608 | "\n", 609 | "gen : 10\n", 610 | "Best (in gen 10 ) : 0.003444488048362615\n", 611 | "********************\n", 612 | "x of best point in population: -0.0008\n", 613 | "y of best point in population: -0.0009000000000000001\n", 614 | "fitness of best point in population: 0.003444488048362615\n", 615 | "\n", 616 | "gen : 11\n", 617 | "Best (in gen 11 ) : 0.003444488048362615\n", 618 | "********************\n", 619 | "x of best point in population: -0.0008\n", 620 | "y of best point in population: -0.0009000000000000001\n", 621 | "fitness of best point in population: 0.003444488048362615\n", 622 | "\n", 623 | "gen : 12\n", 624 | "Best (in gen 12 ) : 0.003444488048362615\n", 625 | "********************\n", 626 | "x of best point in population: -0.0001\n", 627 | "y of best point in population: -0.0001\n", 628 | "fitness of best point in population: 0.00040053256728356246\n", 629 | "\n", 630 | "gen : 13\n", 631 | "Best (in gen 13 ) : 0.00040053256728356246\n", 632 | "********************\n", 633 | "x of best point in population: -0.0\n", 634 | "y of best point in population: -0.0\n", 635 | "fitness of best point in population: 0.0\n", 636 | "\n", 637 | "gen : 14\n", 638 | "Best (in gen 14 ) : 0.0\n", 639 | "********************\n" 640 | ] 641 | }, 642 | { 643 | "data": { 644 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAapklEQ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ok8Im7l7l7BfAccHrAmWqzwcw6AyQ+bgw4T63M7BpgNPAtz9xJLX2o/kE+L/H/rRvwoZl1SvYLh6HAQ7N4spkZ1WO0pe5+f9B5jsbdx7l7N3fvSfV7+pa7Z+wZoruvBz4zs/6JTSXAogAj1WYVcKqZtUh8X5SQwX90TXgJuDrx+GrgxQCz1MrMRlE9BHiRu+8KOk9N3H2+uxe4e8/E/7fVwLDE93RSMr7AE3+k2Ld4cinwTAYvnjwcuIrqs9m5iX8XBB0qi1wLPGVmHwEnAHcFG6dmid8UJgIfAvOp/r+WMVO/zWwC8C7Q38xWm9l3gHuAc8xsGdW/QdwTZMYD1ZD3IaA1MCXxf+2RQEMm1JA1PcfK3N86RETkaDL+DFxERI5MBS4iElIqcBGRkFKBi4iElApcRCSkVOAiIiGlAhcRCan/BR6pFm3qdvVGAAAAAElFTkSuQmCC\n", 645 | "text/plain": [ 646 | "
" 647 | ] 648 | }, 649 | "metadata": { 650 | "needs_background": "light" 651 | }, 652 | "output_type": "display_data" 653 | } 654 | ], 655 | "source": [ 656 | "main()" 657 | ] 658 | }, 659 | { 660 | "cell_type": "code", 661 | "execution_count": null, 662 | "id": "62bd5daf", 663 | "metadata": {}, 664 | "outputs": [], 665 | "source": [] 666 | }, 667 | { 668 | "cell_type": "code", 669 | "execution_count": null, 670 | "id": "84a20dfa-b32d-4da2-b701-099a9a2eb597", 671 | "metadata": {}, 672 | "outputs": [], 673 | "source": [] 674 | } 675 | ], 676 | "metadata": { 677 | "kernelspec": { 678 | "display_name": "Python 3 (ipykernel)", 679 | "language": "python", 680 | "name": "python3" 681 | }, 682 | "language_info": { 683 | "codemirror_mode": { 684 | "name": "ipython", 685 | "version": 3 686 | }, 687 | "file_extension": ".py", 688 | "mimetype": "text/x-python", 689 | "name": "python", 690 | "nbconvert_exporter": "python", 691 | "pygments_lexer": "ipython3", 692 | "version": "3.9.6" 693 | } 694 | }, 695 | "nbformat": 4, 696 | "nbformat_minor": 5 697 | } 698 | --------------------------------------------------------------------------------