MATLAB Answers

GA optimization within constraints

3 views (last 30 days)
Hi there,
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):
Battery_size=[5 50];
Battery_number=[5 40];
Battery_cost=[100 500];
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
FitFnc=Profit+Average-resilience+Carbon_emissions_reduction;
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
Nikolas

  0 Comments

Sign in to comment.

Accepted Answer

Abhisek Pradhan
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.

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags


Translated by