(非线性规划Python)计及动态约束及节能减排环保要求的经济调度

本文通过Python的Scipy库中的minimize函数解决了一个节能减排背景下的动态经济调度问题,涉及目标函数、等式和不等式约束,展示了如何使用非线性规划求解电力系统的机组调度问题以满足环保要求。
摘要由CSDN通过智能技术生成

#(3.20) ineq

def con21(x):

return x[3]-x[0]-(-50)

def con22(x):

return x[4]-x[1]-(-60)

def con23(x):

return x[5]-x[2]-(-150)

#(3.21)ineq

#(3.22)ineq:第一台机组第一个小时不超过70t

def con31(x):

return 70-(4+0.3x[0]+0.0007x[0]*x[0])

#(3.23)ineq:所有机组两小时内排放SO2量不超过8t

def con41(x):

return 8-(0.02*(4+0.3x[0]+0.0007x[0]x[0]+4+0.3x[3]+0.0007*x[3]*x[3])+

0.015*(3+0.32x[1]+0.0004x[1]x[1]+3+0.32x[4]+0.0004*x[4]*x[4])+ #机组2

0.01*(3.5+0.3x[2]+0.00045x[2]x[2])+3.5+0.3x[5]+0.00045*x[5]*x[5]) #机组3

#(3.23)ineq:所有机组两小时内排放SO2量大于0t

def con42(x):

return 0.02*(4+0.3x[0]+0.0007x[0]x[0]+4+0.3x[3]+0.0007*x[3]*x[3])+\

0.015*(3+0.32x[1]+0.0004x[1]x[1]+3+0.32x[4]+0.0004*x[4]*x[4])+\

0.01*(3.5+0.3x[2]+0.00045x[2]x[2])+3.5+0.3x[5]+0.00045*x[5]*x[5]

#(3.24)

def main():

con1={‘type’:‘eq’,‘fun’:con11}

con2= {‘type’: ‘eq’, ‘fun’: con12}

con3= {‘type’: ‘ineq’, ‘fun’: con21}

con4= {‘type’: ‘ineq’, ‘fun’: con22}

con5= {‘type’: ‘ineq’, ‘fun’: con23}

con6= {‘type’: ‘ineq’, ‘fun’: con31}

con7= {‘type’: ‘ineq’, ‘fun’: con41}

con8= {‘type’: ‘ineq’, ‘fun’: con42}

cons=([con1,con2,con3,con4,con5,con6,con7,con8])

x0=np.random.uniform(120,250,6) #初值

res=minimize(fun,x0,method=‘SLSQP’,bounds=bunds,constraints=cons)

print(‘--------’)

print(‘第一种表述:’)

print(‘minf(x):’,res.fun)

print(res.success)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值