Re: error minimization



John D'Errico wrote:
>
>
> In article <ef0fd43.5@xxxxxxxxxxxxxxxx>,
> Peter <laziodream@xxxxxxxxxxxx> wrote:
>
>> >> min(sum(abs(a+b*C)))
>> >> with:
>> >> a=(1,m)
>> >> b=(1,n)
>> >> C=(n,m)
>> >> I don't understand the meaning of the vector b in your
> previous
>> >> post...sorry if i am boring you...
>> >
>> > Sorry. That was a typo. It should have been d instead
>> > of b.
>> >
>> > min(sum(u+v))
>> > subject to
>> >
>> > C*x-u+v = d
>> > u>=0
>> > v>=0
>> >
>> >
>> > In your case, you have a problem with n unknowns.
>> > To that you will augment another 2*m unknowns for
>> > u and v, solving a linear programming problem with
>> > n+2*m unknowns in total.
>
> (snip)
>
>> Sorry John, I'm really new in matlab programming....and i don't
> know
>> which is the exact call to linprog.m. I checked on the help but
> there
>> is a different problem i think...
>> Can you help me????
>
>
> Lets transpose your arrays first, to put it into a
> form that is solvable using linprog.
>
> Given knowns:
> a an mx1 vector
> C an mxn array
>
> and
> b an nx1 vector of unknowns
>
> We wish to find the vector b such that
>
> sum(abs(C*b + a)) is minimized
>
>
> I suggested that the solution is to introduce vectors
> u and v, both mx1, both unknown. Solve the LP problem
>
> min(sum(u+v))
>
> subject to equality constraints
>
> C*x-u+v = -a
>
> and bound constraints
>
> u>=0
> v>=0
>
> There are now a total of n+2*m unknowns. Here is the
> first part of the help for linprog:
>
>
> help linprog
> LINPROG Linear programming.
> X=LINPROG(f,A,b) attempts to solve the linear programming
> problem:
>
> min f'*x subject to: A*x <= b
> x
>
> X=LINPROG(f,A,b,Aeq,beq) solves the problem above while
> additionally
> satisfying the equality constraints Aeq*x = beq.
>
> X=LINPROG(f,A,b,Aeq,beq,LB,UB) defines a set of lower and upper
> bounds on the design variables, X, so that the solution is in
> the range LB <= X <= UB. Use empty matrices for LB and UB
> if no bounds exist. Set LB(i) = -Inf if X(i) is unbounded
> below;
> set UB(i) = Inf if X(i) is unbounded above.
>
>
> Lets assume that X will be the solution vector.
> We will define the first n elements of X as the
> unknowns in b. the next m elements will be u, then
> v will follow.
>
> f must be a column vector of length n+2*m.
>
> f = [zeros(n,1);ones(2*m,1)];
>
> Think about what this does. When you form f'*X,
> what does it do?
>
> Yes. It forms sum(u) + sum(v). This is the objective
> that I suggested.
>
> Lets do the bound constraints next. There are no
> upper bounds on any variable. Lower bounds are only
> applied to u and v.
>
> LB = [repmat(-inf,n,1);zeros(2*m,1)];
> UB = [];
>
> There are no inequality constraints on the parameters
> (beyond the bound constraints) so A and b are left empty.
>
> A = [];
> b = [];
>
> Finally, there are equality constraints, Aeq, beq.
>
> Aeq = [C, -eye(n,n), eye(n,n)];
> Beq = -a;
>
> Call linprog like this.
>
> X = linprog(f,A,b,Aeq,beq,LB,UB);
>
> And unpack the results. Discard u and v.
>
> b_solv = X(1:n);
>
> Nothing special here. I'll let you check that I've
> actually done the math right.
>
> John
>
>
> --
> The best material model of a cat is another, or
> preferably the same, cat.
> A. Rosenblueth, Philosophy of Science, 1945
>

Hi John,

thank you very much for your explanation...it works very well when i
use real data,unfortunally it doesn't work when i use complex
numbers, this should be a limitation of the linprog function i
think...

Thanks,

Peter
.



Relevant Pages

  • Re: error minimization
    ... you have a problem with n unknowns. ... form that is solvable using linprog. ... subject to equality constraints ... Finally, there are equality constraints, Aeq, beq. ...
    (comp.soft-sys.matlab)
  • Re: Optmization with fmincon
    ... I appreciate your help John. ... powerplant with certain nonlinear constraints. ... It continues to do some operations but finally crashes with the ...
    (comp.soft-sys.matlab)
  • Re: Macroevolution FAQ again
    ... John Harshman wrote: ... Developmental constraints in evolutionary processes. ... > Pages 313-332 In J. T. Bonner, Evolution and Development. ...
    (talk.origins)
  • Re: Tasks that are dependent not changing start dates
    ... Thanks, John. ... Calculation is set to automatic, their are no constraints, ... > then Project will re-calculate the schedule dates automatically ...
    (microsoft.public.project)
  • Re: Keep Task Days Together
    ... To avoid that I put a loop that removes all previously placed ... > constraints before re-applying them. ... macro - that may not always be the case (i.e. some tasks in a project ... John ...
    (microsoft.public.project)