Пример #1
0
    def buildParseTree(self, expression):
        # Find all numbers and operators and put into list
        fplist = re.findall(r"[+*-/()\^]| *(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?", expression)
        tree = self.tree
        current_branch = Branch()

        for i in fplist:
            if i == '(':
                current_branch = Branch()
                current_branch.insert_left('')
                tree.set_parent(current_branch)
                current_branch = current_branch.get_left_child()

            elif i in ['+', '-', '*', '/']:
                current_branch = Branch()
                current_branch.set_root_value(i)
                tree.set_parent(current_branch.tree)
                tree.insert_right({})
                current_branch = Branch()

            elif i == ')':
                current_branch = tree.get_parent()

            elif i not in ['+', '-', '*', '/', ')']:
                try:
                    current_branch = current_branch.set_root_value(int(i))
                    tree = current_branch

                except ValueError:
                    raise ValueError("token '{}' is not a valid integer".format(i))

        print self.tree.tree
        return tree
Пример #2
0
def test_find_endpoint():
    p = Point(0, 0)
    b = Branch(p)
    assert b.find_endpoint() == (0, -100)
    b = Branch(p, dst=50)
    assert b.find_endpoint() == (0, -50)
    b = Branch(p, dst=50, angle=180)
    assert b.find_endpoint() == (0, 50)
Пример #3
0
def main():

    # Main loop
    while True:
        events = pygame.event.get()
        for event in events:
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()

        # Draw on screen
        screen.blit(bg, (0, 0))
        draw_ground()

        tam_br = 8
        if main_br.get_len() > 5:
            length = main_br.get_len()
            # if length
            branch = Branch(main_br.get_rect(length - 1).x,
                            main_br.get_rect(length - 1).y,
                            color=GREEN,
                            tam=8)
            branch.set_direction(Branch.RIGHT)
            tree.append(branch)

        if main_br.get_len() > 5:
            length = main_br.get_len()
            branch = Branch(main_br.get_rect(length - 1).x,
                            main_br.get_rect(length - 1).y,
                            color=GREEN,
                            tam=8)
            branch.set_direction(Branch.LEFT)
            tree.append(branch)

        # # Drawing branches and main
        # if main_br.get_len() in [5, 15, 25, 35, 45]:
        # 	length = main_br.get_len()
        # 	branch = Branch(main_br.get_rect(length-1).x, main_br.get_rect(length-1).y, color=GREEN, tam=8)
        # 	branch.set_direction(Branch.RIGHT)
        # 	tree.append(branch)

        # if main_br.get_len() in [10, 20, 30, 40, 50]:
        # 	length = main_br.get_len()
        # 	branch = Branch(main_br.get_rect(length-1).x, main_br.get_rect(length-1).y, color=GREEN, tam=8)
        # 	branch.set_direction(Branch.LEFT)
        # 	tree.append(branch)

        for br in tree:
            br.draw_branch(screen)

        pygame.display.update()
        sleep(0.1)
        clock.tick(30)
Пример #4
0
def build_tree():
    root = Branch()
    branches = [root]
    for _ in range(500):
        new_branch = Branch()
        branches.append(new_branch)
        clear_branch = find_clear_branch(root)
        clear_branch.attach(new_branch)

    secret_branch = choice(branches)
    secret_branch.has_kitten = True
    root.show()
    return root
Пример #5
0
    def iteration(self, rule = [( + 85/180*np.pi, 1.5), (-85/180*np.pi, 1.5)], noise = True):
        """
        This method is what differentiate an L-system form another. The necessary rules for the costruction are:
            -1) number of child branch (n = 2,3)
            -2) angle deviation of each child branch (+ alpha, - alpha)
            -3) increasing/decreasing length ratio (l1 = l0 * R).
            -4) Presence of noise on the angle in the ramification.
                [It's greater and greater going on with the iterations (proportional to iter_lev)]

        The current branch is used to create the new branch(es). The first three rules could be all condesed
        in a list, like this one:    [(+alpha, R), (-alpha, R)].
        This rule create 2 new branches (list lenght) with the reported angular deviation al lenght ratio.
        The origin and generation relationship shuold be update after every application of the rules.
        """
        if self.branches != []:
            for br in self.branches:
                if br.iter_lev == self.n_iter:
                    l0, theta0 =cmath.polar(br.head - br.tail)
                    for gen in rule:
                        #The first iterations are made completely
                        if self.n_iter < 3:
                            ang_noise = noise*br.iter_lev*gen[0]/20
                            l1 = l0/gen[1]
                            theta1 = theta0 + gen[0]
                            theta1 = theta1 + random.uniform(-ang_noise, ang_noise)  #Adding noise
                            travel = cmath.rect(l1, theta1)
                            new_branch = Branch(tail = br.head,
                                                head = br.head + travel,
                                                iter_lev = self.n_iter + 1,
                                                origin = br)
                            br.generate.append(new_branch)
                            self.branches.append(new_branch)
                        #Further iterations are subjected to variations
                        elif np.random.uniform()> 0.1:
                            ang_noise = noise*br.iter_lev*gen[0]/20
                            l1 = l0/gen[1]
                            theta1 = theta0 + gen[0]
                            theta1 = theta1 + random.uniform(-ang_noise, ang_noise)  #Adding noise
                            travel = cmath.rect(l1, theta1)
                            new_branch = Branch(tail = br.head,
                                                head = br.head + travel,
                                                iter_lev = self.n_iter + 1,
                                                origin = br)
                            br.generate.append(new_branch)
                            self.branches.append(new_branch)

            self.n_iter += 1 #updating n_iter
        else:
            raise Exception('Start your L_system before iteration.')
Пример #6
0
 def start(self, branch = Branch()):
     """
     Method that initialize/overwrite the previous drawing.
     The default starting branch is the tail = (0,0), head = (0,1), iter_lev = 0, origin = None]
     """
     self.n_iter = 0
     self.branches = [branch]
Пример #7
0
    def __getBranchMapFromRefList(self, aRefList):
        """
    Retrieve the branch map for this manager for all local branches. The branch
    map is a list of Branch objects, each mapping a ref path to a
    healthy/aged/old status.

    :param aRefList: A list of Reference objects that should be processed and
                     mapped to healthy statuses.

    :return: A list of Branch objects, each of which maps one Reference in aRefList
             to a health status.
    """
        log = self.__mConfig.getLog()
        branchMap = []

        for branch in aRefList:
            branchPath = branch.path
            branchName = branchPath.split('/')[-1]

            # Don't include branches that should be ignored.
            shouldIgnore = False
            for ignoredBranch in self.__getConfig().getIgnoredBranches():
                if branchName == ignoredBranch:
                    shouldIgnore = True
                    break
            if shouldIgnore:
                continue

            newBranch = Branch(branchPath, self.__getConfig())
            branchMap.append(newBranch)
        return branchMap
Пример #8
0
 def cmd_checkout(branch):
     b = Branch()
     b.switch_branch(branch)
     repo = Repository()
     pre_entries = dict(repo.index.entries)
     repo.rebuild_index_from_commit(repo.branch.head_commit)
     repo.rebuild_working_tree(pre_entries)
Пример #9
0
 def test_commit_once(self):
     Command.cmd_commit('first ci')
     commit = Commit(sha1=Branch().head_commit)
     self.assertIsNone(commit.parent_sha1)
     tree = Tree(sha1=commit.tree)
     objects = tree.parse_objects()
     self.assertEqual(objects[self.path]['sha1'], Blob(self.content).sha1)
Пример #10
0
def get_tactic_by_waves_forward(waves_forward):
    branch = Branch()
    for waves_forward in range(waves_forward, 0, -1):
        best_basket = compute_best_basket(branch.player, waves_forward)
        branch.buy_basket(best_basket)
        yield branch.copy()
        branch.next_wave()
Пример #11
0
def get_max_income_tactic():
    branch = Branch()
    while True:
        best_basket = compute_best_basket(branch.player)
        branch.buy_basket(best_basket)
        yield branch.copy()
        branch.next_wave()
def process_branch(branch_dict, repo):
    """ Takes a dictionary that has branch names as keys. This method sets
    branches for repo"""
    for branch_name in branch_dict:
        branch = branch_dict[branch_name]
        repo.get_branches()[branch_name] = Branch(branch[BRANCH_HEAD],
                                                  branch_name)
Пример #13
0
def create_branch():
    branch_name = input('Branch Name: ')
    branch_code = input('Branch Code: ')
    address = Address('', '', '', '', '', '', '', '')
    address.input_address()
    b = Branch(branch_code, branch_name, address)
    global_branches[b.branch_code] = b
    print('Branch created successfully!')
Пример #14
0
 def test_reset_default(self):
     Command.cmd_reset(self.first_commit, is_soft=False, is_hard=False)
     self.assertEqual(Branch().head_commit, self.first_commit)
     repo = Repository()
     uncommitted_files = repo.get_uncommitted_files()
     unstaged_files = repo.get_unstaged_files()
     self.assertFalse(uncommitted_files['modified'])
     self.assertIn(self.path, unstaged_files['modified'])
Пример #15
0
def test_get_colour():
    c = Colours((0, 0, 0), (255, 255, 255))
    p = Point(0, 0)
    b = Branch(p)
    c.assign_colour(b, 0)
    assert c.palette[c.get_colour(b)] == (0, 0, 0)
    c.assign_colour(b, 1023)
    assert c.palette[c.get_colour(b)] == (0, 0, 0)
Пример #16
0
def lambda_handler(event, context):
    if 'body' in event:
        item = json.loads(event.pop('body', event))
    else:
        item = event
    dto = Branch(item)
    ret_val = dto.create()
    response = {'statusCode': 200, 'body': json.dumps({'result': ret_val})}
    return response
Пример #17
0
    def run(self):
        try:
            self.load()
            self.halted = False
        except FileNotFoundError:
            sys.exit()

        branch_table = Branch()
        branch_table.run(self.ram, self.pc, self.register)
        print(self.register)
Пример #18
0
    def create_branch(self, cid, branch_cells, end_point_ids):
        '''Create a branch from the centerlines.
        '''
        points = self.geometry.GetPoints()
        num_lines = self.geometry.GetNumberOfLines()

        ## Find ends of line.
        #
        branch_end_point_ids = []
        branch_end_cell_ids = []

        for cell_id in branch_cells[cid]:
            cell = self.geometry.GetCell(cell_id)
            cell_pids = cell.GetPointIds()
            num_ids = cell_pids.GetNumberOfIds()
            pid1 = cell_pids.GetId(0)
            pid2 = cell_pids.GetId(1)
            if pid1 in end_point_ids:
                start_cell = cell_id
                branch_end_point_ids.append(pid1)
                branch_end_cell_ids.append(cell_id)
            elif pid2 in end_point_ids:
                branch_end_point_ids.append(pid2)
                branch_end_cell_ids.append(cell_id)

        ## Create branch geometry.
        #
        branch_geom = vtk.vtkPolyData()
        branch_geom.SetPoints(points)
        branch_lines = vtk.vtkCellArray()
        #
        for cell_id in branch_cells[cid]:
            cell = self.geometry.GetCell(cell_id)
            cell_pids = cell.GetPointIds()
            num_ids = cell_pids.GetNumberOfIds()
            pid1 = cell_pids.GetId(0)
            pid2 = cell_pids.GetId(1)
            line = vtk.vtkLine()
            line.GetPointIds().SetId(0, pid1)
            line.GetPointIds().SetId(1, pid2)
            branch_lines.InsertNextCell(line)
        #
        branch_geom.SetLines(branch_lines)

        branch_end_normals = []
        for pid in branch_end_point_ids:
            pt = points.GetPoint(pid)
            normal = self.surface.get_point_normal(pt)
            branch_end_normals.append(normal)

        #print("[centerlines] branch cid: {0:d}".format(cid))
        #print("[centerlines]   branch_end_point_ids: {0:s}".format(str(branch_end_point_ids)))
        #print("[centerlines]   branch_end_cell_ids: {0:s}".format(str(branch_end_cell_ids)))
        return Branch(cid, branch_geom, branch_end_point_ids, branch_end_cell_ids, branch_end_normals, 
                      self.clip_distance, self.clip_width_scale)
Пример #19
0
 def cmd_branch(name, is_deleted=False):
     b = Branch()
     if not name:
         for branch in b.get_all_branches():
             print '* %s' % colored(
                 branch,
                 'green') if branch == b.head_name else '  %s' % branch
     elif is_deleted:
         b.delete_branch(name)
     else:
         b.add_branch(name)
