Back to Recipes Homepage
recipe picture
Recipe: Rav3n_pl GABiSv2.1.4 OG NF BK Fair
4.75
Your rating: None Average: 4.8 (4 votes)

Profile

Name: Rav3n_pl GABiSv2.1.4 OG NF BK Fair
ID: 103467
Created on: Sun, 05/03/2020 - 20:37
Updated on: Mon, 05/04/2020 - 04:55
Description:

Fair/impartial - resets the position for each critter/pokemon giving each a fair starting point. Code imported from Save5, which showed improvement on Aflatoxin Prediction puzzle. OG/Orange Guard - player freezes orange sidechains they want to keep orange before running script. NF - no fuzing. BK - band keeper keeps player bands and uses them during recovery wiggles. Filters - disabled during shake and wiggle. Now has option to never mutate.



Best For


Comments

Joined: 10/10/2015
Groups: Team China
--updated to fix maxGen input for more precise script comparison

--[[
Bands! Bands in space!

w30 (NC): Default wiggle iterations upped to 30 for newchapter; wiggle with bands=2 iters
No more recursive wiggle, since this scores lower in newchapter.
Restructured dialogs to match "standard" EDRW logic.

GAB - Genetic Algorithm on Bands
by Rav3n_pl
based on CartoonVillan and Crashguard303 scripts
Lua V2

Orange Guard - Susume
Before script, player freezes orange sidechains that they want to be kept orange.
Regular foldit Mutate used on unfrozen sidechains; only allowed oranges tried on frozen ones.

NF - No Fuzing

BK - Band Keeper - Susume
Any bands placed prior to running script will be kept, disabled during script-banded wiggles
and enabled during recovery (wiggles without script bands).

Filters - disabled during wiggle and shake, enabled at all other times

Definitions:
band: random band to space from random segment
critter: set of bands
herd: set of critters

1.
- randomize needed bands
- randomly assignig them to criters

2.
- score each critter

3.
- keep critters scoring above score
- breed best critters
- breed bastards (best one + random one)
- forget about rest of critter
- randomize new critters to fill herd

]]--

-- options:
energy=false --set true to seek energy in exploration puzzles; false works on all puzzles
pullCI=0.9 --Clash Impotrance during pull
shakeCI=0.21 --CI when shake on qstab or mutate once
maxCI=1 --maximum CI used by script
fastQstab=true -- only 1s1w after pull if true
fuzeThresh = 1 -- run fuze if we are close to best score (negative=new best score)
qstabThresh=1 -- run qstab if score drops more than... wiggle only in other case
onlyMutable=true --if true use ONLY all mutable aas, no matter of always use
mutateOnce=true --if true use mutate(1) instead of shake in qstab
mutateAlways=false --if true use muatate(1) instead of all shakes
mutateNever=false --if true do not mutate (overrides other mutate options)

herd= --herd options
{
breedBest = 2, --5, --breed best 4 critters - all combinations => 6 kids form 4 critters, 3 form 3, 1 form 2, 9 form 5 ;]
keepBest = 3, --3, --save up to 3 best scoring critters, rest are forgotten
breedBastards = 2, --8, --number of best will have one random bastard

--less random agents to focus on evolution
newRandom = 1, --10, --adding new random ones each generation
maxGen= 1000, --100 --maximum generations
shuffle = true, --set true to run critters in random order
renew=4, --create totally fresh herd after that many gens w/o improvement
}
critter= --critter options
{
minBands=3, --minimum bands
maxBands=7, --maximum bands
keepScore = 0 , --survive to next gen only if score higher than
breedScore=-20, --will breed kids only if score higher. Basttards always breed
maxLoss=20 --30, --maximum loss by critter. set 0 to disable -- reduced to 20 for newchapter
}

bands= --bands options
{
minStr=0.3, --minimum band str
maxStr=1.1, --maximum band str
maxUp = 12.1, -- maximum band length
}

DoNotUse={--just comment lines below or add more areas to avoid
--{segCnt,segCnt}, --ligand cant be used
--{120,134},
--{1,10},
}
AlwaysUse={ --areas should be always used
--{segCnt,segCnt},--ligand need to be at one end
--{308,311}, --loopy
--{272,319}, --loopy
}
UseSegments= --use ONLY this segments
{
--2,3,4,5
}
-- bands by secondary structure
use=
{
Sheet=true, --set false to not band sheets
Helix=true, --set false to not band helices
Loop=true, --set false to not band loops
}
--end of options

