Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- startTmr→Q
- Disp "Initializing
- "Init stuff:
- 0→L
- 999→dim(⌊BESTM
- 999→dim(⌊BESTB
- 0→P
- "Generate points:
- 500→A
- A→dim(L₁
- A→dim(L₂
- randInt(00,50,A)→L₁
- randInt(50,100,A)→L₂
- FnOff
- 0→Xmin
- 50→Ymin
- 50→Xmax
- 110→Ymax
- AxesOff:GridOff
- Plot1(Scatter,L₁,L₂,▫,BLACK
- DispGraph
- "Generate 500 random lines:
- "mx+b form
- 500→dim(⌊M
- 500→dim(⌊B
- randInt((A/2),A)*rand(500→⌊M
- randInt(A,A)*rand(500→⌊B
- "Starting Machine:
- Lbl A
- Text(150,1,"Gen: ",P
- "Generate Fitness scores:
- 500→dim(⌊FIT
- prgmFITNESS
- "Kill the lower 250 (half)
- mean(⌊FIT→F
- For(θ,1,500
- If θ/2=int(θ/2
- Pxl-Change(2,θ/2
- If ⌊FIT(θ)<F:Then:0→⌊M(θ:0→⌊B(θ:End
- End
- "Repopulate and mutate
- "BIG MUTATION CHANCE:
- 0.2→N
- "BIG MUTATION SIZE:
- 5→S
- For(θ,1,500
- If θ/2=int(θ/2
- Pxl-Change(3,θ/2
- If ⌊B(θ)≠0:Then
- Repeat Ans
- randInt(1,500)→X
- ⌊B(X)≠0
- End
- If randInt(1,N)=1:Then
- If rand>0.5:Then:S→A:Else:S→A:End
- If rand>0.5:Then:Arand+⌊M(X)→⌊M(θ):Else:Arand+⌊B(X)→⌊B(θ):End
- Else
- If rand>0.5:Then:S/100→A:Else:S/100→A:End
- Arand+⌊M(X)→⌊M(θ
- Arand+⌊B(X)→⌊B(θ
- End
- End
- Text(20,1,"M: ",⌊M(θ
- Text(33,1,"B: ",⌊B(θ
- Text(46,1,"FITNESS: ",⌊FIT(θ
- End
- 0→H
- Repeat Ans
- H+1→H:⌊FIT(H)=max(⌊FIT
- End
- If ⌊FIT(H)>1000 and P≠0
- Then
- T→M
- U→B
- Else
- ⌊M(H→M
- ⌊B(H→B
- End
- Line(0,U,Xmax,XmaxT+U,0
- M→T
- B→U
- Line(0,B,Xmax,XmaxM+B
- P+1→P
- M→⌊BESTM(P
- B→⌊BESTB(P
- Text(70,1,"BEST M: ",M
- Text(83,1,"BEST B: ",B
- Disp checkTmr(Q
- Goto A
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement