You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
result= find_one_row_debiasingM(Sigma, i, mu, maxiter, soln, gradient, ever_active, nactive, kkt_tol, objective_tol) # C function uses 1-based indexing for active set
376
-
}
356
+
# Initialize variables
357
+
358
+
soln= rep(0, p)
359
+
360
+
ever_active= rep(0, p)
361
+
ever_active[1] =row# 1-based
362
+
ever_active= as.integer(ever_active)
363
+
nactive= as.integer(1)
364
+
365
+
linear_func= rep(0, p)
366
+
linear_func[row] =-1
367
+
linear_func= as.numeric(linear_func)
368
+
gradient=1.*linear_func
369
+
370
+
counter_idx=1;
371
+
incr=0;
372
+
373
+
last_output=NULL
374
+
375
+
while (counter_idx<max_try) {
376
+
377
+
result= solve_QP(Sigma,
378
+
mu,
379
+
max_iter,
380
+
soln,
381
+
linear_func,
382
+
gradient,
383
+
ever_active,
384
+
nactive,
385
+
kkt_tol,
386
+
objective_tol,
387
+
max_active)
388
+
389
+
iter=result$iter
390
+
391
+
# Logic for whether we should continue the line search
392
+
393
+
if (!linesearch) {
394
+
break
395
+
}
396
+
397
+
if (counter_idx==1){
398
+
if (iter== (max_iter+1)){
399
+
incr=1; # was the original problem feasible? 1 if not
400
+
} else {
401
+
incr=0; # original problem was feasible
402
+
}
403
+
}
404
+
405
+
if (incr==1) { # trying to find a feasible point
406
+
if ((iter< (max_iter+1)) && (counter_idx>1)) {
407
+
break; # we've found a feasible point and solved the problem
408
+
}
409
+
mu=mu*scaling_factor;
410
+
} else { # trying to drop the bound parameter further
411
+
if ((iter== (max_iter+1)) && (counter_idx>1)) {
412
+
result=last_output; # problem seems infeasible because we didn't solve it
413
+
break; # so we revert to previously found solution
414
+
}
415
+
mu=mu/scaling_factor;
416
+
}
417
+
418
+
# If the active set has grown to a certain size
419
+
# then we stop, presuming problem has become
420
+
# infeasible.
421
+
422
+
# We revert to the previous solution
423
+
424
+
if (result$max_active_check) {
425
+
result=last_output;
426
+
break;
427
+
}
428
+
429
+
counter_idx=counter_idx+1
430
+
last_output=list(soln=result$soln,
431
+
kkt_check=result$kkt_check)
432
+
}
377
433
378
434
# Check feasibility
379
435
380
-
if (!result$kkt_check) {
436
+
if (warn_kkt&& (!result$kkt_check)) {
381
437
warning("Solution for row of M does not seem to be feasible")
0 commit comments