- “fmincon”: https://www.mathworks.com/help/optim/ug/fmincon.html
- “Optimization Options”: https://www.mathworks.com/help/optim/ug/optimization-options-reference.html
trying to use fmincon to constrain results to a particular surface, results get stuck at a corner
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
We are trying to creat a system that can select objects a person is looking at in a room based on user head position and orientation. We decided to include a Duble Kalman filter, this should output a smootend version of the user's head position (q) and the point on the wall where the user's gaze falls (x).
The kaman filter doesn't know where the walls are, one of my supervisors found a paper that suggests using the fmincon function to constrain x to the walls of the room. For some reason the fmincon function keeps sending x to the corners of the room, green objects in the figure below, the red represents q.
0 commentaires
Réponses (1)
Varun
le 23 Jan 2024
Hi Ahmed,
It appears that you are using “fmincon” function in your implementation to solve a constrained optimization problem where the objective is to minimize the weighted squared distance (x - x_upd)'*W*(x - x_upd). But you are facing an issue with “fmincon” sending “x” to the corners of the room.
To workaround this, you can try experimenting with different optimization options for “fmincon”. You can set these options using the “optimoptions” function in MATLAB. For example, try different algorithms like “sqp” or “interior-point”.
Please refer to the following code snippet:
options = optimoptions('fmincon', 'Display', 'iter', ...
'Algorithm', 'sqp', ...
'PlotFcn', {@optimplotx, @optimplotfval, @optimplotconstrviolation});
x_upd_constrained = fmincon(@fun, x_upd, A, b, Aeq, beq, lb, ub, [], options);
You can also try to improve the initial guess to “fmincon” for e.g., setting the initial guess that is more centrally located within the room rather than near the corners.
Please refer to the following documentations to learn more:
Hope it helps.
Voir également
Catégories
En savoir plus sur Optimization dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!