search for: constraint1

Displaying 2 results from an estimated 2 matches for "constraint1".

Did you mean: constraints
2004 Oct 12
2
constrained optimization using nlm/optim?
...ample of a simple R script that impliments a contrained nonlinear function using nlm or optim. I'm not exactly sure how to impliment the constraints within the objective function that is passed to nlm/optim. obj.func <- function( p ) { x(p) <- unconstrained obj function value if( constraint1 > something ) { obj.func <- x(p) } else { obj.func <- some super huge number } } p <- c(0.1,2.4, 5) nlm( obj.func, p, and a bunch of other arguments ) Any suggestions would be very helpful... Jeff. -- Jeff D. Hamann Forest Informatics, Inc. PO Box 1421 Corvalli...
2012 Sep 17
2
Constraint Optimization with constrOptim
...rtingEstimatesNegativ = matrix(rep(-1/9, 9), nrow=1, ncol=9, byrow=TRUE) #The function which should be minimized x <- matrixStartingEstimates fkt <- function(x) {t(x) %*% covarianceMatrix %*% x} #The constraints #The results should be greater 0 !DOES NOT WORK! constraint1 <- x[1:9] #The summ of the results should be between 0.999 and 1.001 constraint2 <- sum(matrixStartingEstimatesNegativ) constraint3 <- sum(x) constraintMatrix <- rbind(constraint1, constraint2, constraint3) constraintVektor <- c(0, -1.00001, 0.99999) #Optimization constrOptim(s...