Beispiel #1
0
def meti10(numSolutions="all"):
    start = time.time()
    epsilon = 1e-14
    lenV = 1
    x = Variable('x')

    allSolutions = []
    while True:
        if numSolutions != "all" and len(allSolutions) == numSolutions:
            break
        allConstraints = []
        allConstraints.append((2 * x) / (2 + x) >= log(1 + x))
        allConstraints.append(x >= 0.0)
        allConstraints.append(x <= 1000)
        excludingConstraints = []
        for solution in allSolutions:
            singleExcludingConstraints = []
            singleExcludingConstraints.append(x <= solution[0][0])
            singleExcludingConstraints.append(x >= solution[0][1])
            excludingConstraints.append(singleExcludingConstraints)

        #print ("allConstraints")
        #print (allConstraints)
        #print ("numConstraints", len(allConstraints))
        f_sat = logical_and(*allConstraints)
        if len(excludingConstraints) > 0:
            for constraints in excludingConstraints:
                f_sat = logical_and(f_sat, logical_or(*constraints))

        #print ("f_sat")
        #print (f_sat)
        result = CheckSatisfiability(f_sat, epsilon)
        #print (result)
        if result is None:
            break
        hyper = np.zeros((1, 2))
        hyper[0, :] = [
            result[x].lb() - 1000 * epsilon, result[x].ub() + 1000 * epsilon
        ]

        print("hyper", hyper)
        allSolutions.append(hyper)

        print("num solutions found", len(allSolutions))
    '''constraints = []
	x = Variable('x')
	#constraints.append(x >= 0.0)
	#constraints.append(x <= 64.0)
	constraints.append(2*math.pi - 2*x*asin(cos(0.797)*sin(math.pi/x)) == 2.097 - 0.0331*x)
	f_sat = logical_and(*constraints)
	result = CheckSatisfiability(f_sat, epsilon)
	print (result)'''
    end = time.time()
    print("time taken", end - start)
Beispiel #2
0
 def test_functions_with_variable(self):
     self.assertEqual(str(log(x)), "log(x)")
     self.assertEqual(str(abs(x)), "abs(x)")
     self.assertEqual(str(exp(x)), "exp(x)")
     self.assertEqual(str(sqrt(x)), "sqrt(x)")
     self.assertEqual(str(pow(x, y)), "pow(x, y)")
     self.assertEqual(str(sin(x)), "sin(x)")
     self.assertEqual(str(cos(x)), "cos(x)")
     self.assertEqual(str(tan(x)), "tan(x)")
     self.assertEqual(str(asin(x)), "asin(x)")
     self.assertEqual(str(acos(x)), "acos(x)")
     self.assertEqual(str(atan(x)), "atan(x)")
     self.assertEqual(str(atan2(x, y)), "atan2(x, y)")
     self.assertEqual(str(sinh(x)), "sinh(x)")
     self.assertEqual(str(cosh(x)), "cosh(x)")
     self.assertEqual(str(tanh(x)), "tanh(x)")
     self.assertEqual(str(min(x, y)), "min(x, y)")
     self.assertEqual(str(max(x, y)), "max(x, y)")
     self.assertEqual(str(if_then_else(x > y, x, y)),
                      "(if (x > y) then x else y)")
Beispiel #3
0
def mvs_id(fetType, Vs, Vg, Vd, I, shape):
    params = model_params(fetType)
    version = params['version']
    mType = params['mType']
    W = params['W']
    Lgdr = params['Lgdr']
    dLg = params['dLg']
    Cg = params['Cg']
    etov = params['etov']
    delta = params['delta']
    n0 = params['n0']
    Rs0 = params['Rs0']
    Rd0 = params['Rd0']
    Cif = params['Cif']
    Cof = params['Cof']
    vxo = params['vxo'] * 1e7
    mu = params['mu']
    beta = params['beta']
    Tjun = params['Tjun']
    phib = params['phib']
    gamma = params['gamma']
    Vt0 = params['Vt0']
    alpha = params['alpha']
    mc = params['mc']
    CTM_select = params['CTM_select']
    CC = params['CC']
    nd = params['nd']
    zeta = params['zeta']

    # SMALL_VALUE
    SMALL_VALUE = 1e-10
    # LARGE_VALUE
    LARGE_VALUE = 40

    if mType == 1.0:
        Vb = 0.0
        Vdsi = Variable("Vdsin")
        Vgsi = Variable("Vgsin")
        Vbsi = Variable("Vbsin")
        n = Variable("nn")
        nphit = Variable("nphitn")
        phibVbs = Variable("phibVbsn")
        Vtpcorr = Variable("Vtpcorrn")
        eVgpre = Variable("eVgpren")
        FFpre = Variable("FFpren")
        ab = Variable("abn")
        Vcorr = Variable("Vcorrn")
        Vgscorr = Variable("Vgscorrn")
        Vbscorr = Variable("Vbscorrn")
        phibVbscorr = Variable("phibVbscorrn")
        Vt0bs = Variable("Vt0bsn")
        phibVbsi = Variable("phibVbsin")
        Vt0bs0 = Variable("Vt0bs0n")
        Vtp = Variable("Vtpn")
        Vtp0 = Variable("Vtp0n")
        eVg = Variable("eVgn")
        FF = Variable("FFn")
        eVg0 = Variable("eVg0n")
        FF0 = Variable("FF0n")
        Qref = Variable("Qrefn")
        eta = Variable("etan")
        Qinv_corr = Variable("Qinv_corrn")
        Vdsat = Variable("Vdsatn")
        VdsiVdsat = Variable("VdsiVdsatn")
        powVal = Variable("powValn")
        Fsat = Variable("Fsatn")

    else:
        Vb = 1.8
        Vdsi = Variable("Vdsip")
        Vgsi = Variable("Vgsip")
        Vbsi = Variable("Vbsip")
        n = Variable("np")
        nphit = Variable("nphitp")
        phibVbs = Variable("phibVbsp")
        Vtpcorr = Variable("Vtpcorrp")
        eVgpre = Variable("eVgprep")
        FFpre = Variable("FFprep")
        ab = Variable("abp")
        Vcorr = Variable("Vcorrp")
        Vgscorr = Variable("Vgscorrp")
        Vbscorr = Variable("Vbscorrp")
        phibVbscorr = Variable("phibVbscorrp")
        Vt0bs = Variable("Vt0bsp")
        phibVbsi = Variable("phibVbsip")
        Vt0bs0 = Variable("Vt0bs0p")
        Vtp = Variable("Vtpp")
        Vtp0 = Variable("Vtp0p")
        eVg = Variable("eVgp")
        FF = Variable("FFp")
        eVg0 = Variable("eVg0p")
        FF0 = Variable("FF0p")
        Qref = Variable("Qrefp")
        eta = Variable("etap")
        Qinv_corr = Variable("Qinv_corrp")
        Vdsat = Variable("Vdsatp")
        VdsiVdsat = Variable("VdsiVdsatp")
        powVal = Variable("powValp")
        Fsat = Variable("Fsatp")

    constraints = []

    if mType == 1:
        constraints.append(
            logical_or(logical_and(Vs <= Vd, Vdsi == mType * (Vd - Vs)),
                       logical_and(Vs > Vd, Vdsi == mType * (Vs - Vd))))
        constraints.append(
            logical_or(logical_and(Vs <= Vd, Vgsi == mType * (Vg - Vs)),
                       logical_and(Vs > Vd, Vgsi == mType * (Vg - Vd))))
        constraints.append(
            logical_or(logical_and(Vs <= Vd, Vbsi == mType * (Vb - Vs)),
                       logical_and(Vs > Vd, Vbsi == mType * (Vb - Vd))))

    else:
        constraints.append(
            logical_or(logical_and(Vd <= Vs, Vdsi == mType * (Vd - Vs)),
                       logical_and(Vd > Vs, Vdsi == mType * (Vs - Vd))))
        constraints.append(
            logical_or(logical_and(Vd <= Vs, Vgsi == mType * (Vg - Vs)),
                       logical_and(Vd > Vs, Vgsi == mType * (Vg - Vd))))
        constraints.append(
            logical_or(logical_and(Vd <= Vs, Vbsi == mType * (Vb - Vs)),
                       logical_and(Vd > Vs, Vbsi == mType * (Vb - Vd))))

    Cofs = 0 * (0.345e-12 / etov) * dLg / 2.0 + Cof
    # s-terminal outer fringing cap [F/cm]
    Cofd = 0 * (0.345e-12 / etov) * dLg / 2.0 + Cof
    # d-terminal outer fringing cap [F/cm]
    Leff = Lgdr - dLg
    # Effective channel length [cm]. After subtracting overlap lengths on s and d side
    kB = 8.617e-5
    # Boltzmann constant [eV/K]
    phit = kB * Tjun
    # Thermal voltage, kT/q [V]
    me = (9.1e-31) * mc
    # Carrier mass [Kg]

    constraints.append(n == n0 + nd * Vdsi)
    constraints.append(nphit == n * phit)
    aphit = alpha * phit

    constraints.append(phibVbs == dabs(phib - Vbsi))
    constraints.append(Vtpcorr == Vt0 + gamma * (sqrt(phibVbs) - sqrt(phib)) -
                       Vdsi * delta)
    constraints.append(eVgpre == exp((Vgsi - Vtpcorr) / (aphit * 1.5)))
    constraints.append(FFpre == 1.0 / (1.0 + eVgpre))
    constraints.append(ab == 2 * (1 - 0.99 * FFpre) * phit)
    constraints.append(Vcorr == (1.0 + 2.0 * delta) * (ab / 2.0) *
                       (exp(-Vdsi / ab)))
    constraints.append(Vgscorr == Vgsi + Vcorr)
    constraints.append(Vbscorr == Vbsi + Vcorr)
    constraints.append(phibVbscorr == dabs(phib - Vbscorr))
    constraints.append(Vt0bs == Vt0 + gamma * (sqrt(phibVbscorr) - sqrt(phib)))
    constraints.append(phibVbsi == dabs(phib - Vbsi))
    constraints.append(Vt0bs0 == Vt0 + gamma * (sqrt(phibVbsi) - sqrt(phib)))
    constraints.append(Vtp == Vt0bs - Vdsi * delta - 0.5 * aphit)
    constraints.append(Vtp0 == Vt0bs0 - Vdsi * delta - 0.5 * aphit)
    constraints.append(eVg == exp((Vgscorr - Vtp) / (aphit)))
    constraints.append(FF == 1.0 / (1.0 + eVg))
    constraints.append(eVg0 == exp((Vgsi - Vtp0) / (aphit)))
    constraints.append(Qref == Cg * nphit)
    constraints.append(eta == (Vgscorr - (Vt0bs - Vdsi * delta - FF * aphit)) /
                       (nphit))
    constraints.append(Qinv_corr == Qref * log(1.0 + exp(eta)))
    vx0 = vxo
    Vdsats = vx0 * Leff / mu
    constraints.append(Vdsat == Vdsats * (1.0 - FF) + phit * FF)
    constraints.append(VdsiVdsat == Vdsi / Vdsat)
    constraints.append(powVal == pow(VdsiVdsat, beta))
    constraints.append(Fsat == VdsiVdsat / (pow((1 + powVal), (1.0 / beta))))
    if mType == 1:
        constraints.append(
            logical_or(
                logical_and(Vs <= Vd,
                            I == Qinv_corr * vx0 * Fsat * W * mType * shape),
                logical_and(
                    Vs > Vd,
                    I == Qinv_corr * vx0 * Fsat * W * mType * -1.0 * shape)))
    else:
        constraints.append(
            logical_or(
                logical_and(Vd <= Vs,
                            I == Qinv_corr * vx0 * Fsat * W * mType * shape),
                logical_and(
                    Vd > Vs,
                    I == Qinv_corr * vx0 * Fsat * W * mType * -1.0 * shape)))

    return constraints
Beispiel #4
0
 def objective(x1, x2):
     t1 = -1 * exp(-2 * log(2) * ((x1 - 0.1) / 0.8)**2) * (
         sin(5 * math.pi * x1)**6 + 0.1 * cos(500 * math.pi * x1)**2)
     t2 = -1 * exp(-2 * log(2) * ((x2 - 0.1) / 0.8)**2) * (
         sin(5 * math.pi * x2)**6 + 0.1 * cos(500 * math.pi * x2)**2)
     return t1 + t2