def e1Ldfinequations(chopcond, path, ldis): fragments = splitpath(chopcond, path) ldfineqs = [] ldiand = ldis[:2] ldichop = ldis[-1] for ldi in ldiand: symbolcls = [] for cl in ldi.coefficientlocations: tempcl = Coefficientlocation(cl.coefficient, cl.location) symbolcls.append(tempcl) for symbolcl in symbolcls: for slocation in fragments[0]: if slocation.location == symbolcl.location: if slocation.index != chopcond[0]: symbolcl.adddvalue(slocation.getsymbol()) else: symbolcl.adddvalue('m_'+str(1)) ldfineqs.append(ldftoineq(symbolcls, ldi.bound)) symbolcls = [] for cl in ldichop.coefficientlocations: tempcl = Coefficientlocation(cl.coefficient, cl.location) symbolcls.append(tempcl) for symbolcl in symbolcls: for slocation in fragments[-1]: if slocation.location == symbolcl.location: if slocation.index == chopcond[0]: symbolcl.adddvalue(slocation.getsymbol()+'-'+'m_'+str(1)) else: symbolcl.adddvalue(slocation.getsymbol()) ldfineqs.append(ldftoineq(symbolcls, ldichop.bound)) return ldfstoineqs(ldfineqs)
def e2Ldfinequations(path, ldi): lditemp = ldi symbolcls = [] ldfineqs = [] for cl in lditemp.coefficientlocations: tempcl = Coefficientlocation(cl.coefficient, cl.location) symbolcls.append(tempcl) for symbolcl in symbolcls: for slocation in path: if slocation.location == symbolcl.location: symbolcl.adddvalue(slocation.getsymbol()) ldfineqs.append(ldftoineq(symbolcls, ldi.bound)) return '(' + ldfstoineqs(ldfineqs) + ')'
def e8Ldfinequations(chopcond, path, ldis): fragments = splitpath(chopcond, path) ldfineqs = [] ldichop = ldis[:2] ldiand = ldis[-1] #print ldichop[0].ldistr, ldichop[-1].ldistr, ldiand.ldistr for i, ldi in zip(range(0, len(ldichop)), ldichop): symbolcls = [] for cl in ldi.coefficientlocations: tempcl = Coefficientlocation(cl.coefficient, cl.location) symbolcls.append(tempcl) for symbolcl in symbolcls: for slocation in fragments[i]: if slocation.location == symbolcl.location: if slocation.index == chopcond[0]: if i == 0: symbolcl.adddvalue('m_' + str(1)) if i == 1: symbolcl.adddvalue(slocation.getsymbol() + '-' + 'm_' + str(1)) else: symbolcl.adddvalue(slocation.getsymbol()) ldfineqs.append(ldftoineq(symbolcls, ldi.bound)) symbolcls = [] for cl in ldiand.coefficientlocations: tempcl = Coefficientlocation(cl.coefficient, cl.location) symbolcls.append(tempcl) for symbolcl in symbolcls: for slocation in path: if slocation.location == symbolcl.location: #if slocation.index != chopcond[0]: symbolcl.adddvalue(slocation.getsymbol()) #else: #symbolcl.adddvalue('m_'+str(1)) ldfineqs.append(ldftoineq(symbolcls, ldiand.bound)) return ldfstoineqs(ldfineqs)