hello,
> 1. Constrained optimization a set of non-linear equations using the
> Lagrangian multiplier (e.g. utility functions subject to budget
> constraint)?
sorry i can't be more helpful, but here is a recent attempt at
a function to apply the so-called augmented lagrangian method
(which reduces the constrained problem to a sequence of
unconstrained problems).
the following code attempts to solve the unconstrained intermediate
problems by applying the mnewton (multivariate newton's method)
function to find a stationary point of the gradient of the
augmented lagrangian. there certainly are stronger methods for
unconstrained optimization.
mnewton doesn't reject problems containing symbolic
parameters, but it often can't do much with them.
anyway here is the code. i hope someone finds this inspirational.
robert dodier
PS.
/* fom = figure of merit expression,
xx = list of variables to solve for,
constraints = list of constraint expressions,
yy = initial guess for xx.
e.g., maximize x + y s.t. x^2 + y^2 = 1:
augmented_lagrangian_method (-(x + y), [x, y], [x^2 + y^2 - 1], [1, 1]);
*/
load (mnewton);
niter: 10;
augmented_lagrangian_method (fom, xx, constraints, yy) :=
block ([n, augmented_lagrangian, augmented_lagrangian_gradient, %lambda, %nu],
nc: length (constraints),
augmented_lagrangian: fom
+ apply ("+", makelist (%lambda[i] * constraints[i], i, 1, nc))
+ apply ("+", makelist (%nu[i] * constraints[i]^2, i, 1, nc)),
augmented_lagrangian_gradient: map (lambda ([a], diff
(augmented_lagrangian, a)), xx),
%lambda: makelist (1, i, 1, nc),
%nu: makelist (1, i, 1, nc),
for i:1 thru niter do
(soln: mnewton (ev (augmented_lagrangian_gradient), xx, yy),
yy: map (rhs, soln[1]),
%lambda: %lambda + apply ("+", %nu * map (lambda ([c], subst
(soln[1], c)), constraints))),
yy);