admin管理员组

文章数量:1134246

It is Electric bus scheduling problem that have vehicle flow constraints and charging constraints. I have use Genetic Algorithm solver in Matlab for solving the electric bus scheduling problem (MILP), but it is not taking the charging constraints and generating the result without these constraints, how to deal with this problem? here x_1 used for bus if leave to the depot and z used if charger used and q used amount of charge after trip i.

% Objective: Minimize the number of buses used Busschedulling_A.Objective = sum(x_1)*1000+ sum(z)*100;

constraint like

for j = 1:numTrips Busschedulling_A.Constraints.(['coverTrip_1_' num2str(j)]) = x_1(j) + sum(x(:, j)) == 1; end

for i = 1:numel(Source_values) for j = 1:numel(Destination_values)

    sum_term = 0;
    for n = 1:18
        for p = 1:1

            exampleKey_3 = sprintf('%s,%s', Destination_values{i}, Source_values{j});

            dist_3 = Dist_M(exampleKey_3);
            sum_term = sum_term + q(i, n, p) * (c_charging(n) * 1.55);
        end

    end

    % Define constraint
    Busschedulling_A.Constraints.(['energy_A_i' num2str(i) '_j' num2str(j)]) = E(j) <= E(i) - dist_3 + sum_term ;
end

end

% Solver options options = optimoptions('ga', ... 'Display', 'iter', ... % Display iteration details 'PlotFcn', 'gaplotbestf', ... % Plot GA progress 'MaxTime', 5000, ... % Maximum runtime in seconds 'PopulationSize', 100, ... % GA population size 'CrossoverFraction', 0.8); % Fraction for crossover

% Solve the optimization problem [sol, fval, exitflag, output] = solve(Busschedulling_A, 'Solver', 'ga', 'Options', options);

本文标签: electric bus scheduling with Genetic Algorithm Solver in MatlabStack Overflow