segCnt=structure.GetCount()
keepBands=band.GetCount()
p=print

------------------------------------------------
-- ORANGE GUARD --Susume
------------------------------------------------

OG = {
Slot=77, --Quicksave slot used by this module
--define substitution lists
Protected={}, --Sparse table, keyed by residue number, returns true if that residue is protected.
AllowedList={}, --Sparse table, keyed by residue number, returns list of allowed AAs.
RulesList={ --[[Used only during Initialization - after that use ProtectedList instead.
Sparse table keyed by AA, containing sparse tables keyed by secondary structure,
containing integer-keyed list of all allowed AAs for that position.
Each AA is allowed to be changed back to its original value regardless of SS.
'a' and 'p' allowed only in loops.
'm' allowed only in loops and helices.
'f' allowed anywhere there was already f, w, or y.
'w' and 'y' allowed only where there was already w or y.
]]
a={E={'a','i','l','v'}, H={'a','i','l','m','v'}, L={'a','i','l','m','p','v'}},
c={E={'c','i','l','v'}, H={'c','i','l','m','v'}, L={'a','c','i','l','m','p','v'}},
d={E={'d','i','l','v'}, H={'d','i','l','m','v'}, L={'a','d','i','l','m','p','v'}},
e={E={'e','i','l','v'}, H={'e','i','l','m','v'}, L={'a','e','i','l','m','p','v'}},
f={E={'f','i','l','v'}, H={'f','i','l','m','v'}, L={'a','f','i','l','m','p','v'}},
g={E={'g','i','l','v'}, H={'g','i','l','m','v'}, L={'a','g','i','l','m','p','v'}},
h={E={'h','i','l','v'}, H={'h','i','l','m','v'}, L={'a','h','i','l','m','p','v'}},
i={E={'i','l','v'}, H={'i','l','m','v'}, L={'a','i','l','m','p','v'}},
k={E={'i','k','l','v'}, H={'i','k','l','m','v'}, L={'a','i','k','l','m','p','v'}},
l={E={'i','l','v'}, H={'i','l','m','v'}, L={'a','i','l','m','p','v'}},
m={E={'i','l','m','v'}, H={'i','l','m','v'}, L={'a','i','l','m','p','v'}},
n={E={'i','l','n','v'}, H={'i','l','m','n','v'}, L={'a','i','l','m','n','p','v'}},
p={E={'i','l','p','v'}, H={'i','l','m','p','v'}, L={'a','i','l','m','p','v'}},
q={E={'i','l','q','v'}, H={'i','l','m','q','v'}, L={'a','i','l','m','p','q','v'}},
r={E={'i','l','r','v'}, H={'i','l','m','r','v'}, L={'a','i','l','m','p','r','v'}},
s={E={'i','l','s','v'}, H={'i','l','m','s','v'}, L={'a','i','l','m','p','s','v'}},
t={E={'i','l','t','v'}, H={'i','l','m','t','v'}, L={'a','i','l','m','p','t','v'}},
v={E={'i','l','v'}, H={'i','l','m','v'}, L={'a','i','l','m','p','v'}},
w={E={'f','i','l','v','w','y'}, H={'f','i','l','m','v','w','y'}, L={'a','f','i','l','m','p','v','w','y'}},
y={E={'f','i','l','v','w','y'}, H={'f','i','l','m','v','w','y'}, L={'a','f','i','l','m','p','v','w','y'}},
}
}

function OG.Init()
--build lists of frozen sidechains and AAs allowed for each one
local OGCount = 0
for ii = 1, structure.GetCount() do
local BBFrozen, SCFrozen = freeze.IsFrozen(ii)
local AA = structure.GetAminoAcid(ii)
local SS = structure.GetSecondaryStructure(ii)
if (SCFrozen or (AA=='g' and BBFrozen)) then
OG.Protected[ii] = true
OG.AllowedList[ii] = OG.RulesList[AA][SS]
freeze.Unfreeze(ii, true, true) --frozen backbones are not preserved
OGCount = OGCount + 1
end
end
print("Orange Guard is protecting "..OGCount.." amino acids.")
end

function OG.Cleanup()
for segnum, value in pairs(OG.Protected) do --this is how you loop over a sparse table
local AA = structure.GetAminoAcid(segnum)
if AA=='g' then
freeze.Freeze(segnum, true, false)
else
freeze.Freeze(segnum, false, true)
end
end
end

function OG.MutateSelected(iters)
print(" OG.MutateSelected")
local ProtectList={}
for segnum, value in pairs(OG.Protected) do
if selection.IsSelected(segnum) then
ProtectList[segnum] = true
selection.Deselect(segnum)
end
end

structure.MutateSidechainsSelected(iters)

local FiltersOff = behavior.GetFiltersDisabled()
if FiltersOff then
behavior.SetFiltersDisabled(false)
end
local SavedScore = current.GetScore()
local NewScore = SavedScore
save.Quicksave(OG.Slot)
--print(" score after general mutate: "..SavedScore)

--individually try substitutions on protected ones and save if better
for segnum, value in pairs(ProtectList) do
--print(" trying segment "..segnum)
for jj, AA in pairs(OG.AllowedList[segnum]) do
if structure.CanMutate(segnum, AA) then
structure.SetAminoAcid(segnum, AA)
NewScore = current.GetScore()
if NewScore > SavedScore then
save.Quicksave(OG.Slot)
SavedScore = NewScore
--print(" changed to "..AA..", new score "..SavedScore)
end
end
end
save.Quickload(OG.Slot)
end

behavior.SetFiltersDisabled(FiltersOff)
for segnum, value in pairs(ProtectList) do
selection.Select(segnum)
end
--print(" exit OG.MutateSelected")
--if any changes, re-run mutate?? not at this point, because mutate is slow
end

------------------------------------------------
-- END ORANGE GUARD
------------------------------------------------

function CI(c)
if c>maxCI then c=maxCI end
behavior.SetClashImportance(c)
end

function round(x)--cut all afer 3-rd place
return x-x%0.001
end
function down(x)
return x-x%1
end

function Score()--return score, exploration too
if energy==true then
return current.GetEnergyScore()
else
return current.GetScore()
end
end

--local seed=recipe.GetRandomSeed() --NOT WORKING!!!
--calculate REALLY good seed
seed=os.time()/math.abs(Score())
seed=seed%0.001
seed=1/seed
while seed<10000000 do seed=seed*1000 end
seed=seed-seed%1
p("Seed is: "..seed)
math.randomseed(seed)
--REALLY good seed made by rav3n_pl :P

function Wiggle(how, iters, minppi)
behavior.SetFiltersDisabled(true)
if how==nil then how="wa" end
if iters==nil then iters=5 end --for newchapter
if minppi==nil then minppi=0.1 end

if iters>0 then
--iters=iters-1
sp=Score()
if how == "s" then
if mutateAlways==true and mutateNever==false then
OG.MutateSelected(1) --structure.MutateSidechainsSelected(1)
else structure.ShakeSidechainsSelected(1) end
elseif how == "wb" then structure.WiggleAll(2*iters, true,false)
elseif how == "ws" then structure.WiggleAll(2*iters, false,true)
elseif how == "wa" then structure.WiggleAll(2*iters, true,true)
end
ep = Score()
ig=ep-sp
--if how~="s" then
-- if ig > minppi then return Wiggle(how, iters, minppi) end --tail call
--end -- recursive wiggle removed as it is not good under newchapter
end
behavior.SetFiltersDisabled(false)
end

function SaveBest()
local newScore = Score()
local g=newScore-bestScore
if g>0 then
if g>0.01 then p("Gained another "..round(g).." pts, New Best Score = "..newScore)
end
bestScore=newScore
save.Quicksave(3)
end
end
function SaveRB()
if recentbest.GetScore()>bestScore or (recentbest.GetEnergyScore()>bestScore and energy==true)then
save.Quicksave(4)
recentbest.Restore()
SaveBest()
save.Quickload(4)
end
end

function Qstab()
selection.SelectAll()
CI(shakeCI)
if mutateOnce==true and mutateNever==false then
OG.MutateSelected(1) --structure.MutateSidechainsSelected(1)
else
Wiggle("s",1)
end
if fastQstab==false then
CI(0.4)
Wiggle("wa",1)
CI(1)
Wiggle("s",1)
end
CI(1)
Wiggle()
end