Пример #20
0
    def test_commit_twice(self):
        Command.cmd_commit('first ci')
        parent_sha1 = Branch().head_commit

        second_content = '11\n'
        write_to_file(self.path, second_content)

        new_path = '2.txt'
        new_content = '2\n'
        write_to_file(new_path, new_content)

        Command.cmd_add('.')
        Command.cmd_commit('second ci')

        commit = Commit(sha1=Branch().head_commit)
        self.assertEqual(parent_sha1, commit.parent_sha1)
        tree = Tree(sha1=commit.tree)
        objects = tree.parse_objects()
        self.assertEqual(objects[self.path]['sha1'], Blob(second_content).sha1)
        self.assertEqual(objects[new_path]['sha1'], Blob(new_content).sha1)
Пример #21
0
def lambda_handler(event, context):
    if 'queryStringParameters' in event:
        item = event.pop('queryStringParameters')
        if isinstance(item, str):
            item = literal_eval(item)
    else:
        item = event
    dto = Branch(item)
    ret_val = dto.delete()
    response = {'statusCode': 200, 'body': json.dumps({'result': ret_val})}
    return response
Пример #22
0
    def ConstructLELsForNode(self, leafNode):
        nodes = leafNode.branchNodes
        caseId = leafNode.caseId
        branch = Branch(self.branchId, caseId, nodes)
        self.branchId += 1
        self.checkedLeafs.append(leafNode)
        duplicated = []
        if (len(self.eventLogsDic) == 0):  # when its the first node to come
            newLEL = []
            newLEL.append(branch)
            self.eventLogsDic[self.eventLogID] = newLEL
            self.eventLogID += 1

        # handle coming\ following cases
        else:
            currentEventLogIds = [
                x for x in self.eventLogsDic.keys()
            ]  #this line to avoid the error of being change in the iterator object :D
            newLELs = []
            for eLogID in currentEventLogIds:
                if (self.eventLogsDic.get(eLogID) == None):
                    continue
                branches = self.eventLogsDic[eLogID]
                conflictBranches = self.checkRedundantBranches(
                    branch, branches)  # do
                if (len(conflictBranches) >
                        0):  # if there are branches that violate the Checks
                    cb = self.getBranch(conflictBranches, caseId)
                    if (cb != None):
                        diff = set(branch.eventIdentifierList) - (
                            set(cb.eventIdentifierList)
                        )  # what in the new branch not in the old branch
                        if (len(diff) == 0):
                            continue
                        if (set(branch.eventIdentifierList).issuperset(
                                set(cb.eventIdentifierList))):
                            self.eventLogsDic[eLogID].remove(cb)
                            self.eventLogsDic[eLogID].append(branch)
                            continue
                        elif (set(cb.eventIdentifierList).issuperset(
                                set(branch.eventIdentifierList))):
                            continue
                    newLEL = list(set(branches) - set(conflictBranches))
                    newLEL.append(branch)
                    newLELs.append(newLEL)
                    self.eventLogsDic[self.eventLogID] = newLEL
                    self.eventLogID += 1
                else:
                    self.eventLogsDic[eLogID].append(branch)
            duplicated = self.checkEventLogExistance(newLELs)
            if (len(duplicated) > 0):  #(not isdicclean):
                for elogid in duplicated:
                    if (self.eventLogsDic.has_key(elogid)):
                        del self.eventLogsDic[elogid]
Пример #23
0
def add_branch():
    data = request.get_json()
    # data = json.loads(data2)

    city = data["city"]
    state = data['state']
    branch_id = data['branch_id']
    address = data['address']
    new_branch = Branch(branch_id, address, city, state)
    new_branch.save()

    return "success"
Пример #24
0
def main():
    pygame.init()

    clock = pygame.time.Clock()
    fps = 60

    res = wid, hi = 1440, 870
    d_surf = pygame.display.set_mode(res)

    point = Point(wid / 2, hi / 2)
    n = 7
    max_dep = 5

    cols = Colours((0, 0, 0), (255, 0, 0), (255, 165, 0), (255, 255, 0),
                   (0, 0, 0), (0, 0, 0), (0, 0, 40), (255, 255, 255))

    col_spd = 2

    branch_list = []
    for i in range(n):
        branch = Branch(point,
                        angle=360 / n * i,
                        dev=90 / n,
                        dst=150,
                        max_dep=max_dep)
        branch_list.append(branch)

    set_colours(branch_list, cols)

    while True:

        cols.inc_colours(col_spd)
        d_surf.fill((0, 0, 0))
        for branch in branch_list:  # PH code to test methods: a better gen method reqd!
            branch.push_angles()
            branch.inc_tree_angle(
                -0.4)  # all works now, but order is important!
            branch.inc_angle(4, 3)
            branch.inc_angle(-2, 4)  # push_angle first
            branch.inc_tree_dev(0.08)  # then angle ops, tree-wide first
            branch.inc_dev(-0.8, 2)  # then dev ops, tree-wide first.
            branch.propagate()  # then propagate.
            # draw_circles(d_surf, branch, max_dep)
            draw_branch(d_surf, branch, cols)

        for e in pygame.event.get():
            if e.type == QUIT or e.type == KEYDOWN and e.key == 27:
                pygame.quit()
                sys.exit()

        pygame.display.update()
        clock.tick(fps)
