Пример #1
0
nosh.config.LBH=True
nosh.config.BINO=True
nosh.config.svl =0.001

nosh.config.samples = 3000
nosh.config.elites  = 300 
nosh.config.smoother = 0.7

#mymeth = ('OBSA/CR','EMSR/CR','EMSR/NV', 'CRSA/NV', 'DP/LBH', 'EMSR/SL')
mymeth = ('DP/LBH', 'EMSR/NV', 'EMSR/SL', 'HCR/OSA', 'HAR/OSA')

def scenas(scen, ps):
	for C in ps:
		newscen = copy(scen)
		newscen.C = newscen.nid = C 
		print "## LOAD Factor:", newscen.demandFactor()
		yield newscen

from ORinstance3 import sina as osin
sina = nosh.NormalScena(osin)

pickle = 'df3normal.pkl'
gld = [s for s in scenas(sina, range(100, 201, 10))]
nosh.enuSim(gld, 10000, pickle, mymeth)
DISP = 'ORdf3normal'
xlab = 'total number of seats'
nosh.drawSubFigs(DISP, xlab, *nosh.loadResults(pickle))
nosh.drawFigs(DISP, xlab, *nosh.loadResults(pickle))
nosh.drawPolicies(DISP,xlab,*nosh.loadPolicies(pickle))
if DISP is None: pylab.show()
Пример #2
0
sina.beta = 0.0
sina.p = (0.1, 0.1)
sina.f = (1050., 767., 527., 350.)
sina.V = 1500.0
#vin = 5.0
#sina.f[0]*(1+sina.p[1]*sina.beta/(1-sina.p[1]))*vin
#sina.L = (50.,85.)
#sina.U = (70.,115.)
print "Demand Factor: ", sina.demandFactor(), "V=", sina.V

sinb = copy(sina)
sinb.V = 6000.
#sinb.L = (0., 5.,  13., 0.)
#sinb.U = (34.,85., 133.,40.)
#sinb.L = (20.,40.)
#sinb.U = (100.,160.)
print "Demand Factor: ", sinb.demandFactor()

sina.nid = 1500.
sinb.nid = 6000.
xlab = 'unit denial cost'

#nosh.glidePrint(sina,sinb,0,7,6.0)
pickle = 'dist-denialcost.pkl'
nosh.glideSim(sina, sinb, 0, 11, 10.0, 10000, xlab, pickle, mymeth)

DISP = None #'dist-inaccDmd'
nosh.drawFigs(DISP, xlab, *nosh.loadResults(pickle))
nosh.drawPolicies(DISP,xlab,*nosh.loadPolicies('policies-'+pickle))
if DISP is None: pylab.show()