MILP 求解UC问题的缺点

本文探讨了使用混合整数线性规划(MILP)解决安全约束 Unit Commitment (UC) 问题所存在的不足。研究指出,MILP方法可能对问题的构建不够关注,特别是在确保解的可行性方面。
It should be noted that MILP-based approach is becoming a
mainstream method for solving SCUC problems based on commercial
MILP solvers [8], [17]–[19]. However, the LR-based
approaches are still useful in many cases. This is because to
apply MILP-based methods efficiently, one of the most important
issues is to convert the problem objective and constraints
into a good linear formulation. Therefore, many ancillary variables
and constraints must be introduced to handle minimum
up/down time constraints, variable start-up costs, nonlinear fuel
costs, etc. In some cases, the computation efficiency would be
a serious issue. The approximation error is another important
issue seldom discussed.
On the other hand, one can use a more
natural and concise formulation for the LR-based methods and

cares less on the problem formation.


引自:A Systematic Method for Constructing  Feasible Solution to SCUC Problem With Analytical Feasibility Conditions
Hongyu Wu, Xiaohong Guan, Fellow, IEEE, Qiaozhu Zhai, Member, IEEE, and Hongxing Ye

### 使用Python实现遗传算法求解MILP问题 为了使用遗传算法解决混合整数线性规划(MILP)问题,可以选择合适的库并编写相应的代码。以下是详细的说明: #### 推荐使用的库 - **DEAP (Distributed Evolutionary Algorithms in Python)** 是一个强大的进化算法框架,支持多种类型的进化算法,包括遗传算法[^1]。 - **PuLP** 可用于定义和求解线性和整数规划问题。虽然主要用于精确求解方法,但可以与启发式算法结合使用。 - **Pyomo** 提供了一个灵活的建模环境,能够方便地描述复杂的优化模型,并且可以通过接口调用不同的求解器。 对于本案例中的需求——即利用遗传算法处理 MILP 问题,则 DEAP 将是最合适的选择之一。 #### 实现思路 由于 MILP 的特殊性质,在应用遗传算法时需要注意编码方式以及适应度函数的设计。通常情况下,个体可以用二进制串或者实数值向量表示决策变量;而适应度则取决于目标函数值加上违反约束条件所造成的惩罚项。 下面给出一段基于 DEAP 库的简单示例代码片段来展示如何构建这样一个程序结构: ```python import random from deap import base, creator, tools, algorithms # 定义适合于最小化问题的目标函数类 creator.create("FitnessMin", base.Fitness, weights=(-1.0,)) creator.create("Individual", list, fitness=creator.FitnessMin) def eval_milp(individual): """评估给定个体的表现""" # 假设这里有一个外部函数 evaluate() 来计算实际的目标函数值, # 并返回该值作为适应度分数 obj_value = sum(individual) * some_coefficients # 替换成真实的表达式 penalty = calculate_penalty(individual) # 计算违背约束产生的罚分 return obj_value + penalty, toolbox = base.Toolbox() # 初始化种群成员的方法 toolbox.register("attr_bool", random.randint, 0, 1) toolbox.register("individual", tools.initRepeat, creator.Individual, toolbox.attr_bool, n=len(variables)) # 创建整个种群 toolbox.register("population", tools.initRepeat, list, toolbox.individual) # 注册交叉操作符 toolbox.register("mate", tools.cxTwoPoint) # 注册变异操作符 toolbox.register("mutate", tools.mutFlipBit, indpb=0.05) # 设置选择机制为锦标赛选择法 toolbox.register("select", tools.selTournament, tournsize=3) # 配置评价标准 toolbox.register("evaluate", eval_milp) if __name__ == "__main__": pop = toolbox.population(n=300) hof = tools.HallOfFame(1) stats = tools.Statistics(lambda ind: ind.fitness.values) stats.register("avg", numpy.mean) stats.register("std", numpy.std) stats.register("min", numpy.min) stats.register("max", numpy.max) result_population, logbook = algorithms.eaSimple(population=pop, toolbox=toolbox, cxpb=0.7, mutpb=0.2, ngen=40, halloffame=hof, verbose=True, stats=stats) ``` 此段代码展示了基本框架,具体细节还需要根据实际情况调整参数设置、自定义适应度计算逻辑等内容。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值