fsolve with solution constraints
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Huiying Zhao
il 3 Mag 2017
Commentato: Supitcha Mamuangbon
il 25 Mar 2020
Hi, I am solving a list of nonlinear equations with part of the solutions having constraints. For example, the solution is consist of [x1, x2,x3,x4] with x3 and x4 should within [0,1] and x1 and x2 should be bigger than 0.
I try to search this kind of topic and seems that fsolve cannot solve this kind of problem. I should try fmincon or lsqnonlin. But the result of fmincon or lsqnonlin require that all solution have the same constraints. But in my situation, my solution has different constraints.
I am not sure whether my understanding is correct.
Thanks!
2 Commenti
dror meidan
il 3 Mag 2017
Hi, try to choose the initial point near the requested points (x1,x2,x3,x4)
Risposta accettata
John D'Errico
il 3 Mag 2017
Modificato: John D'Errico
il 3 Mag 2017
You claim that fmincon and lsqnonlin require the SAME constraints. This is completely false. Read the help for LB and UB.
In the case you describe,
LB = [0, 0, 0, 0];
UB = [inf, inf, 1, 1];
That applies to either fmincon or lsqnonlin.
Be careful here, since you state bigger than zero for two variables. Constraints in tools like these cannot be formulated as a strict inequality (>). Worse, the tolerance on a constraint may allow a variable to fail the constraint by a small amount.
Fsolve does not allow bound constraints, although you could solve the problem in an fsolve context using transformations of the variables. There is no reason to do so, since lsqnonlin applies directly, at least in theory. (That said until I read your comment that the problem is underdetermined.) One nice thing about the transformative approach to constraints is you can indeed formulate a strict inequality.
A problem arises since there are fewer constraints then unknowns. So that means there will be in general an infinite number of solutions. As such the problem is poorly posed for lsqnonlin.
What you have not told us is how many equations do you have? This could be pertinent.
Regardless, the simple solution seems to be to formulate it as an fmincon problem, as the sum of squares of residuals. It should be able to find some solution from the set of infinitely many solutions.
3 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Quadratic Programming and Cone Programming in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!