Esempio n. 1
0
def createMLCP_fromFile():
    mlcp=N.MLCP()
    N.mixedLinearComplementarity_newFromFilename(mlcp, os.path.join(working_dir, "data/diodeBridge_mlcp.dat"))
    zsol =np.array([  9.85185185e-01,   9.85185185e-01,  -0.00000000e+00,
         9.85185185e-04,   0.00000000e+00,   0.00000000e+00,
         9.85185185e-04])
    return (mlcp, zsol)
Esempio n. 2
0
       [ 0.    ],
       [ 0.    ],
       [ 0.    ],
       [ 0.    ]])

mlcp=N.MLCP(3,M,q)

def test_mlcp_enum_large():
    SO=N.SolverOptions(mlcp,N.SICONOS_MLCP_ENUM)
    N.mlcp_driver_init(mlcp, SO)
    info = N.mlcp_enum(mlcp, z, w, SO)
    N.mlcp_driver_reset(mlcp, SO)
    print("z = ", z)
    print("w = ", w)
    assert (np.linalg.norm(z-zsol) <= ztol)
    assert not info
#mlcp =0
mlcp=N.MLCP()
N.mixedLinearComplementarity_newFromFilename(mlcp,"data/diodeBridge_mlcp.dat")
#N.mixedLinearComplementarity_display(mlcp)

def test_mlcp_enum_large_fromfile():
    SO=N.SolverOptions(mlcp,N.SICONOS_MLCP_ENUM)
    N.mlcp_driver_init(mlcp, SO)
    info = N.mlcp_enum(mlcp, z, w, SO)
    N.mlcp_driver_reset(mlcp, SO)
    print("z = ", z)
    print("w = ", w)
    assert (linalg.norm(z-zsol) <= ztol)
    assert not info