X-Git-Url: https://git.auder.net/?p=morpheus.git;a=blobdiff_plain;f=pkg%2FR%2FoptimParams.R;h=039070c5280b847af077056b2cfcc89b6c73b589;hp=5a88ed96487205582e784f25cadbad06eb51aa10;hb=2591fa8343c69ddb94dec5e55871d34c55eff9a3;hpb=86f257f88727805ee73f69e2b9ad57bea2f40b82 diff --git a/pkg/R/optimParams.R b/pkg/R/optimParams.R index 5a88ed9..039070c 100644 --- a/pkg/R/optimParams.R +++ b/pkg/R/optimParams.R @@ -268,17 +268,18 @@ setRefClass( # (Re)Set W to identity, to allow several run from the same object W <<- diag(d+d^2+d^3) - # TODO: stopping condition? N iterations? Delta <= epsilon ? - loopMax <- 2 + loopMax <- 2 #TODO: loopMax = 3 ? Seems not improving... + x_init <- linArgs(θ0) for (loop in 1:loopMax) { - op_res = constrOptim( linArgs(θ0), .self$f, .self$grad_f, + op_res = constrOptim( x_init, .self$f, .self$grad_f, ui=cbind( rbind( rep(-1,K-1), diag(K-1) ), matrix(0, nrow=K, ncol=(d+1)*K) ), ci=c(-1,rep(0,K-1)) ) if (loop < loopMax) #avoid computing an extra W W <<- computeW(expArgs(op_res$par)) + x_init <- op_res$par #print(op_res$value) #debug #print(expArgs(op_res$par)) #debug }