How to optimize trajectory of bipedal robot using Genetic algorithm
2 次查看(过去 30 天)
显示 更早的评论
I am trying to optimize the trjaectory of bipedal robot by minimizing the energy consumed. I want to find the suitable hip-height and maximum height swing leg can take. My fitness function is energy consumed plus some penalty for constraint voilation.
In matlab example , the variable that needs to be optimized directly comes in fitness function. But in my case the variable which i want to optimize donot appear in fitness function but they affect the fitness function. Energy consumed is calculated by solving the dynamic equation which is influed by hip hieght and height taken by swing leg.
In such case how do i apply genetic algorithm where the variable directly do not comes in fitness function but they infulence it.
its like,, i want to find optimum x1 and x2 which minimizes f = z1+z2 , where z1 and z2 are also related to x1 and x2 but in very compicated way.
thank you.
0 个评论
回答(1 个)
Walter Roberson
2021-8-9
function cost = energy(x)
x1 = x(1); x2 = x(2);
cost = z1(x1, x2) + z2(x1, x2);
end
ga() does not care how complicated z1 and z2 are. It does not care if, for example,
function z1cost = z1(hip,swing)
tspan = linspace(0, 20, 3); %not a vector of length 2!
boundary = [0 0];
[t, y] = ode45(@(t,y) z1ode(t, y, hip, swing), tspan, boundary);
z1cost = y(end,1);
end
It does not care if there is a direct formula involving the inputs: it only cares that there is a deterministic calculation in which they are the inputs and there is a scalar output.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genetic Algorithm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!