Tuesday, July 28, 2015

How does it work

IQ Solver is designed to handle data presented as a graph. However the current version solves only sequential tests. Simplified version of algorithm of finding the solution works in the following way. For every sequence the following steps are ordered:

  • Check if it composes of the same elements - if yes then in description you will see.

[7, 7, 7] consists only of : 7
  • Check if it repeats the same subsequence of elements. If yes then the description is:
[1, 1, 2, 1, 1, 2, 1, 1, 2] is repeated sequence of : [1, 1, 2]
  • Check if element a[n] = a[n-2] # a[n-1]  where # is +, -, * or / . Sample description:
Obtain element by applying "-" on previous 2 elements of [1, 4, -3, 7, -10] 

  • Create a new imaginary sequence by applying +, -, * or / on the current and previous elements. 
Apply "-" on consecutive elements in [1, 3, 7, 15] to get [2, 4, 8]
  • Create n imaginary sequences by splitting the original sequence:
[1, 1, 2, 2, 3, 4, 4, 8] may be divided into 2 sequences: 
         [1, 2, 3, 4]; [1, 2, 4, 8]
  • If some elements are repeated - create 2 imaginary sequences - one with number of each repetition (or 1 is an element is single) and the second with the repeated elements.
[5, 8, 5, 5, 8, 5, 5, 5, 8] may be divided into values [5, 8, 5, 8, 5, 8] and number of their repetitions [1, 1, 2, 1, 3, 1]

The same steps as applied on original series are also applied on the imaginary ones. This creates a a huge tree  of potential solutions. To handle this, a total complexity of solution is calculated and it determines which steps should be performed first. This rate is even shown as the low value indicate simple solution, which should be the right one.

Example


Here is the generated explanation of the sequence 5,8,5,5,8,5,5,5,8
[5, 8, 5, 5, 8, 5, 5, 5, 8] may be divided into values [5, 8, 5, 8, 5, 8] and number of their repetitions [1, 1, 2, 1, 3, 1]
  [5, 8, 5, 8, 5, 8] is repeated sequence of : [5, 8]
  [1, 1, 2, 1, 3, 1] may be divided into 2 sequences: 
         [1, 2, 3]; [1, 1, 1]
    Apply "-" on consecutive elements in [1, 2, 3] to get 1
    [1, 1, 1] consists only of : 1

And the graph to this solution generated using GraphStream library


No comments:

Post a Comment