How to enter a matrix of variables within the linear equality function in genetic algorithm ?

1 view (last 30 days)
My linear equality function is as shown below:
A*b*A' - c = 0
In my current problem:
A is a 1 by 4 matrix
b is a 4 by 4 matrix
c is just a constant
and A*b*A' would return a number that is equal to c
I want it to work in such a way that the genetic algorithm does not change any values in 'b' because b in my problem(resistance of lines) should remain a constant.
whereas i want the algorithm to make changes in A where A is subject to certain bounds.
I have been able to solve the question by expanding A*b*A', ie do the matrix multiplications on paper with A having variables x(4),x(5),x(6),x(7)
(x(4)*x(4)*(5.697)+x(4)*x(5)*(-1.91)+x(4)*x(6)*(-2.01)+x(4)*x(7)*(-1.77)+x(4)*x(5)*(-1.91)+x(5)*x(5)*(5.3801)+x(5)*x(6)*(-3.47)+x(4)*x(6)*(-2.01)+x(5)*x(6)*(-3.47)+x(6)*x(6)*(8.31)+x(6)*x(7)*(-2.8)+x(4)*x(7)*(-1.77)+x(6)*x(7)*(-2.8)+x(7)*x(7)*(4.6)) - c
but then the expanded version looks like this
I would like to mention that i do have initial values for x(4),x(5),x(6),x(7)
I want to tweak the variables in A keeping b as a constant while fulfilling the equality function where the variables in A are subject to upper and lower bounds
Help is very much appreciated, Thanks!

Answers (1)

Alan Weiss
Alan Weiss on 15 Apr 2019
You should not use a genetic algorithm to solve this equation. Instead, use lsqnonlin, which accepts bound constraints.
Alan Weiss
MATLAB mathematical toolbox documentation

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!