Thursday, January 10, 2013

Loop identification - II

This part actually turned out a whole lot trickier than I thought it would. I figured the best way to go about is by a two step process: first identify the route every loop must take and then actually build the loop.

So, this is the first part - identifying the loop.

To begin with, here is the entire code (including node and branch identification):

The loop identification part is:

This works for a couple of circuits. But I'll have to test it for all kinds of circuits (or layouts rather) before moving to the next step.

Some things that I assumed:

1. The branch_map matrix is symmetrical (at least in branch information if not exactly). So this means branches will be picked up sooner or later if a reasonably detailed search method is used.

2. To elaborate on what a "reseaonably detailed" search method is.

3. I start from an element in the row which is the first after the null diagonal element. So this is the first branch. I touch EVERY element in this first row. This means, I take a turn (turning down) at all the other nodes (columns) that this node (row) is connected.

4. I then move left from the first element in the column where I turned. The other nodes in that column are not touched. Will this affect later? Will have to think about it.

5. Similarly, the other searches will also turn a the first node they find.

This is the output from the latest circuit that I pasted. It works for a few simple other ones, but will have to test specifically if the code will break at those assumptions.

No comments:

Post a Comment