1

So this is my code which i want to use in my genetic learning algorithm to merge files containing weights.

The partab and enttab lists are of equal and sufficient length

Obviously the bool1 and bool2 values will be set to something else later on but even with both of them set to false which should and always does trigger the third if(and i know i should be using elseif and else),but the length of the output text file varies between 30534 and rarely 30606

When the bools are set not to be always true things change even further,but i don't even know what is causing the variation since the output document should have a consistent amount of lines

Also the output's amount of lines varies even when the partab and enttab tables are constant

innumber=30603  
i=1
while innumber>0 do
    local bool1=false
    local bool2=false

    if bool1 then

            io.write(partab[i],"\n")
            i=i+1
            innumber=innumber-1
    end 

    if (not bool1 )and bool2 then 
            io.write((math.random(2100000)/1000000)-1,"\n")
            i=i+1
            innumber=innumber-1
    end 

    if (not bool1 )and (not bool2) then
                io.write(enttab[i],"\n")
                i=i+1
                innumber=innumber-1
    end



end

In advance,thank you for your help

Mtizim
  • 9
  • 1

0 Answers0