Re: [R] Cardinality constraint

2006-10-21 Thread Patrick Burns
To solve the problem you have in general, you will need something more powerful than 'constrOptim'. This is called a mixed integer problem, and arises in several fields including financial portfolio optimization. If you really only have 3 variables, then there are only 3 combinations of 2

[R] Cardinality constraint

2006-10-20 Thread Neuro LeSuperHéros
Hello, How do I implement a cardinality constraint with constrOptim? I want to minimize (least square) a%*%x = 4 subject to x12 x21 x34 count(x1, x2, x3)= 2 (cardinality constraint) Is there a way to specify binary integer variables with constrOptim? Here's my code so far: a -matrix(1:3,1,3)