Hi Yunlei,

Try solve.QP function of Quadprog package. It is


> solve.QP
function (Dmat, dvec, Amat, bvec, meq = 0, factorized = FALSE)
{
    n <- nrow(Dmat)
    q <- ncol(Amat)
    if (missing(bvec))
        bvec <- rep(0, q)
    if (n != ncol(Dmat))
        stop("Dmat is not symmetric!")
    if (n != length(dvec))
        stop("Dmat and dvec are incompatible!")
    if (n != nrow(Amat))
        stop("Amat and dvec are incompatible!")
    if (q != length(bvec))
        stop("Amat and bvec are incompatible!")
    if ((meq > q) || (meq < 0))
        stop("Value of meq is invalid!")
    iact <- rep(0, q)
    nact <- 0
    r <- min(n, q)
    sol <- rep(0, n)
    crval <- 0
    work <- rep(0, 2 * n + r * (r + 5)/2 + 2 * q + 1)
    iter <- rep(0, 2)
    res1 <- .Fortran("qpgen2", as.double(Dmat), dvec = as.double(dvec),
        as.integer(n), as.integer(n), sol = as.double(sol), crval =
as.double(crval),
        as.double(Amat), as.double(bvec), as.integer(n), as.integer(q),
        as.integer(meq), iact = as.integer(iact), nact = as.integer(nact),
        iter = as.integer(iter), work = as.double(work), ierr =
as.integer(factorized),
        PACKAGE = "quadprog")
    if (res1$ierr == 1)
        stop("constraints are inconsistent, no solution!")
    else if (res1$ierr == 2)
        stop("matrix D in quadratic function is not positive definite!")
    list(solution = res1$sol, value = res1$crval, unconstrainted.solution =
res1$dvec,
        iterations = res1$iter, iact = res1$iact[1:res1$nact])
}
<environment: namespace:quadprog>
>

Let me know whether I have understood your your problem properly.

Regards,
Deashis


On 22/07/2008, Yunlei.Hu@barclayscapital.com <Yunlei.Hu@barclayscapital.com>
wrote:
>
>
> Dear all
>
> I am using quadratic programming to solve the portfolio optimization in
> cosidering transaction cost. Is there any R optimization package can do
> this?
>
> Solve.QP require the positive definite matrix in Dmat, while in my case,
> this matrix in the objective function is not positive definite.
>
> >  It is in a bit of emergency. I would be really appreciated if anybody
> > can give me the reply ASAP.
> >
> > Many thanks
> >  Yunlei
> >
> _______________________________________________
>
> This e-mail may contain information that is confidential, privileged or
> otherwise protected from disclosure. If you are not an intended recipient of
> this e-mail, do not duplicate or redistribute it by any means. Please delete
> it and any attachments and notify the sender that you have received it in
> error. Unless specifically indicated, this e-mail is not an offer to buy or
> sell or a solicitation to buy or sell any securities, investment products or
> other financial product or service, an official confirmation of any
> transaction, or an official statement of Barclays. Any views or opinions
> presented are solely those of the author and do not necessarily represent
> those of Barclays. This e-mail is subject to terms available at the
> following link: www.barcap.com/emaildisclaimer. By messaging with Barclays
> you consent to the foregoing.  Barclays Capital is the investment banking
> division of Barclays Bank PLC, a company registered in England (number
> 1026167) with its registered offi!
> ce at 1 Churchill Place, London, E14 5HP.  This email may relate to or be
> sent from other members of the Barclays Group.
>
> _______________________________________________
> R-SIG-Finance@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>

	[[alternative HTML version deleted]]

