From: Berwin A Turlach <berwin_at_maths.uwa.edu.au>

Date: Thu 20 Oct 2005 - 21:49:35 EST

The first is actually not one constraint but 2*k constraints, where k is the number of elements in "par". But there is quite some redundancy in this set of equation. It suffices to constrain each element to be bigger or equal to 0 and that they should sum to 1. If these constraints are fulfilled, then each element must be less or equal to one.

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Oct 20 22:00:06 2005

Date: Thu 20 Oct 2005 - 21:49:35 EST

>>>>> "AD" == Alexis Diamond <alexisjdiamond@gmail.com> writes:

AD> I have a follow-up from Jens's question and Professor Ripley's AD> response.

AD> Jens wants to do quadratic optimization with 2 constraints:

>> > > # I need two constraints:

* >> > > # 1. each element in par needs to be between 0 and 1
** >> > > # 2. sum(par)=1, i.e. the elements in par need to sum to 1
*

AD> how does one set both constraints in quadprog, per AD> Prof. Ripley's suggestion? i know how to get quadprog to AD> handle the second constraint,

The first is actually not one constraint but 2*k constraints, where k is the number of elements in "par". But there is quite some redundancy in this set of equation. It suffices to constrain each element to be bigger or equal to 0 and that they should sum to 1. If these constraints are fulfilled, then each element must be less or equal to one.

AD> but not BOTH, since quadprog only takes as inputs the AD> constraint matrix "A" and constraint vector "b"-- So what stops you from coding the k constraints from 1.) in the form that quadprog requires them? From memory, i.e. untested:

m <- length(par)

Amat <- cbind(rep(1,m), diag(m))

bvec <- c(1,rep(0,m))

meq <- 1

solve.QP(Dmat, dvec, Amat, bvec, meq)

AD> unlike in "ipop" (kernlab), there is no additional option for
AD> box constraints.

Well, the problems that I had (and still have) usually don't involve
box constraints, but I see that other people use them again and again.
So probably it would be a good idea to implement them... But, more
importantly, would be to implement Powell's modifications of the
Goldfarb-Idnani algorithm to make it numerically more robust... Oh,
yeah, and a warm start option from a feasible point would be nice
too.... Probably all in a future version which should be released
sometime before Xmas 20xx. :)

AD> apologies if i am not seeing something obvious here. Apologies accepted. :)

Cheers,

Berwin

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Oct 20 22:00:06 2005

*
This archive was generated by hypermail 2.1.8
: Sun 23 Oct 2005 - 19:07:42 EST
*