Example #1
0
def test_mcp_newton_FB_FBLSA_2():
    mcp = SN.MCP(n - 5, 5, mcp_function_2, mcp_Nablafunction_2)
    z = np.zeros(n)
    w = np.zeros(n)
    SO = SN.SolverOptions(mcp, SN.SICONOS_MCP_NEWTON_FB_FBLSA)
    info = SN.mcp_newton_FB_FBLSA(mcp, z, w, SO)
    print("z = ", z)
    print("w = ", w)
    #assert (np.linalg.norm(z-zsol) <= ztol)
    assert not info
Example #2
0
def test_mcp_newton_min_FBLSA():
    mcp = sn.MCP(0, 2, mcp_function, mcp_Nablafunction)
    z = np.array([0., 0.])
    w = np.array([0., 0.])

    SO = sn.SolverOptions(sn.SICONOS_MCP_NEWTON_MIN_FBLSA)
    info = sn.mcp_newton_min_FBLSA(mcp, z, w, SO)
    print("z = ", z)
    print("w = ", w)
    assert np.linalg.norm(z - zsol) <= ztol
    assert not info
Example #3
0
def test_mcp_FB():
    mcp=N.MCP(1,1,mcp_function,mcp_Nablafunction)
    z = np.array([0., 0.])
    w = np.array([0., 0.])

    SO=N.SolverOptions(mcp,N.SICONOS_MCP_FB)
    N.mcp_driver_init(mcp, SO)
    info = N.mcp_FischerBurmeister(mcp, z, w, SO)
    N.mcp_driver_reset(mcp, SO)
    print("z = ", z)
    print("w = ", w)
    assert (np.linalg.norm(z-zsol) <= ztol)
    assert not info
Example #4
0
def test_mcp_newton_min_FBLSA_2():
    n = 10
    mcp = sn.MCP(n - 5, 5, mcp_function_2, mcp_Nablafunction_2)
    z = np.zeros(n)
    w = np.zeros(n)
    options = sn.SolverOptions(sn.SICONOS_MCP_NEWTON_MIN_FBLSA)
    options.iparam[sn.SICONOS_IPARAM_STOPPING_CRITERION] = \
        sn.SICONOS_STOPPING_CRITERION_RESIDU

    sn.solver_options_print(options)

    info = sn.mcp_newton_min_FBLSA(mcp, z, w, options)
    print("z = ", z)
    print("w = ", w)
    #assert (np.linalg.norm(z-zsol) <= ztol)
    assert not info
Example #5
0
def test_mcp_newton_min_FBLSA_2():
    mcp = SN.MCP(n - 5, 5, mcp_function_2, mcp_Nablafunction_2)
    z = np.zeros(n)
    w = np.zeros(n)
    SO = SN.SolverOptions(mcp, SN.SICONOS_MCP_NEWTON_MIN_FBLSA)

    SO.internalSolvers.iparam[
        SN.
        SICONOS_IPARAM_STOPPING_CRITERION] = SN.SICONOS_STOPPING_CRITERION_RESIDU

    SN.solver_options_print(SO)

    info = SN.mcp_newton_min_FBLSA(mcp, z, w, SO)
    print("z = ", z)
    print("w = ", w)
    #assert (np.linalg.norm(z-zsol) <= ztol)
    assert not info
Example #6
0
def test_new():
    mcp=N.MCP(1, 1, mcp_function, mcp_Nablafunction)