[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fmincon wrapping nonlin_min
From: |
Asma Afzal |
Subject: |
fmincon wrapping nonlin_min |
Date: |
Fri, 26 Jun 2015 20:56:39 +0100 |
Hi Olaf,
I need some help in wrapping fmincon to nonlin_min:
- User supplied gradient of nonlinear constraints.
Consider the example:
objective_function = @ (p) p(1)^2 + p(2)^2;
pin = [-2; 5];
constraint_function = @ (p) p(1)^2 + 1 - p(2);
gradc = @(p) [2*p(1);-1];
[p, objf, cvg, outp] = nonlin_min (objective_function, pin, optimset
("equc", {constraint_function, gradc}))
It gives the following error:
error: function handle type invalid as index value
What is the right way pass gradc to nonlin_min?
- Another simple example:
f = @(x) -x(1) * x(2) * x(3);
S = [1 -1; 2 -2; 2 -2]
b = [0;72];
x0 = [10;10;10];
[x,fval] = nonlin_min( f, x0, optimset ("inequc",{S,b}) )
Gives an error with lm_feasible
error: __lm_feasible__: operator -: nonconformant arguments (op1 is
3x1, op2 is 3x0)
__lm_feasible__.m at line 208, column 11
but it works fine with octave_sqp.
- Output Gradient and Hessian at the solution as in Matlab.
- Output Lambda as a structure: changing backend to octave_sqp when
this output is requested? but the ordering issue again comes down to
the lambda returned from qp.
My code for fmincon:
https://github.com/AsmaAfzal/octave_workspace/blob/master/fmincon.m
Kind Regards,
Asma.
- fmincon wrapping nonlin_min,
Asma Afzal <=