Skip to content
Snippets Groups Projects
Commit ed751c3b authored by msurl's avatar msurl
Browse files

pushed progress

parent 7270d3ff
No related branches found
No related tags found
No related merge requests found
......@@ -337,12 +337,9 @@ class RootedConnectecKHopDominatingSet(ConnectedKHopDominatingSet):
def add_simple_path_length_constraint(self):
self.m.addConstrs((self.nodes[v] * len(nx.algorithms.shortest_path(self.G, self.root, v))) <= gp.quicksum(self.nodes) for v in self.G.nodes)
# self.m.addConstrs((self.nodes[v] * self.nodes[w] * len(nx.algorithms.shortest_path(self.G, v, w))) <= gp.quicksum(self.nodes) for v in self.G.nodes for w in self.G.nodes)
def add_gausian_sum_formula_constraint(self):
self.m.addConstr(gp.quicksum(self.nodes[v] * len(nx.algorithms.shortest_path(self.G, self.root, v)) for v in self.G.nodes) <= (gp.quicksum(self.nodes)+1)*gp.quicksum(self.nodes)/2)
# self.m.addConstr(gp.quicksum(self.nodes[v] * self.nodes[w] * len(nx.algorithms.shortest_path(self.G, v, w)) for v in self.G.nodes for w in self.G.nodes) <= (gp.quicksum(self.nodes)+1)*gp.quicksum(self.nodes)/2)
def add_neighbor_of_neighbors_constraint(self, exclude):
self.m.addConstrs(self.nodes[v] <= gp.quicksum(self.nodes[w] * gp.quicksum(self.nodes[h] for h in self.G.neighbors(w) if h is not v) for w in self.G.neighbors(v)) for v in self.G.nodes if v not in exclude)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment