Spacecraft trajectory optimization with GA in Matlab (on/off constant thrust)

Hello.
I would like to kindly ask for support or any advice on how to implement my problem in Matlab, perhaps using the (Global) Optimization Toolbox, and whether it is even possible.
My goal is to find a time-history of control (σ,) during a fuel-optimal spacecraft rendezous with constant low-thrust.
Problem description:
The control variables are defined as:
  • σ - total thrust acceleration
  • - thrust acceleration projections
And the state vector is:
The objective is to minimise:
subject to:
  • The state equations in state-space representation (CW equations):
  • Control variables constraint: and σ can be equal to either 0 or (on/off)
  • Initial conditions: given
  • Terminal constraints: given
  • Final time inequality constraint:
As I understand, this problem can be categorised as a dynamical optimization problem, that involves integer programming. Could it be solved in Matlab, perhaps using the Genetic Algorithms which I believe allow for integer programming?
Are there any available examples on how to implement a spacecraft (or not necessarily spacecraft) trajectory optimization problem in Matlab, using GA? I have been looking for examples for a very long time, but I could not find any. In fact, I could not find any examples even without the on/off thursting constraints, and I would be grateful if anyone could direct me to other spacecraft trajectory optimization implementations in Matlab, perhaps using the fmincon function.
Thank you very much.

4 commentaires

I'm not a space engineer, but I wonder if the thrusters can only fire ON/OFF to propel in the positive directions of x, y, z axes, how does the spacecraft brake in when it approaches another space vehicles to a very close distance?
x = linspace(-1, 1, 2001);
y = (sign(x) + 1)/2;
plot(x, y, 'linewidth', 1.5), grid on, ylim([-0.5 1.5])
The reason why I introduced sigma, ux, uy, uz is because I want to use a one-directional thruster that can produce constant level(s) of thrust, i.e., 0 of Tmax, while ux, uy and uz (thrust acceleration projections) will carry information about the thrust vector direction. Alternatively, I could use sigma and two angles as control variables.
I have not researched the breaking procedures during rendezvous with low-thrust, because I am actually working on a slightly different problem than rendezvous, but I thought to intoroduce it as a rendezvous problem here because it is considered a standard problem.
Kindly let me know if you have any thoughts on how I could implement this optimization problem in MATLAB.
Thank you.
I'm looking deeper into your problem. Do you expect GA to return a constant integer value for sigma σ from to using the following command?
sigma = ga(fun, nvars, A, b, Aeq, beq, lb, ub, nonlcon, intcon, options)
I'm just testing on the dynamics, and I want to see what objective function would I choose if I want to optimize the trajectory in terms of fastest arrival time, minimum error, minimum effort, subject to the constraint:
[t, x] = ode45(@system, [0 10], [0.9; 0.6; 0.3; 0; 0; 0]);
plot(t, x(:,1:3), 'linewidth', 1.5)
grid on, xlabel('t'), ylabel('y(t)'), % ylim([-0.2 1.2])
function dxdt = system(t, x)
dxdt = zeros(6, 1);
% parameters
xf = 0.6; % final x-position
yf = 0.3; % final y-position
zf = 0.9; % final z-position
n = 1;
sigma = 1;
ux = - 2*x(4) - (x(1) - xf) - (2*n*x(5) + 3*(n^2)*x(1));
uy = - 2*x(5) - (x(2) - yf) - (-2*n*x(4));
uz = - 2*x(6) - (x(3) - zf) - (-(n^2)*x(3));
% the dynamics
dxdt(1) = x(4);
dxdt(2) = x(5);
dxdt(3) = x(6);
dxdt(4) = 2*n*x(5) + 3*(n^2)*x(1) + sigma*ux;
dxdt(5) = -2*n*x(4) + sigma*uy;
dxdt(6) = -(n^2)*x(3) + sigma*uz;
end

Connectez-vous pour commenter.

Réponses (1)

You might be interested in this example: Discretized Optimal Trajectory, Problem-Based. The problem formulation is different than yours, so it is probably not directly applicable, but you might be able to make it work for you. One thing to note: I recently found out that this sort of optimal trajectory problem works better when you lower the optimality tolerance, as described here: https://www.mathworks.com/matlabcentral/answers/1774135-possible-bug-with-coneprog.
Alan Weiss
MATLAB mathematical toolbox documentation

10 commentaires

