Problem using Genetic algorithm in toolbox

How to specify your own penalty function while using optimization tool box for genetic algorithm??

2 Comments

A penalty function would be part of the objective function you are trying to minimize. Without more information, there is little one could do to elaborate more.
My objective function is
function f = objecfunn(x)
syms t
f = (700/x(1))*((((140/2)^x(1))*(1/factorial(x(1))))/(symsum(((140/2)^t)*1/factorial(t),t,0,x(1))))+(2100/x(2))*((((140/2)^x(2))*(1/factorial(x(2))))/(symsum(((140/2)^t)*1/factorial(t),t,0,x(2))))+ 100*(x-400);
Subject to :
x(1) + 4*x(2) <= 800
((((140/2)^x(1))*(1/factorial(x(1))))/(symsum(((140/2)^t)*1/factorial(t),t,0,x(1)))) <= .6
((((140/2)^x(2))*(1/factorial(x(2))))/(symsum(((140/2)^t)*1/factorial(t),t,0,x(2)))) <= .6
x(1) , x(2) are integers
So it would be very helpful if you can answer these questions
1. Is it possible to use toolbox to solve this problem??
2. If yes then how to incorporate these constraints, i know we can write in space for non linear constraint given in toolbox but then how to change penalty function as x(1) >= 800 and x(2) >= 200 is not possible and so if i include a penalty function 100*(x(1)-800)+100*(x(2)-200),then using if statement should i add this term in objective function?
Please do reply, Thanking you in advance!

Sign in to comment.

Answers (0)

Asked:

on 21 Sep 2017

Edited:

on 21 Sep 2017

Community Treasure Hunt

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

Start Hunting!