public void executeFordFulkersonPackage() { if (buf_pack_FordFulkerson.Count > 0) { if (!buf_pack_FordFulkerson[0].Comeback && !MainForm.findNodeInListById(ID_end, MainForm.Nodes).State || buf_pack_FordFulkerson[0].Comeback && !MainForm.findNodeInListById(ID_start, MainForm.Nodes).State) { buf_pack_FordFulkerson.RemoveAt(0); return; } if (tacts_current >= tacts_needed * buf_pack_FordFulkerson[0].Size * 8 / PackageFordFulkerson.size) { tacts_current = 0; MainForm.CountServiceAccepted++; if (!buf_pack_FordFulkerson[0].Comeback) { buf_pack_FordFulkerson[0].Pass_way.Add(id_node_end); buf_pack_FordFulkerson[0].Pass_way_weight += Convert.ToInt32(tacts_needed); if (buf_pack_FordFulkerson[0].ID_finish == id_node_end) { MainForm.Count_service_sent++; buf_pack_FordFulkerson[0].Saved_way = buf_pack_FordFulkerson[0].Pass_way; buf_pack_FordFulkerson[0].Pass_way.Reverse(); buf_pack_FordFulkerson[0].Pass_way.RemoveAt(0); buf_pack_FordFulkerson[0].Way_found = true; buf_pack_FordFulkerson[0].Comeback = true; } else { bool comeback = true; bool true_way; Channel temp = new Channel(); foreach (Channel channel in MainForm.findNodeInListById(id_node_end, MainForm.Nodes).directConnections) { if (!MainForm.findNodeInListById(channel.ID_end, MainForm.Nodes).State) continue; true_way = true; temp = channel; foreach (int id_node in buf_pack_FordFulkerson[0].Pass_way) if (channel.ID_end == id_node) { true_way = false; break; } if (true_way) { MainForm.Count_service_sent++; temp.buf_pack_FordFulkerson.Add(new PackageFordFulkerson(buf_pack_FordFulkerson[0])); comeback = false; } } if (comeback) { MainForm.Count_service_sent++; buf_pack_FordFulkerson[0].Comeback = true; } else buf_pack_FordFulkerson.RemoveAt(0); } } else { buf_pack_FordFulkerson[0].Pass_way.RemoveAt(0); if (buf_pack_FordFulkerson[0].Pass_way.Count > 0) { foreach (Channel channel in MainForm.findNodeInListById(buf_pack_FordFulkerson[0].Pass_way[0], MainForm.Nodes).directConnections) if (channel.ID_end == id_node_start && MainForm.findNodeInListById(channel.ID_end, MainForm.Nodes).State) { MainForm.Count_service_sent++; channel.buf_pack_FordFulkerson.Add(buf_pack_FordFulkerson[0]); } } else if (buf_pack_FordFulkerson[0].Way_found) MainForm.routingTable[MainForm.routingTable.Count - 1].addWay(buf_pack_FordFulkerson[0].Saved_way, buf_pack_FordFulkerson[0].Pass_way_weight); buf_pack_FordFulkerson.RemoveAt(0); } } else { tacts_current++; } } }
public void addChannelToAllChannels(Channel channel) { channels_all.Add(channel); }