@@ -467,30 +467,7 @@ weightit2energy <- function(covs, treat, s.weights, subset, estimand, focal,
467467 ATC = diag(P ) + lambda * s.weights_n_1 [t1 ]^ 2 / 2 )
468468 }
469469
470- A <- ... mget(names(formals(osqp :: osqpSettings )))
471-
472- if (is_not_null(... get(" eps" ))) {
473- chk :: chk_number(... get(" eps" ), " `eps`" )
474- if (is_null(A [[" eps_abs" ]])) A [[" eps_abs" ]] <- ... get(" eps" )
475- if (is_null(A [[" eps_rel" ]])) A [[" eps_rel" ]] <- ... get(" eps" )
476- }
477-
478- if (is_null(A [[" max_iter" ]])) A [[" max_iter" ]] <- 5e4L
479- chk :: chk_count(A [[" max_iter" ]], " `max_iter`" )
480- chk :: chk_lt(A [[" max_iter" ]], Inf , " `max_iter`" )
481- if (is_null(A [[" eps_abs" ]])) A [[" eps_abs" ]] <- 1e-8
482- chk :: chk_number(A [[" eps_abs" ]], " `eps_abs`" )
483- if (is_null(A [[" eps_rel" ]])) A [[" eps_rel" ]] <- 1e-6
484- chk :: chk_number(A [[" eps_rel" ]], " `eps_rel`" )
485- if (is_null(A [[" time_limit" ]])) A [[" time_limit" ]] <- 0
486- chk :: chk_number(A [[" time_limit" ]], " `time_limit`" )
487- if (is_null(A [[" adaptive_rho_interval" ]])) A [[" adaptive_rho_interval" ]] <- 10L
488- chk :: chk_count(A [[" adaptive_rho_interval" ]], " `adaptive_rho_interval`" )
489- if (is_null(A [[" polish" ]])) A [[" polish" ]] <- TRUE
490- chk :: chk_flag(A [[" polish" ]], " `polish`" )
491- A [[" verbose" ]] <- TRUE
492-
493- options.list <- do.call(osqp :: osqpSettings , A )
470+ options.list <- .process_osqp_settings(min.w , verbose , ... )
494471
495472 verbosely({
496473 opt.out <- osqp :: solve_osqp(P = 2 * P , q = q , A = t(Amat ), l = lvec , u = uvec ,
@@ -730,30 +707,7 @@ weightit2energy.multi <- function(covs, treat, s.weights, subset, estimand, foca
730707
731708 diag(P ) <- diag(P ) + lambda / n ^ 2
732709
733- A <- ... mget(names(formals(osqp :: osqpSettings )))
734-
735- if (is_not_null(... get(" eps" ))) {
736- chk :: chk_number(... get(" eps" ), " `eps`" )
737- if (is_null(A [[" eps_abs" ]])) A [[" eps_abs" ]] <- ... get(" eps" )
738- if (is_null(A [[" eps_rel" ]])) A [[" eps_rel" ]] <- ... get(" eps" )
739- }
740-
741- if (is_null(A [[" max_iter" ]])) A [[" max_iter" ]] <- 5e4L
742- chk :: chk_count(A [[" max_iter" ]], " `max_iter`" )
743- chk :: chk_lt(A [[" max_iter" ]], Inf , " `max_iter`" )
744- if (is_null(A [[" eps_abs" ]])) A [[" eps_abs" ]] <- 1e-8
745- chk :: chk_number(A [[" eps_abs" ]], " `eps_abs`" )
746- if (is_null(A [[" eps_rel" ]])) A [[" eps_rel" ]] <- 1e-6
747- chk :: chk_number(A [[" eps_rel" ]], " `eps_rel`" )
748- if (is_null(A [[" time_limit" ]])) A [[" time_limit" ]] <- 0
749- chk :: chk_number(A [[" time_limit" ]], " `time_limit`" )
750- if (is_null(A [[" adaptive_rho_interval" ]])) A [[" adaptive_rho_interval" ]] <- 10L
751- chk :: chk_count(A [[" adaptive_rho_interval" ]], " `adaptive_rho_interval`" )
752- if (is_null(A [[" polish" ]])) A [[" polish" ]] <- TRUE
753- chk :: chk_flag(A [[" polish" ]], " `polish`" )
754- A [[" verbose" ]] <- TRUE
755-
756- options.list <- do.call(osqp :: osqpSettings , A )
710+ options.list <- .process_osqp_settings(min.w , verbose , ... )
757711
758712 verbosely({
759713 opt.out <- osqp :: solve_osqp(P = 2 * P , q = q , A = t(Amat ), l = lvec , u = uvec ,
@@ -866,6 +820,8 @@ weightit2energy.cont <- function(covs, treat, s.weights, subset, missing, verbos
866820 tols <- abs(tols )
867821 }
868822
823+ options.list <- .process_osqp_settings(min.w , verbose , ... )
824+
869825 d.moments <- max(... get(" d.moments" , 0 ), moments )
870826 chk :: chk_count(d.moments )
871827
@@ -957,29 +913,6 @@ weightit2energy.cont <- function(covs, treat, s.weights, subset, missing, verbos
957913
958914 diag(P ) <- diag(P ) + lambda / n ^ 2
959915
960- A <- ... mget(names(formals(osqp :: osqpSettings )))
961-
962- eps <- ... get(" eps" , 1e-8 )
963-
964- chk :: chk_number(eps )
965- if (is_null(A [[" eps_abs" ]])) A [[" eps_abs" ]] <- eps
966- if (is_null(A [[" eps_rel" ]])) A [[" eps_rel" ]] <- eps
967-
968- if (is_null(A [[" max_iter" ]])) A [[" max_iter" ]] <- 5e4L
969- chk :: chk_count(A [[" max_iter" ]], " `max_iter`" )
970- chk :: chk_lt(A [[" max_iter" ]], Inf , " `max_iter`" )
971- chk :: chk_number(A [[" eps_abs" ]], " `eps_abs`" )
972- chk :: chk_number(A [[" eps_rel" ]], " `eps_rel`" )
973- if (is_null(A [[" time_limit" ]])) A [[" time_limit" ]] <- 0
974- chk :: chk_number(A [[" time_limit" ]], " `time_limit`" )
975- if (is_null(A [[" adaptive_rho_interval" ]])) A [[" adaptive_rho_interval" ]] <- 10L
976- chk :: chk_count(A [[" adaptive_rho_interval" ]], " `adaptive_rho_interval`" )
977- if (is_null(A [[" polish" ]])) A [[" polish" ]] <- TRUE
978- chk :: chk_flag(A [[" polish" ]], " `polish`" )
979- A [[" verbose" ]] <- TRUE
980-
981- options.list <- do.call(osqp :: osqpSettings , A )
982-
983916 verbosely({
984917 opt.out <- osqp :: solve_osqp(P = 2 * P , q = q , A = t(Amat ), l = lvec , u = uvec ,
985918 pars = options.list )
0 commit comments