1 pagine (4 elementi)
A function for finding constrained minimum - mb10@live.it - Messaggi
Attached is a snippet function for calculating the constrained minimum of a scalar function J(x) of several variables.
More specifically it solves the problem:
minimize J(x) in the domain xm <= x <= xM
subject to:
g(x)>=0; (a vector function of m potentially nonlinear inequality constraints)
A*x = b; (r linear equality constraints, A being an rxn matrix)
The algorithm has been adapted from this article (in particular from eqn. (7) on page 4):
http://www.ajbasweb.com/ajbas/2011/894-909.pdf.
minimizerExamples_v01.sm (39,4 KiB) scaricato 1664 volta(e).
More specifically it solves the problem:
minimize J(x) in the domain xm <= x <= xM
subject to:
g(x)>=0; (a vector function of m potentially nonlinear inequality constraints)
A*x = b; (r linear equality constraints, A being an rxn matrix)
The algorithm has been adapted from this article (in particular from eqn. (7) on page 4):
http://www.ajbasweb.com/ajbas/2011/894-909.pdf.
minimizerExamples_v01.sm (39,4 KiB) scaricato 1664 volta(e).
2 utenti hanno apprezzato questo post
I attached a version with function arguments. In the definition, the formal parameter is a function name with the numbers of arguments given, in the call the actual parameter is the function with an UNDEFINED variable as dummy argument, Thus, minimize(J(x), g(x), x ... won't work because x is bound to the initial values vector.
minimizerExamples_Kr.sm (38,12 KiB) scaricato 1696 volta(e).
minimizerExamples_Kr.sm (38,12 KiB) scaricato 1696 volta(e).
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
1 utenti hanno apprezzato questo post
Radovan Omorjan 12/09/2013 16:16:00
@ Martin Kraska:
With your changes (and changing the names in the body of the algorithm as well), it seems to work fine now, and I will soon update both files accordingly.
Thank you very much for your explanations!
mb
With your changes (and changing the names in the body of the algorithm as well), it seems to work fine now, and I will soon update both files accordingly.
Thank you very much for your explanations!
mb
1 pagine (4 elementi)
- Nuovi post
- Nessun nuovo post