Dateien nach "ILP/Vanilla" hochladen

This commit is contained in:
2026-09-16 10:20:50 +02:00
parent c91b1b0ca9
commit 8b99e5d56e
-13
View File
@@ -19,7 +19,6 @@ HYPERGRAPH = {
14: (['34Dihydroxybenzaldehyd'], []),
}
FIXED_FLOWS = {
#1: 1,
#14: 1,
@@ -31,8 +30,6 @@ def build_model(name, hyperedges, vertices, ele, el1, el2, excluded_support=None
x = {e_id: model.addVar(vtype=GRB.INTEGER, lb = 0, name = f"x_{e_id}") for e_id in hyperedges}
b = {e_id: model.addVar(vtype=GRB.BINARY, name = f"b_{e_id}") for e_id in hyperedges}
vertices = set(v for tails, heads in hyperedges.values() for v in tails + heads)
for v in vertices:
@@ -58,10 +55,8 @@ def build_model(name, hyperedges, vertices, ele, el1, el2, excluded_support=None
model.setObjective(quicksum(1000 * ele[e_id] * b[e_id] - x[e_id] for e_id in hyperedges),GRB.MAXIMIZE)
return model, x, b
def positive_entries(variable_dict, threshold = 0.5):
return {e_id: var.X for e_id, var in variable_dict.items() if var.X > threshold}
@@ -79,12 +74,6 @@ def print_solution(title, flow_solution, binary_solution, hyperedges):
print(f"Number of used hyperedges: {len(binary_solution)}")
def main():
#Similyrity of Nodes NMR to Measured NMR
#Can how to add Values along a Path?
#Can you count position on path?
#Can you save spectra values to add hypergraphposition to spectrainformation?
#Compositespectra vs oredered set of spectra
VERTICES = ['Cinnamicacid', 'p-Coumaricacid', 'm-Coumaricacid', 'Benzaldehyd', 'Caffeicacid', '3-Hydroxybenzaldehyd', '4-Hydroxybenzaldehyd', '34Dihydroxybenzaldehyd']
#Results for comparison with p-Coumaricacid bei shift von 2.5
@@ -112,8 +101,6 @@ def main():
for vertice, likelihood in zip(VERTICES, NMRE):
VERTICEE[vertice] = likelihood
#Kantenwahrscheinlichkeiten für NMR1:
EDGE1 = {}
#Kantenwahrscheinlichkeiten für NMR2: