Commit ed751c3b authored by msurl's avatar msurl
Browse files

pushed progress

parent 7270d3ff
......@@ -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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment