Exemplo n.º 1
0
def test_StatusMessage():
  blitzl1.set_tolerance(0.0)
  blitzl1.set_verbose(False)

  n = 10
  d = 10
  A = np.arange(n*d, dtype=np.float).reshape(n, d)
  b = np.arange(n, dtype=np.float)

  prob = blitzl1.LassoProblem(A, b)
  sol = prob.solve(2000.)
  if sol.status != "reached machine precision":
    print "test StatusMessage machine precision failed"

  blitzl1.set_tolerance(0.1)
  sol = prob.solve(2000.)
  if sol.status != "reached stopping tolerance":
    print "test StatusMessage stopping tolerance failed"

  blitzl1.set_tolerance(0.0)
  blitzl1.set_max_time(0.0)
  sol = prob.solve(2000.)
  if sol.status != "reached time limit":
    print "test StatusMessage time limit failed"
Exemplo n.º 2
0
def test_SolverOptions():
  blitzl1.set_tolerance(0.027)  
  if blitzl1.get_tolerance() != 0.027:
    print "test SolverOptions tolerance failed"

  blitzl1.set_max_time(557.0)
  if blitzl1.get_max_time() != 557.0:
    print "test SolverOptions max_time failed"

  blitzl1.set_use_intercept(True)
  if blitzl1.get_use_intercept() != True:
    print "test SolverOptions use_intercept (True) failed"

  blitzl1.set_use_intercept(False)
  if blitzl1.get_use_intercept() != False:
    print "test SolverOptions use_intercept (False) failed"

  blitzl1.set_verbose(True)
  if blitzl1.get_verbose() != True:
    print "test SolverOptions verbose (True) failed"

  blitzl1.set_verbose(False)
  if blitzl1.get_verbose() != False:
    print "test SolverOptions verbose (False) failed"