Nonlinear optimization of a matrix with the costraint to be orthonormal











up vote
1
down vote

favorite












I'm trying to find the matrix x which minimize the following cost function :



$J =||B_b -x*B_n||^2$



with the constraint that x has to be an orthonormal matrix.
I'm trying to use MATLAB fmincon tool, but I'm kind of stucked in how to pose the problem to the solver. What I did up until now is writing an objective function like this :



function f=objfun(x)

B_b = [8.53086963374351e-06,-1.56083520340848e-06,2.62167147268028e-05];
B_n = [-8.53086963374351e-06,1.56083520340848e-06,2.62167147268028e-05];

f = (norm(B_b' - x*B_n'))^2; % Cost function


The costraints can be expressed as :



$det(x) = 1$



$trace(I-x'x) = 0 $



Where I is the identity matrix.
But I don't get how to write them for MATLAB's fmincon.



Can someone help me to realize what I'm doing wrong in posing the problem to MATLAB and how I can express the costraint to solve this costrained problem ?










share|cite|improve this question







New contributor




Francescodario Cuzzocrea is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • fmincon works on vectors, so have your function transform the vector to a matrix (reshape) as the first step in evaluating the function values
    – LinAlg
    Dec 1 at 14:06










  • You can add the constraint into cost function instead of using a solver that can handle constraints. Just add norm(x'*x-I)^2 or something like it.
    – mathreadler
    Dec 1 at 14:22












  • @LinAlg if fmincon works on vectors, why I have to reshape the vector into a matrix ?
    – Francescodario Cuzzocrea
    Dec 1 at 14:41










  • @mathreadler you mean to add norm(x'*x-eye(3))^2 == 0; det(x) == 1; before defining f ?
    – Francescodario Cuzzocrea
    Dec 1 at 14:43










  • No binary comparisons. Just +norm(x'$*$x-eye(3))^2 . It will behave better with any calculus based solver and probably other solvers also. Maybe you need 1e3$*$ in front of also.
    – mathreadler
    Dec 1 at 17:04

















up vote
1
down vote

favorite












I'm trying to find the matrix x which minimize the following cost function :



$J =||B_b -x*B_n||^2$



with the constraint that x has to be an orthonormal matrix.
I'm trying to use MATLAB fmincon tool, but I'm kind of stucked in how to pose the problem to the solver. What I did up until now is writing an objective function like this :



function f=objfun(x)

B_b = [8.53086963374351e-06,-1.56083520340848e-06,2.62167147268028e-05];
B_n = [-8.53086963374351e-06,1.56083520340848e-06,2.62167147268028e-05];

f = (norm(B_b' - x*B_n'))^2; % Cost function


The costraints can be expressed as :



$det(x) = 1$



$trace(I-x'x) = 0 $



Where I is the identity matrix.
But I don't get how to write them for MATLAB's fmincon.



Can someone help me to realize what I'm doing wrong in posing the problem to MATLAB and how I can express the costraint to solve this costrained problem ?










share|cite|improve this question







New contributor




Francescodario Cuzzocrea is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • fmincon works on vectors, so have your function transform the vector to a matrix (reshape) as the first step in evaluating the function values
    – LinAlg
    Dec 1 at 14:06










  • You can add the constraint into cost function instead of using a solver that can handle constraints. Just add norm(x'*x-I)^2 or something like it.
    – mathreadler
    Dec 1 at 14:22












  • @LinAlg if fmincon works on vectors, why I have to reshape the vector into a matrix ?
    – Francescodario Cuzzocrea
    Dec 1 at 14:41










  • @mathreadler you mean to add norm(x'*x-eye(3))^2 == 0; det(x) == 1; before defining f ?
    – Francescodario Cuzzocrea
    Dec 1 at 14:43










  • No binary comparisons. Just +norm(x'$*$x-eye(3))^2 . It will behave better with any calculus based solver and probably other solvers also. Maybe you need 1e3$*$ in front of also.
    – mathreadler
    Dec 1 at 17:04















up vote
1
down vote

favorite









up vote
1
down vote

favorite











I'm trying to find the matrix x which minimize the following cost function :



$J =||B_b -x*B_n||^2$



with the constraint that x has to be an orthonormal matrix.
I'm trying to use MATLAB fmincon tool, but I'm kind of stucked in how to pose the problem to the solver. What I did up until now is writing an objective function like this :



function f=objfun(x)

B_b = [8.53086963374351e-06,-1.56083520340848e-06,2.62167147268028e-05];
B_n = [-8.53086963374351e-06,1.56083520340848e-06,2.62167147268028e-05];

f = (norm(B_b' - x*B_n'))^2; % Cost function


The costraints can be expressed as :



$det(x) = 1$



$trace(I-x'x) = 0 $



Where I is the identity matrix.
But I don't get how to write them for MATLAB's fmincon.



Can someone help me to realize what I'm doing wrong in posing the problem to MATLAB and how I can express the costraint to solve this costrained problem ?










share|cite|improve this question







New contributor




Francescodario Cuzzocrea is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I'm trying to find the matrix x which minimize the following cost function :



$J =||B_b -x*B_n||^2$



with the constraint that x has to be an orthonormal matrix.
I'm trying to use MATLAB fmincon tool, but I'm kind of stucked in how to pose the problem to the solver. What I did up until now is writing an objective function like this :



function f=objfun(x)

B_b = [8.53086963374351e-06,-1.56083520340848e-06,2.62167147268028e-05];
B_n = [-8.53086963374351e-06,1.56083520340848e-06,2.62167147268028e-05];

f = (norm(B_b' - x*B_n'))^2; % Cost function


The costraints can be expressed as :



$det(x) = 1$



$trace(I-x'x) = 0 $



Where I is the identity matrix.
But I don't get how to write them for MATLAB's fmincon.



Can someone help me to realize what I'm doing wrong in posing the problem to MATLAB and how I can express the costraint to solve this costrained problem ?







optimization convex-optimization matlab nonlinear-optimization numerical-optimization






share|cite|improve this question







New contributor




Francescodario Cuzzocrea is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|cite|improve this question







New contributor




Francescodario Cuzzocrea is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|cite|improve this question




share|cite|improve this question






New contributor




Francescodario Cuzzocrea is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Dec 1 at 12:37









Francescodario Cuzzocrea

61




61




New contributor




Francescodario Cuzzocrea is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Francescodario Cuzzocrea is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Francescodario Cuzzocrea is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • fmincon works on vectors, so have your function transform the vector to a matrix (reshape) as the first step in evaluating the function values
    – LinAlg
    Dec 1 at 14:06










  • You can add the constraint into cost function instead of using a solver that can handle constraints. Just add norm(x'*x-I)^2 or something like it.
    – mathreadler
    Dec 1 at 14:22












  • @LinAlg if fmincon works on vectors, why I have to reshape the vector into a matrix ?
    – Francescodario Cuzzocrea
    Dec 1 at 14:41










  • @mathreadler you mean to add norm(x'*x-eye(3))^2 == 0; det(x) == 1; before defining f ?
    – Francescodario Cuzzocrea
    Dec 1 at 14:43










  • No binary comparisons. Just +norm(x'$*$x-eye(3))^2 . It will behave better with any calculus based solver and probably other solvers also. Maybe you need 1e3$*$ in front of also.
    – mathreadler
    Dec 1 at 17:04




















  • fmincon works on vectors, so have your function transform the vector to a matrix (reshape) as the first step in evaluating the function values
    – LinAlg
    Dec 1 at 14:06










  • You can add the constraint into cost function instead of using a solver that can handle constraints. Just add norm(x'*x-I)^2 or something like it.
    – mathreadler
    Dec 1 at 14:22












  • @LinAlg if fmincon works on vectors, why I have to reshape the vector into a matrix ?
    – Francescodario Cuzzocrea
    Dec 1 at 14:41










  • @mathreadler you mean to add norm(x'*x-eye(3))^2 == 0; det(x) == 1; before defining f ?
    – Francescodario Cuzzocrea
    Dec 1 at 14:43










  • No binary comparisons. Just +norm(x'$*$x-eye(3))^2 . It will behave better with any calculus based solver and probably other solvers also. Maybe you need 1e3$*$ in front of also.
    – mathreadler
    Dec 1 at 17:04


















fmincon works on vectors, so have your function transform the vector to a matrix (reshape) as the first step in evaluating the function values
– LinAlg
Dec 1 at 14:06




fmincon works on vectors, so have your function transform the vector to a matrix (reshape) as the first step in evaluating the function values
– LinAlg
Dec 1 at 14:06












You can add the constraint into cost function instead of using a solver that can handle constraints. Just add norm(x'*x-I)^2 or something like it.
– mathreadler
Dec 1 at 14:22






You can add the constraint into cost function instead of using a solver that can handle constraints. Just add norm(x'*x-I)^2 or something like it.
– mathreadler
Dec 1 at 14:22














@LinAlg if fmincon works on vectors, why I have to reshape the vector into a matrix ?
– Francescodario Cuzzocrea
Dec 1 at 14:41




@LinAlg if fmincon works on vectors, why I have to reshape the vector into a matrix ?
– Francescodario Cuzzocrea
Dec 1 at 14:41












@mathreadler you mean to add norm(x'*x-eye(3))^2 == 0; det(x) == 1; before defining f ?
– Francescodario Cuzzocrea
Dec 1 at 14:43




@mathreadler you mean to add norm(x'*x-eye(3))^2 == 0; det(x) == 1; before defining f ?
– Francescodario Cuzzocrea
Dec 1 at 14:43












No binary comparisons. Just +norm(x'$*$x-eye(3))^2 . It will behave better with any calculus based solver and probably other solvers also. Maybe you need 1e3$*$ in front of also.
– mathreadler
Dec 1 at 17:04






No binary comparisons. Just +norm(x'$*$x-eye(3))^2 . It will behave better with any calculus based solver and probably other solvers also. Maybe you need 1e3$*$ in front of also.
– mathreadler
Dec 1 at 17:04

















active

oldest

votes











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Francescodario Cuzzocrea is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3021281%2fnonlinear-optimization-of-a-matrix-with-the-costraint-to-be-orthonormal%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








Francescodario Cuzzocrea is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Francescodario Cuzzocrea is a new contributor. Be nice, and check out our Code of Conduct.













Francescodario Cuzzocrea is a new contributor. Be nice, and check out our Code of Conduct.












Francescodario Cuzzocrea is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3021281%2fnonlinear-optimization-of-a-matrix-with-the-costraint-to-be-orthonormal%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bressuire

Cabo Verde

Gyllenstierna