def test_mcp_newton_minFBLSA(): mcp = SN.MixedComplementarityProblem2(0, 2, mcp_function, mcp_Nablafunction) z = np.array([0., 0.]) w = np.array([0., 0.]) SO = SN.SolverOptions(mcp, SN.SICONOS_MCP_NEWTON_MINFBLSA) info = SN.mcp_newton_minFBLSA(mcp, z, w, SO) #print("z = ", z) #print("w = ", w) assert (np.linalg.norm(z-zsol) <= ztol) assert not info
def test_new(): mcp=SN.MixedComplementarityProblem2(1, 1, mcp_function, mcp_Nablafunction)
print('This is an experimental file !') xk[0] = 1. xk[1] = 10. #numba.jit('void(i8,i8,double[:],double[:,:])', nopython=True)(mcp_Nablafunction).inspect_types() # mcp_Nablafunction.inspect_types() T = 10.0 t = 0.0 z = np.zeros((7,), dtype=np.dtype('d')) w = np.zeros((7,), dtype=np.dtype('d')) # mcp_function(z) # mcp_Nablafunction(z) N = int(T/hh + 10) print(N) mcp = SN.MixedComplementarityProblem2(0, 4, mcp_function, mcp_Nablafunction) SO=SN.SolverOptions(mcp, SN.SICONOS_MCP_NEWTON_FBLSA) SO.dparam[0] = 1e-13 SO.iparam[0] = 100 SO.iparam[3] = 2 SO.iparam[4] = 10 lambdaPM = np.empty((N, 4)) signs = np.empty((N, 2)) sol = np.empty((N, 2)) sol[0, :] = xk z[4:6] = xk z[6] = hh k = 0
if __name__ == '__main__': xk = np.array((1., 10.)) T = 4.0 t = 0.0 z = np.zeros((4, )) w = np.empty((4, )) kappa = 0.41 g = 9.81 theta = 1.0 gamma = 1.0 zi_syst = ZI(h, xk, theta, gamma, kappa, g) mcp = SN.MixedComplementarityProblem2(0, 4, zi_syst) SO = SN.SolverOptions(mcp, SN.SICONOS_MCP_NEWTON_FBLSA) SO.dparam[0] = 1e-24 SO.iparam[0] = 150 SO.iparam[3] = 2 SO.iparam[4] = 10 N = int(T / h + 10) print(N) lambdaPM = np.empty((N, 4)) signs = np.empty((N, 2)) sol = np.empty((N, 2)) sol[0, :] = xk k = 0
if __name__ == '__main__': xk = np.array((1., 10.)) T = 10.0 t = 0.0 h = 1e-3 z = np.zeros((4, )) w = np.empty((4, )) kappa = 0.9 g = 9.81 theta = 1.0 gamma = 1.0 mcp = SN.MixedComplementarityProblem2(0, 4) ffi = FFI() ffi.cdef('void set_cstruct(uintptr_t p_env, void* p_struct);') ffi.cdef('''typedef struct { int id; double* xk; double h; double theta; double gamma; double g; double kappa; unsigned int f_eval; unsigned int nabla_eval; } data;