How to prevent ga-Solver from accepting the first best solution?

3 views (last 30 days)
Hello,
I got a problem with the ga-Solver in my problem based optimization. I want to optimize costs of charging electric vehicles by increasing the self-consumption rate of my rooftop PV and avoiding charging during times of high electricity prices. Therefore I devided a day in 15 minute time steps (96 in total). I got a total charging-demand that needs to be satisfied at the end of the day. I also got known timeslots, in which my car is allowed to charge with a maximum amount of power. The code works and finds a solution that satisfies my constraints, however, I can tell that this is not the optimal solution, since electricity prices during other times of the day are lower and I got PV-electricity that is injected into the grid, although it could be used by my car.
This is the output I receive:
Single objective optimization:
192 Variable(s)
96 Integer variable(s)
96 Nonlinear inequality constraint(s)
289 Linear inequality constraint(s)
Options:
CreationFcn: @gacreationuniformint
CrossoverFcn: @crossoverlaplace
SelectionFcn: @selectiontournament
MutationFcn: @mutationpower
Best Mean Stall
Generation Func-count Penalty Penalty Generations
1 2000 69.82 108.2 0
2 3000 69.82 106.7 1
3 4000 69.82 105.2 2
4 5000 69.82 103.9 3
5 6000 69.82 102.3 4
6 7000 69.82 100.6 5
7 8000 69.82 99 6
8 9000 69.82 96.68 7
9 10000 69.82 94.65 8
10 11000 69.82 92.6 9
11 12000 69.82 90.99 10
12 13000 69.82 89.18 11
13 14000 69.82 87.48 12
14 15000 69.82 85.95 13
15 16000 69.82 84.38 14
16 17000 69.82 83.05 15
17 18000 69.82 81.41 16
18 19000 69.82 80.4 17
... and so on. After 50 Generations it stops.
It seems to me that the solver immediately finds a solution space that satisfies all my constraints, but does not contain the optimal solution. I already increased the PopulationSize, changed the initial Points, but the result is always the same. The solution I get can be described as follows:
Beginning with the first 15-min timestep, the programm checks if the charging station is allowed to charge. If it can charge, it will. Then it procceeds with the next 15-min timestep. As soon as my charging demand for the regarding day is satisfied, it wont charge anymore. Everything that comes after is not important anymore.
Do you have any recommendation for me to solve my problem? Thanks in advance!

Answers (1)

Alan Weiss
Alan Weiss on 14 Apr 2023
Edited: Alan Weiss on 14 Apr 2023
It is possible that you unknowingly set some constraints that keep the solution you want from being considered. It is very hard to debug these large problems. Why not give a better solution as the initial point and see what happens? If the solver immediately moves away froom the better point, well, that tells you something interesting.
There is a slight chance that using a different mutation function would help:
MutationFcn=@mutationgaussian
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!