Advertisement
Guest User

prgmLINEVOLV

a guest
Jan 25th, 2017
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. startTmr→Q
  2. Disp "Initializing
  3. "Init stuff:
  4. 0→L
  5. 999→dim(⌊BESTM
  6. 999→dim(⌊BESTB
  7. 0→P
  8. "Generate points:
  9. 500→A
  10. A→dim(L₁
  11. A→dim(L₂
  12. randInt(00,50,A)→L₁
  13. randInt(­50,100,A)→L₂
  14.  
  15. FnOff
  16. 0→Xmin
  17. ­50→Ymin
  18. 50→Xmax
  19. 110→Ymax
  20. AxesOff:GridOff
  21. Plot1(Scatter,L₁,L₂,▫,BLACK
  22. DispGraph
  23. "Generate 500 random lines:
  24. "mx+b form
  25. 500→dim(⌊M
  26. 500→dim(⌊B
  27. randInt(­(A/2),A)*rand(500→⌊M
  28. randInt(­A,A)*rand(500→⌊B
  29.  
  30.  
  31. "Starting Machine:
  32. Lbl A
  33. Text(150,1,"Gen: ",P
  34. "Generate Fitness scores:
  35. 500→dim(⌊FIT
  36. prgmFITNESS
  37. "Kill the lower 250 (half)
  38.  
  39. mean(⌊FIT→F
  40. For(θ,1,500
  41. If θ/2=int(θ/2
  42. Pxl-Change(2,θ/2
  43. If ⌊FIT(θ)<F:Then:0→⌊M(θ:0→⌊B(θ:End
  44. End
  45.  
  46.  
  47. "Repopulate and mutate
  48.  
  49. "BIG MUTATION CHANCE:
  50. 0.2→N
  51.  
  52. "BIG MUTATION SIZE:
  53. 5→S
  54.  
  55. For(θ,1,500
  56. If θ/2=int(θ/2
  57. Pxl-Change(3,θ/2
  58. If ⌊B(θ)≠0:Then
  59. Repeat Ans
  60. randInt(1,500)→X
  61. ⌊B(X)≠0
  62. End
  63. If randInt(1,N)=1:Then
  64. If rand>0.5:Then:­S→A:Else:S→A:End
  65. If rand>0.5:Then:Arand+⌊M(X)→⌊M(θ):Else:Arand+⌊B(X)→⌊B(θ):End
  66. Else
  67. If rand>0.5:Then:­S/100→A:Else:S/100→A:End
  68. Arand+⌊M(X)→⌊M(θ
  69. Arand+⌊B(X)→⌊B(θ
  70. End
  71. End
  72. Text(20,1,"M: ",⌊M(θ
  73. Text(33,1,"B: ",⌊B(θ
  74. Text(46,1,"FITNESS: ",⌊FIT(θ
  75. End
  76. 0→H
  77. Repeat Ans
  78. H+1→H:⌊FIT(H)=max(⌊FIT
  79. End
  80. If ⌊FIT(H)>1000 and P≠0
  81. Then
  82. T→M
  83. U→B
  84. Else
  85. ⌊M(H→M
  86. ⌊B(H→B
  87. End
  88. Line(0,U,Xmax,XmaxT+U,0
  89. M→T
  90. B→U
  91. Line(0,B,Xmax,XmaxM+B
  92.  
  93. P+1→P
  94.  
  95. M→⌊BESTM(P
  96. B→⌊BESTB(P
  97.  
  98. Text(70,1,"BEST M: ",M
  99. Text(83,1,"BEST B: ",B
  100. Disp checkTmr(Q
  101. Goto A
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement