GA optimization within constraints
2 views (last 30 days)
Nikolas Spiliopoulos on 9 Oct 2019
I am trying to use GA for my first time, so I am a bit confused.
I have seen some simple example where you define a function with x(1), x(2) etc. and then you call it to find the minimum.
However, my problem is a bit complex and I am confused how to use GA. Here is a brief summary of my problem
A) First of all I have these input parameters (within limits):
B) I have already created a script file that uses the values from the aforementioned inputs and giving results.
C) The fitness function seems to be something calculated in the script for the given inputs:
Profit=(Battery_size*Battery_cost)-(Benefits*365*10); %calculated in the script
Average_resilience %calculated in the script
Carbon_emissions_reduction % calculated in the script
So I would like to maximize the FitFnC
The question is:
A) Where do I put the input parameters , from where the algorithm will draw values?
B) The command which call GA, will be used inside the code after the parameters of FitFnc are calculated?
I hope the question is clear,
thanks in advance
Abhisek Pradhan on 16 Oct 2019
Maximization can be achieved by multiplying the desired function with -1 and then using the minimization approach using Genetic Algorithm.
As Genetic algorithm takes function handles for the fitness function and constraint function. so create function handles for both the functions as inputs to the algorithm.
The following link illustrates constrained minimization using the Genetic algorithm.