Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline mb10  
#1 Posted : 12 September 2013 22:53:02(UTC)
mb10


Rank: Member

Groups: Registered
Joined: 27/08/2013(UTC)
Posts: 19
Italy

Was thanked: 9 time(s) in 5 post(s)
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.

Edited by user 13 September 2013 01:44:41(UTC)  | Reason: Not specified

File Attachment(s):
minimizer.sm (13kb) downloaded 123 time(s).
minimizerExamples_v01.sm (40kb) downloaded 112 time(s).
thanks 2 users thanked mb10 for this useful post.
on 12/09/2013(UTC),  on 12/09/2013(UTC)

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline mkraska  
#2 Posted : 12 September 2013 23:14:21(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,988
Germany

Was thanked: 1126 time(s) in 723 post(s)
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.
File Attachment(s):
minimizerExamples_Kr.sm (39kb) downloaded 123 time(s).
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
thanks 1 user thanked mkraska for this useful post.
on 12/09/2013(UTC)
Offline mb10  
#3 Posted : 13 September 2013 00:07:22(UTC)
mb10


Rank: Member

Groups: Registered
Joined: 27/08/2013(UTC)
Posts: 19
Italy

Was thanked: 9 time(s) in 5 post(s)
@ 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



Offline mb10  
#4 Posted : 13 September 2013 01:26:21(UTC)
mb10


Rank: Member

Groups: Registered
Joined: 27/08/2013(UTC)
Posts: 19
Italy

Was thanked: 9 time(s) in 5 post(s)
The attachments in the first post have been updated according to the suggestions of M. Kraska.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.