function FuzeEnd()
CI(1)
Wiggle("wa",1)
Wiggle("s",1)
Wiggle()
srb()
end
function Fuze1(ci1,ci2)
CI(ci1)
Wiggle("s",1)
CI(ci2)
Wiggle("wa",1)
end
function Fuze2(ci1,ci2)
CI(ci1)
Wiggle("wa",1)
CI(1)
Wiggle("wa",1)
CI(ci2)
Wiggle("wa",1)
end
function srb()
recentbest.Restore()
SaveBest()
end
function Fuze()
p("Fuzing...")
local scr=Score()
selection.SelectAll()
recentbest.Save()
Fuze1(0.3,0.6) FuzeEnd()
Fuze2(0.3,1) srb()
Fuze1(0.05,1) srb()
Fuze2(0.7,0.5) FuzeEnd()
Fuze1(0.07,1)
srb()
end

function random(n1,n2) --random function returns int or float depends on input vars
if n1==nil then return math.random()
else
if n2==nil then
if n1%1==0 then
return math.random(n1) --integer
else
return math.random()*n1 --float
end
else
if n1%1==0 and n2%1==0 then
return math.random(n1,n2) --integer between
else
return math.random()*(n2-n1)+n1 --float between
end
end
end
end

function FillHerd() --fill up herd
local n=#critters
if n>0 then --fill up
n=herd.newRandom
else --fresh herd
n=herd.breedBest + herd.keepBest + herd.breedBastards
end
p("Randomizing "..n.." new critters...")
for i=1,n do
AddCritter()
end
end
function AddCritter() --vreate new random critter
local c={}
critterID=critterID+1
c.no=critterID
c.name=c.no..'-rnd'
c.bands={}
local r=random(critter.minBands, critter.maxBands)
for i=1,r do
c.bands[#c.bands+1]=AddBand()
end
critters[#critters+1]=c
p(c.name.." bands: "..#c.bands)
end
function AddBand() --create one random band
local cnt=0
local b={}
while true do --try till die
cnt=cnt+1
local s1=random(segCnt)
if onlyMutable==true or #UseSegments>0 then
s1=UseSegments[random(#UseSegments)]
end
if #UseSegments>0 or CanBeUsed(s1) then
local str=random(bands.minStr,bands.maxStr)
local len=random(bands.maxUp)
local theta = math.acos(math.random())
local phi = 2 * math.pi * math.random()
local segmentXAxis=0
local segmentYAxis=0
while true do --all 3 must be different
segmentXAxis = random(segCnt)
segmentYAxis = random(segCnt)
if segmentXAxis~=s1 and segmentYAxis~=s1 and segmentXAxis~=segmentYAxis then break end
end
--{segmentOrigin, segmentXAxis, segmentYAxis, rho, theta, phi}
b={s1, segmentXAxis, segmentYAxis, len, theta, phi, str}
break
end

if cnt>100 then
p("Sorry! Cant create band! Breaking script!")
BreakScript() --there is no such function, so it crashes script
end
end
return b
end

function CanBeUsed(sg1) --checking end of bands
function ssCheck(ss)
local good=false
if use.Sheet and ss=="E" then good=true end
if use.Helix and ss=="H" then good=true end
if use.Loop and ss=="L" then good=true end
return good
end
local ok=true
if #DoNotUse>0 then --none of 2 can be in that area
for i=1, #DoNotUse do
local r=DoNotUse[i]
for x=r[1],r[2] do
if x==sg1 then
ok=false
break
end
end
if ok==false then break end
end
end
if ok==false then
return false --if false can`t be used
else
ok=false
if #AlwaysUse>0 then --at least one have to be there
for i=1, #AlwaysUse do
local r=AlwaysUse[i]
for x=r[1],r[2] do
if x==sg1 then
ok=true
break
end
end
if ok==true then break end
end
else
ok=true
end
end

if ok==true then --check structure
ok=false
if ssCheck(structure.GetSecondaryStructure(sg1)) then ok=true end
end
return ok
end

function printArray(array)
for i=1,#array do
p(array[i])
end
end

function printArrayOneLine(array)
local arrayString=""
for i=1,#array do
arrayString=arrayString..array[i]..", "
end
print(arrayString.."end")
end

function ScoreHerd() --score all critters from herd
save.Quickload(3)
p("Scoring "..#critters.." critters...")
save.Quicksave(5)
local herdScore=Score()
for i=1,#critters do
save.Quickload(3) --jon's impartiality
save.Quicksave(5) -- not really sure about this line but whatev
-- impartiality to avoid unfair presolved advantage of the next critter
-- or possibly negating previous critter's shoddy work
-- to avoid the first critter intentionally ruining the 2nd's situation
--puzzle.StartOver() --forfeit

--band.DeleteAll()
for db=band.GetCount(), keepBands+1, -1 do --delete only non-keeper bands
band.Delete(db)
end
band.DisableAll() --disable keeper bands
local crt=critters[i] --critter
local s=Score() --start score
local bnds=crt.bands
for b=1,#bnds do
local bnd=bnds[b]

print("gen"..gen..", critter "..i..", band "..b..": ")
printArrayOneLine(bnd)
-- print band's Segment #, Stride size #, Index #, xyz, strength

local atom=5
local sn=bnd[1]
if sn==segCnt then atom=6 end --bug in last segment
if structure.GetAminoAcid(sn)=='g' then atom=0 end --glycyne
local bc=band.Add(sn,bnd[2],bnd[3],bnd[4],bnd[5],bnd[6],atom)
--local bc=band.GetCount()
if bc>keepBands then band.SetStrength(bc,bnd[7]) end
end
selection.SelectAll()
CI(pullCI)
recentbest.Save()
Wiggle("wb",1) -- this is the only wiggle with non-keeper bands
--band.DeleteAll()
for db=band.GetCount(), keepBands+1, -1 do
band.Delete(db)
end
band.EnableAll() -- enable keeper bands
CI(1)
if s-Score() > qstabThresh then
Qstab()
else
Wiggle()
end
--if Score()-bestScore>fuzeThresh then
-- SaveRB()
-- Fuze()
--else
SaveRB()
--end

local FiltersOff = behavior.GetFiltersDisabled()
behavior.SetFiltersDisabled(true)
local UnfilteredScore = Score()
behavior.SetFiltersDisabled(false)
local FilteredScore = Score()
local FilterBonus = FilteredScore - UnfilteredScore
crt.score=FilteredScore-s
p("Critter "..crt.name.." : "..round(crt.score)..", filter "..FilterBonus)
behavior.SetFiltersDisabled(FiltersOff)

if critter.maxLoss>0 then
if Score()>herdScore-critter.maxLoss then
save.Quicksave(5)
herdScore=Score()
else
save.Quickload(5)
end
else
save.Quickload(3)
end
end
save.Quickload(3)
if band.GetCount()>keepBands then --clean bands from best solition (if any)
--band.DeleteAll()
for db=band.GetCount(), keepBands+1, -1 do
band.Delete(db)
end
save.Quicksave(3)
end
end
function BreedCritters(mom,dad,t) --breed 2 critters. bands are taken randomly
local kid={}
critterID=critterID+1
kid.no=critterID
kid.name=kid.no.."-"..t..mom.no..'/'..dad.no
kid.bands={}
local mb=#mom.bands
local db=#dad.bands
if mb>db then mb,db=db,mb end --kid have bands count between mom and dad bands
local bn=random(mb,db)
for i=1,bn,2 do
kid.bands[#kid.bands+1]=mom.bands[random(#mom.bands)]
kid.bands[#kid.bands+1]=dad.bands[random(#dad.bands)]
end
p(kid.name.." bands: "..#kid.bands)
return kid
end
function KeepGood() --copy best scoring critters form last gen if score above
local newHerd={}
for i=1,herd.keepBest do
if critters[i].score>critter.keepScore then
newHerd[#newHerd+1]=critters[i]
end
end
return newHerd
end
function SortCritters() --bubble sort
for i=1,#critters do
for j=i+1,#critters do
if critters[i].score critters[i],critters[j]=critters[j],critters[i] --love lua :)
end
end
end
end
function BreedHerd()
p("Breeding...")
SortCritters()
newHerd=KeepGood()
for i=1, herd.breedBest do
local mom=critters[i]
if mom.score>critter.breedScore or i<2 then --breed only good ones, 1st is always breed anyway
for j=i+1, herd.breedBest do
local dad=critters[j]
newHerd[#newHerd+1]=BreedCritters(mom,dad,"kid-")
newHerd[#newHerd+1]=BreedCritters(dad,mom,"kid-")
end
end
end
for i=1, herd.breedBastards do --they will always appear ;]
local mom=critters[i]
local j=random(herd.breedBastards+1,#critters)
local dad=critters[j]
newHerd[#newHerd+1]=BreedCritters(mom,dad,"bas-")
newHerd[#newHerd+1]=BreedCritters(dad,mom,"bas-")
end
critters=newHerd
FillHerd()
end
function ShuffleHerd()
if herd.shuffle==true then
for i=1,#critters do
local r=random(#critters)
if r~=i then
critters[i],critters[r]=critters[r],critters[i]
end
end
end
end
function GAB()
if onlyMutable==true then
for i=1,segCnt do
if structure.IsMutable(i) then
UseSegments[#UseSegments+1]=i
end
end
end
bestScore=Score()
critterID=0
gen=0
ss=Score()
save.Quicksave(3)
recentbest.Save()
p("Rav3n_pl Bands! Bands in space! GAB BiS")
p("Start score: "..round(ss))
p("herd.maxGen "..herd.maxGen)
critters={}
FillHerd()
badGen=0
while true do --this is (almost) endless script ;]
genScore=Score()
gen=gen+1
p()
p("Generation: "..gen..", score: "..round(Score())..", gain: "..round(Score()-ss))
ShuffleHerd()
ScoreHerd()
save.Quickload(3)
if gen>=herd.maxGen then --jon changed == to >= in case of 0 gens
--herd.maxGen not being updated by user

print("gen limit")
break --end of script
else
print("herd.maxGen " ..herd.maxGen)
end

if genScore>=Score() then badGen=badGen+1 else badGen=0 end
if badGen>=herd.renew then
p("Creating fresh random herd...")
critters={}
FillHerd()
badGen=0
else
BreedHerd()
end
end
p("Final score: "..round(Score()).." Total gain: "..round(Score()-ss))
end

function dialogOptions()
local mut=false
for i=1,segCnt do
if structure.IsMutable(i) then mut=true break end
end
if not mut then
onlyMutable=false
mutateOnce=false
end
local opt = dialog.CreateDialog("GAB BiS")
repeat
opt.lbl1 = dialog.AddLabel("Main Options")
opt.gen = dialog.AddTextbox("Generations:", herd.maxGen)
opt.pull= dialog.AddSlider("Pulling CI", pullCI, 0.05, 1, 2)--desctip, default, min, max, precision
opt.shak= dialog.AddSlider("Shake CI", shakeCI, 0.01, 1, 2)
opt.maxci= dialog.AddSlider("Maximum CI", maxCI, 0.05, 1, 2)
opt.qstab=dialog.AddCheckbox("FastQstab", fastQstab)
opt.energy=dialog.AddCheckbox("Seek energy", energy)
opt.mutonly=dialog.AddCheckbox("Only mutable", onlyMutable)
opt.mutonce=dialog.AddCheckbox("Mutate once", mutateOnce)
opt.mutalways=dialog.AddCheckbox("Mutate always", mutateAlways)
opt.mutnever=dialog.AddCheckbox("Mutate never", mutateNever)
opt.fuzeth=dialog.AddTextbox("Fuze threshold: ",fuzeThresh)
opt.qsth=dialog.AddTextbox("Qstab threshold: ",qstabThresh)
opt.run = dialog.AddButton("OK", 1)
opt.more = dialog.AddButton("More", 2)
opt.cancel = dialog.AddButton("Cancel", 0)
res=dialog.Show(opt)
if res > 0 then
energy=opt.energy.value
pullCI=opt.pull.value
shakeCI=opt.shak.value
maxCI=opt.maxci.value
fastQstab=opt.qstab.value
fuzeThresh = tonumber(opt.fuzeth.value)
qstabThresh= tonumber(opt.qsth.value)
onlyMutable=opt.mutonly.value
mutateOnce=opt.mutonce.value
mutateAlways=opt.mutalways.value
mutateNever=opt.mutnever.value
herd.maxGen=tonumber(opt.gen.value) --jon fixed maxgen to maxGen
if res==2 then MoreOptions() end
end
until res < 2

return ( res > 0 )
end

function MoreOptions ()
local opt = dialog.CreateDialog("GaB BiS More Options")
opt.lbl1 = dialog.AddLabel("Herd:")
opt.brbest=dialog.AddSlider("Breed best", herd.breedBest, 1, 20, 0)
opt.kbest=dialog.AddSlider("Keep best", herd.keepBest, 1, 20, 0)
opt.bas=dialog.AddSlider("Breed bastards", herd.breedBastards, 1, 20, 0)
opt.rnd=dialog.AddSlider("New random", herd.newRandom, 1, 30, 0)
opt.renew=dialog.AddSlider("Renew hers", herd.renew, 1, 10, 0)
opt.shuff=dialog.AddCheckbox("Shuffle critetrs", herd.shuffle)
opt.lbl2 = dialog.AddLabel("Critter:")
opt.minb=dialog.AddTextbox("Minimum bands:", critter.minBands)
opt.maxb=dialog.AddTextbox("Maximum bands:", critter.maxBands)
opt.keeps=dialog.AddTextbox("Keep score:", critter.keepScore)
opt.breeds=dialog.AddTextbox("Breed score:", critter.breedScore)
opt.maxloss=dialog.AddTextbox("Max loss:", critter.maxLoss)
opt.lbl3 = dialog.AddLabel("Bands:")
opt.minst=dialog.AddSlider("Minmum str", bands.minStr, 0.1, 2, 1)
opt.maxst=dialog.AddSlider("Maximum str", bands.maxStr, 0.1, 2, 1)
opt.maxup=dialog.AddSlider("Max length", bands.maxUp, 3, 20, 0)

--jon's copy from AILearns
opt.lbl4 = dialog.AddLabel("Import pre-evolved algorithm:")
opt.lbl5 = dialog.AddLabel("(Not functional yet)")
opt.lbl6 = dialog.AddLabel("Segment #, stride #, index #, x,y,z, strength")
local moreDialog = opt --lazy copy pasting
moreDialog.Label = dialog.AddLabel("Include pre-defined algorithms:")

--beginner covid19
moreDialog.AddAlgorithm1 = dialog.AddCheckbox(
"168, 193, 87, 11.13, 1.17, 3.07, 0.72", true);

--aflatoxin
moreDialog.AddAlgorithm2 = dialog.AddCheckbox(
"64, 20, 16, 5.9, 0.6, 0.7,0.9", true);
moreDialog.LabelCustomAlgorithm = dialog.AddLabel("Include custom algorithm:")
moreDialog.CustomHash = dialog.AddTextbox("", "")

opt.run = dialog.AddButton("OK", 1)
dialog.Show(opt)

herd.breedBest = opt.brbest.value
herd.keepBest = opt.kbest.value
herd.breedBastards = opt.bas.value
herd.newRandom = opt.rnd.value
herd.shuffle = opt.shuff.value
herd.renew=opt.renew.value

critter.minBands=tonumber(opt.minb.value)
critter.maxBands=tonumber(opt.maxb.value)
critter.keepScore = tonumber(opt.keeps.value)
critter.breedScore=tonumber(opt.breeds.value)
critter.maxLoss=tonumber(opt.maxloss.value)

bands.minStr=opt.minst.value
bands.maxStr=opt.maxst.value
bands.maxUp = opt.maxup.value
end

function Cleanup ( err )
print ( "Restoring clashing importance and best result" )
CI ( 1 )
save.Quickload ( 3 )
p("Final score: "..round(Score()).." Total gain: "..round(Score()-ss))
OG.Cleanup()
behavior.SetFiltersDisabled(false)
print ( err )
end

-- main call
OG.Init()
if dialogOptions() then
xpcall ( GAB, Cleanup )
end

--end of script

Joined: 10/10/2015
Groups: Team China
before and after fairness

before fairness:
https://fold.it/portal/files/chatimg/irc_769520_1588569077.png

after fairness:
https://fold.it/portal/files/chatimg/irc_769520_1588569476.png

has about a 20 point improvement on the script by the 2nd generation. be patient though because it starts out slower

Joined: 10/10/2015
Groups: Team China
aflatoxin

gen 63, critter 3, band 6
54, 34, 143, 1.99, 1.56, 5.28, 0.90

Joined: 10/10/2015
Groups: Team China
another test

without fairness
https://fold.it/portal/files/chatimg/irc_769520_1588839566.png

with fairness enabled in More Options
https://fold.it/portal/files/chatimg/irc_769520_1588840357.png
10 point advantage by 2nd gen

Want to try?
Add to Cookbook!
To download recipes to your cookbook, you need to have the game client running.
Parent
Children

none

Authors
Sitemap

Developed by: UW Center for Game Science, UW Institute for Protein Design, Northeastern University, Vanderbilt University Meiler Lab, UC Davis
Supported by: DARPA, NSF, NIH, HHMI, Amazon, Microsoft, Adobe, RosettaCommons