Пример #25
0
    def setUp(self):
        self.workspace = 'test_reset'
        Command.cmd_init(self.workspace)

        self.path, self.content = ('1.txt', '1\n')
        write_to_file(self.path, self.content)
        Command.cmd_add(self.path)
        Command.cmd_commit('first ci')
        self.first_commit = Branch().head_commit

        write_to_file(self.path, '2.txt')
        Command.cmd_add(self.path)
        Command.cmd_commit('second ci')
Пример #26
0
	def __init__(self, memoryFile):
		self.nCycles = 0 # Used to hold number of clock cycles spent executing instructions

		# Fetch
		self.PCMux	  = Mux()
		self.ProgramC   = PC(long(0xbfc00200))
		self.InstMem	= InstructionMemory(memoryFile)
		self.IFadder	= Add()
		self.JMux	   = Mux()
		self.IFaddconst = Constant(4)
		self.IF_ID_Wall = Wall()
		self.fetchgroup = {}

		# Decode
		self.register   = RegisterFile()
		self.signext	= SignExtender()
		self.control	= ControlElement()
		self.jmpCalc	= JumpCalc()
		self.ID_EX_Wall = Wall()

		# Execute
		self.EXadder	= Add()
		self.shiftL	 = LeftShifter()
		self.ALogicUnit = ALU()
		self.ALUSrcMux  = Mux()
		self.RegDstMux  = Mux()
		self.ALUctrl	= AluControl()
		self.EX_MEM_Wall= Wall()

		# Memory
		self.storage	= DataMemory(memoryFile)
		self.brnch	  = Branch()
		self.MEM_WB_Wall= Wall()

		# Write Back
		self.WBmux = Mux()

		self.ProgramC
		self.elements1 = [self.InstMem, self.IFaddconst, self.IFadder, self.PCMux, self.JMux]
		self.elements2 = [self.control, self.register, self.signext, self.jmpCalc]
		self.elements3 = [self.shiftL, self.ALUSrcMux, self.RegDstMux, self.ALUctrl, self.ALogicUnit, self.EXadder]
		self.elements4 = [self.brnch, self.storage]
		self.elementsboot = [self.IFaddconst, self.IFadder, self.InstMem,
							 self.IF_ID_Wall, self.register, self.signext, self.control, self.jmpCalc,
							 self.ID_EX_Wall, self.RegDstMux, self.shiftL, self.EXadder, self.ALUSrcMux, self.ALUctrl, self.ALogicUnit,
							 self.EX_MEM_Wall, self.brnch, self.storage,
							 self.MEM_WB_Wall, self.WBmux, self.PCMux, self.JMux]
		self.walls = [self.MEM_WB_Wall, self.EX_MEM_Wall, self.ID_EX_Wall, self.IF_ID_Wall]


		self._connectCPUElements()
