Jump to content

Search the Community

Showing results for tags 'array combinations slow'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hello all, I have a array combinations problem I need to generate a list of unique 8-numbers array (A,B,C,D,E,F,G) from 8 lines (arrays) of number in 1 file as below: Line 1 17,1,2,3,4,5,6,7,10,11,12,13,15,16,20,22,24,26,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, Line 2 16,1,2,3,4,5,6,7,8,9,10,11,12,16,17,21,26,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, Line 3 23,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,23,25,26,28,29,35,36,,,,,,,,,,,,,,,,,,,,,,,,,, Line 4 27,8,9,11,12,13,14,15,17,19,20,21,22,23,24,26,27,28,29,30,31,32,34,37,39,40,41,42,,,,,,,,,,,,,,,,,,,,,, Line 5 27,14,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,,,,,,,,,,,,,,,,,,,,,, Line 6 24,20,24,26,27,28,29,30,31,32,33,34,35,36,37,39,40,41,42,43,44,45,46,47,48,,,,,,,,,,,,,,,,,,,,,,,,, Line 7 16,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, Line 8 14,35,37,38,39,40,41,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, i.e. A from Line 1 and B from Line 2 and so on, the 1st number of each line is the number count in each line i.e. 17 at Line 1 mean that there is 17 number in Line 1. Number in each line is unique and in ascending order, range from 1~49. I read in the line file into an array and using for loop to do the job func MyArrayGeneration() local $LineArr,$uArr dim $MyRes[8] _FileReadToArray("mylinefile.txt",$LineArr,$FRTA_ENTIRESPLIT , ",") $OutName="MyOutPut.txt" $OutFile=fileopen($OutName,10) $ResuCnt=0 ;form the gen draw for $i=1 to $LineArr[0][0] for $j=1 to $LineArr[1][0] for $k=1 to $LineArr[2][0] for $l=1 to $LineArr[3][0] for $m=1 to $LineArr[4][0] for $n=1 to $LineArr[5][0] for $o=1 to $LineArr[6][0] for $p=1 to $LineArr[7][0] $MyRes[0]=$LineArr[0][$i] $MyRes[1]=$LineArr[1][$j] $MyRes[2]=$LineArr[2][$k] $MyRes[3]=$LineArr[3][$l] $MyRes[4]=$LineArr[4][$m] $MyRes[5]=$LineArr[5][$n] $MyRes[6]=$LineArr[6][$o] $MyRes[7]=$LineArr[7][$p] $uArr=_ArrayUnique($MyRes) if $uArr[0]=8 then _arraysort($MyRes) _arraytranspose($MyRes) _FileWriteFromArray($OutFile,$MyRes,0,Default,",") _arraytranspose($MyRes) endif ;$uArr[0]=8 $uArr="" next next next next next next next next fileclose($OutFile) endfunc and the result line cannot contain duplicated number i.e. 1,1,4,8,14,20,33,35 is not allowed therefor I use arrayunique to test if the formed array has repeated number(s), if not, output to a file. However, I find that this method is very s-l--o---w! Take over 2 hrs and still not completed 1 file (I have 800 files need to handled!!). Also, this approach cannot generate unique combination i.e. 1,2,4,8,14,20,33,35 may generate more than 1 time!!!! Is there any better method/algorithm/library to handle this ? Thanks a lot. Regds LAM Chi-fung
×
×
  • Create New...