Alan,
Thank you very much for your reply.
You also recently replied in another thread saying that "The only three solvers that handle integer constraints are intlinprog, which requires a linear objective function and linear constraints, and ga and surrogateopt, which are part of Global Optimization Toolbox, and allow nonlinear objectives and constraints."
Would you kindly recommed any examples on how to use any of these solvers for trajectory optimization? I am interested in GA in particular.
Cheers.
I don't think that it is a good idea to use integer constraints. I think that you should relax your problem to continuous variables and let the bang-bang solution appear as a result of optimizing, which will leave you with an integer-feasible solution.
As for which solver to use, I think that coneprog is most likely to be satisfactory. Trajectory optimization problems are numerically touchy. I have found that using fmincon can take an inordinate number of iterations, and coneprog is often more efficient.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Alan,
In my understanding, if I do not impose integer constraints on my control variable, and leave it as continuous, then the solution won't necessarily be a bang-bang solution. In fact, it would most likely be a continous solution. Am I wrong?
I generally find it very strange that I can not find a single example of a trajectory optimization problem using GA in MATLAB. I feel like I have searched all over the internet (MATLAB answers, GitHub, Google). On the other hand, there are many examples of "static problems" available (finding a minimum to some complex mathematical function with several optimization variables).
Could you kindly let me know if you are aware of any examples, regardless of the type of constraints, even if the variables are assumed to be continuous? Not necessarily spacecraft trajectory optimization, could be train/plane/robot/etc trajectory oprimization.
Thank you!
Yakov Bobrov
Yakov Bobrov le 23 Août 2022
Modifié(e) : Yakov Bobrov le 23 Août 2022
Could it be that this type of problems can not be solved using ga in MATLAB?
  • My optimization variables are [σ, , , ]
  • Continuous thrust, thus I perform transcription by selecting the number of segments, i.e., N = 20
  • GA makes an initial guess, propagates the orbit (by integrating ODEs), evaluates the fitness function, generates a new population, propagates, evaluates the fitness, and so on until it stops when it thinks that the most optimal solution has been found:
[,,,; ,,,,...,,,,]
Feel free to do what you want, try solving the problem using ga. Yes, ga can in principle handle problems with integer and nonlinear constraints and an arbitrary objective function.
I am merely stating that I believe you will likely obtain better results by not using ga, and instead trying to use a derivative-based solver. But this is just my opinion, feel free to do what you want.
Alan Weiss
MATLAB mathematical toolbox documentation
The problem is that I do not understand how to implement this in MATLAB. Could you kindly advise, are there any examples that MATLAB provides for solving trajectory optimization problems using GA? Thank you.
Just off the top of my head, I guess that you could define times and so that the thrust is on for and for and is off for . Define the 3-D angle that the thrust makes at interval j as a constant for that interval. Integrate the equations of motion using Newton's laws. Make and variables of optimization as well as the angles in the intervals j. Make sure that . The discretized optimal trajectory example shows what I mean in terms of integrating the equations of motion, and gives some ideas for satisfying constraints.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Yakov Bobrov
Yakov Bobrov le 25 Août 2022
Modifié(e) : Yakov Bobrov le 25 Août 2022
Alan,
Thank you a lot for your advice. So, I understand that you suggested to assume the following structure: ON-OFF-ON, and choose and as variables of integration. Then I would integrate my equations of motion over these intervals using an ode45 function, and include the state error into the fitness function. (Please correct me if I am wrong anywhere).
But how do I then split each of these three intervals (0, , T) further into N smaller intervals of length j, such that at each of the intervals the thrust angles (θ and ψ) may take any of the values in the range [0, 360deg]? Also, how do I define the accuracy to which GA would be choosing the angle values (0.5deg, 1deg)?
If N = 10, then would I have the following optimization variables in my problem?
  • + 10*3*2 = 60 variables (θ and ψ at each N = 1,2,..,10 of each time interval)
In total, 62 optimization variables?
Also, could you please explain, is there a way to leave T constrained to Tmin<T<Tmax, but not to strictly define it?
Can you test if the GA is capable of producing a result for a simple system that is similar to Hohmann maneuver?
If it works, perhaps the code can be modified to solve your case.
Hi Sam, in the Hohmann transfer, two impulsive maneuvers are performed, while I am trying to model continuous thrust. There is literature available where this was done, but I am tyring to understand how to implement it.

Connectez-vous pour commenter.

Catégories

Question posée :

le 20 Août 2022

Commenté :

le 25 Août 2022

Community Treasure Hunt

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

Start Hunting!

Translated by