Пример #27
0
 def add_branch(self,
                identifier,
                caseId,
                nodes,
                confidenceLevel,
                branchParent=None):
     branch = Branch(identifier, caseId, nodes, confidenceLevel,
                     branchParent)
     branch_identifier = branch.identifier
     if branchParent is not None:
         branchParent.add_child(branch)
     else:
         self[branch_identifier] = branch
     return branch
    def __init__(self):
        self.branch = Branch()
        self.job = Job()
        self.post_receive_hook = PostReceiveHook()
        self.project = Project()
        self.pull_request = PullRequest()
        self.sonar_qube = SonarQube()

        self.__project_ops__ = {
            'branch:set_default_permissions_for_project':
            self.branch.set_default_permissions_for_project,
            'post_receive_hook:configure_for_project':
            self.post_receive_hook.configure_for_project,
            'post_receive_hook:disable_for_project':
            self.post_receive_hook.disable_for_project,
            'post_receive_hook:enable_for_project':
            self.post_receive_hook.enable_for_project,
            'project:get_repos':
            self.project.get_repos,
            'pull_request:get_my_pull_requests':
            self.pull_request.get_my_pull_requests,
            'pull_request:set_pull_request_settings_for_project':
            self.pull_request.set_pull_request_settings_for_project,
            'sonar_qube:configure_for_project':
            self.sonar_qube.configure_for_project
        }

        self.__ops__ = {
            'branch:list_branches': self.branch.list_branches,
            'branch:create_branch': self.branch.create_branch,
            'branch:delete_branch': self.branch.delete_branch,
            'branch:set_default_permissions':
            self.branch.set_default_permissions,
            'branch:set_default_branch': self.branch.set_default_branch,
            'job:create_pipeline_job': self.job.create_pipeline_job,
            'job:delete_pipeline_job': self.job.delete_pipeline_job,
            'job:trigger_pipeline_branch_job':
            self.job.trigger_pipeline_branch_job,
            'job:trigger_pipeline_job': self.job.trigger_pipeline_job,
            'post_receive_hook:configure': self.post_receive_hook.configure,
            'post_receive_hook:disable': self.post_receive_hook.disable,
            'post_receive_hook:enable': self.post_receive_hook.enable,
            'pull_request:merge_pull_request':
            self.pull_request.merge_pull_request,
            'pull_request:set_pull_request_settings':
            self.pull_request.set_pull_request_settings,
            'pull_request:update_pull_request_status':
            self.pull_request.update_pull_request_status,
            'sonar_qube:configure': self.sonar_qube.configure
        }
Пример #29
0
    def span_trees(self):
        """
        Span a tree for each battery with its houses.
        For all nodes in the tree, determine all paths to
        remaining houses and choose the cheapest path. 
        Add the new house to the tree and all nodes of 
        its path. Continue until all houses are in the tree.
        """

        for battery in self.batteries:
            mst = {}
            tree = {battery: {}}
            houses = copy.deepcopy(battery.houses)

            for house in houses:
                distance = get_distance(house, battery)
                tree[battery][house] = distance

            least_distance = {}
            while houses:
                for vertice in tree.keys():
                    distance_to_targets = tree[vertice]
                    house, distance = min(
                        distance_to_targets.items(), key=lambda x: x[1])
                    least_distance[vertice] = (house, distance)

                link = min(least_distance.items(), key=lambda x: x[1][1])

                from_vertice, new_vertice, distance = link[0], link[1][0], link[1][1]
                new_nodes = pathfinder(from_vertice, new_vertice)[1:-1]
                branch = Branch(from_vertice, new_vertice)
                branch.load_path(new_nodes)
                mst[branch] = distance

                houses.remove(new_vertice)
                for vertice in tree.keys():
                    del tree[vertice][new_vertice]

                for node in new_nodes:
                    tree[node] = {}
                    for house in houses:
                        distance = get_distance(node, house)
                        tree[node][house] = distance

                tree[new_vertice] = {}
                for house in houses:
                    distance = get_distance(new_vertice, house)
                    tree[new_vertice][house] = distance

            self.mst_container.append(mst)
Пример #30
0
    def build_branches(self):
        for idx, layer in enumerate(self._layers):
            for neuron in layer.neurons:
                # ENTRANCE layer only - create and set branches that connect into the neuron from each input
                if layer.layer_id == 1:
                    for idx2 in range(self._num_inputs):
                        
                        random_weight = random.uniform(self._weight_interval[0],self._weight_interval[1])

                        new_branch_id = str(idx2 + 1) + "" + str(neuron.neuron_id) + "" + str(layer.layer_id)
                        new_branch_in = Branch(new_branch_id, random_weight)
                        neuron.add_branch(new_branch_in, "in")

                # HIDDEN layers only - create and set branches that leave the current neuron and connect into next layer's neuron
                if layer.layer_id != len(self._layers):
                    for next_layer_neuron in self._layers[idx + 1].neurons:
                        
                        random_weight = random.uniform(self._weight_interval[0],self._weight_interval[1])

                        new_branch_id = str(neuron.neuron_id) + "" + str(next_layer_neuron.neuron_id) + "" + str(next_layer_neuron.parent_layer.layer_id)
                        new_branch_out = Branch(new_branch_id, random_weight)
                        neuron.add_branch(new_branch_out, "out")
                        next_layer_neuron.add_branch(new_branch_out, "in")