예제 #1
0
파일: example1.py 프로젝트: Leslieaj/VCELDI
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)
예제 #2
0
def e7Ldfinequations(chopcond, path, ldis):
    fragments = splitpath(chopcond, path)
    ldfineqs = []
    #ldfsJ2 = ldis[:2]
    #ldfsJ3J4 = ldis[2:]
    for i, ldi in zip(range(0, len(ldis)), ldis):
        symbolcls = []
        for cl in ldi.coefficientlocations:
            tempcl = Coefficientlocation(cl.coefficient, cl.location)
            symbolcls.append(tempcl)
        for symbolcl in symbolcls:
            #print 0 if i < 2 else -1
            for slocation in fragments[0 if i < 2 else -1]:
                if slocation.location == symbolcl.location:
                    if slocation.index == chopcond[0]:
                        if i < 2:
                            symbolcl.adddvalue('m_' + str(1))
                        else:
                            symbolcl.adddvalue(slocation.getsymbol() + '-' +
                                               'm_' + str(1))
                    else:
                        symbolcl.adddvalue(slocation.getsymbol())
        ldfineqs.append(ldftoineq(symbolcls, ldi.bound))
    lastldf = ldfineqs[-1].replace('<=', '<')
    ldfineqs.pop()
    ldfineqs.append(lastldf)
    #print ldfineqs
    ldfsJ2 = ldfineqs[0:2]
    ldfsJ3J4 = ldfineqs[2:]
    return ldfsJ2toineq(ldfsJ2) + 'and' + ldfsJ3J4toineq(ldfsJ3J4)
예제 #3
0
파일: example3.py 프로젝트: Leslieaj/VCELDI
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) + ')'
예제 #4
0
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)