Skip to content

Peer Review #2

@GiuseppeEsposito98

Description

@GiuseppeEsposito98
  1. In the result function you do not filter the elements as specified in the above comment.
  2. in the goal_test function I would suggest to give as input a key by which you sort the list to the "sorted()" function.
  3. Sorting the single elements of the list of lists that you use as initial state is not worth in computational cost terms because I think that this operation does not guarantee you better performances.
  4. Using as input_state a given State and not the null one should make the performance worse, because you may cut the graph with a probability to remove a better path than the one that you find in the end. This is the result we got from our code when we got the same idea.
  5. instead of using lists and set, numpy.ndarrays are better for efficiency purposes: python lists are hetereogeneous and non-contiguous in memory, on the other hand numpy.ndarrays are homogeneous and contiguous so each access is easier. Moreover lumpy package can parallelise computations. In the end the unpack of the different lists would be better computed with reshape and you can also use numpy.unique() in order to compute the unique values of an numpy.ndarray.
  6. In general breadth-first approach is not performing very well when you reach N = 20 so I would suggest to use an A* approach as written in the readme with a priority function which is the sum of the current state cost (state_cost[state] + the number of elements that you need to reach the solution) in order to give more importance to the path that satisfy this condition.

Overall for what concerns the style of the code, it is well written and human readable and the readme is also well organised. I noticed the "tweak": is_valid() function which is a good idea to compare with a set of unique values of the lists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions