【粉丝免费】基于粒子群算法和雾凇算法求解发电机经济负荷调度优化问题,最低成本 含机组输出功率附Matlab代码

% 电力系统参数
num_generators = 5; % 发电机数量
load_demand = 1000; % 负荷需求(MW)

% 发电机参数
generator_capacity = [200, 300, 250, 150, 200]; % 发电机容量(MW)
generator_cost = [10, 12, 11, 9, 10]; % 发电机成本($/MWh)

% 粒子群算法参数
num_particles = 50; % 粒子数量
max_iter = 100; % 最大迭代次数
w = 0.5; % 惯性权重
c1 = 1; % 个体学习因子
c2 = 1; % 社会学习因子

% 初始化粒子群
positions = zeros(num_particles, num_generators);
velocities = zeros(num_particles, num_generators);
pbest_positions = positions;
pbest_costs = inf(1, num_particles);
gbest_position = zeros(1, num_generators);
gbest_cost = inf;

% 开始迭代
for iter = 1:max_iter
% 更新速度和位置
for i = 1:num_particles
% 更新速度
velocities(i, 😃 = w * velocities(i, 😃 …
+ c1 * rand() * (pbest_positions(i, 😃 - positions(i, 😃) …
+ c2 * rand() * (gbest_position - positions(i, 😃);

    % 更新位置
    positions(i, :) = positions(i, :) + velocities(i, :);
    
    % 限制位置在发电机容量范围内
    positions(i, :) = max(0, min(positions(i, :), generator_capacity));
end

% 计算适应度值并更新个体最优和全局最优
for i = 1:num_particles
    % 计算发电成本
    generator_output = positions(i, :);
    total_cost = sum(generator_cost .* generator_output);
    
    % 更新个体最优
    if total_cost < pbest_costs(i)
        pbest_costs(i) = total_cost;
        pbest_positions(i, :) = positions(i, :);
    end
    
    % 更新全局最优
    if total_cost < gbest_cost
        gbest_cost = total_cost;
        gbest_position = positions(i, :);
    end
end

% 输出当前迭代的最低成本
disp(['Iteration: ', num2str(iter), ', Lowest Cost: ', num2str(gbest_cost)]);

end

% 输出最佳解
disp(‘Best Generator Outputs:’);
disp(gbest_position);
disp(‘Total Cost:’);
disp(gbest_cost);

  • 15
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

天天酷科研

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值