Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Python by jok3r ( 16 years ago )
def constructSets(current_set):
 global lowest_cost
 global lowest_set

 f = set(i[0] for i in current_set)
 s = set(i[1] for i in current_set)

 current_cost = sumCost(current_set)

 if(len(f&s)==numCompounds):
  if(current_cost<lowest_cost):
   lowest_cost = current_cost
   lowest_set = current_set
  return
 
 for compound in machineHash.keys():
  if(compound not in current_set):
   if(current_cost+priceHash[compound] <= lowest_cost):
    current_set.add(compound)
    constructSets(set(tuple(i) for i in current_set))
    current_set.remove(compound)

 

Revise this Paste

Your Name: Code Language: