Adds use of initial point
All checks were successful
gitea-physics/pdme/pipeline/head This commit looks good
All checks were successful
gitea-physics/pdme/pipeline/head This commit looks good
This commit is contained in:
parent
ef69660c35
commit
ac308b6658
@ -4,6 +4,15 @@ import logging
|
||||
import numpy
|
||||
import itertools
|
||||
import pdme.solver
|
||||
import pytest
|
||||
|
||||
|
||||
def test_fixed_z_plane_model_solve_error_initial():
|
||||
|
||||
model = FixedZPlaneModel(4, -10, 10, -10, 10, 1)
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
pdme.solver.sol(model, [], initial_pt=[1, 2])
|
||||
|
||||
|
||||
def test_fixed_z_plane_model_solve_basic():
|
||||
@ -23,3 +32,9 @@ def test_fixed_z_plane_model_solve_basic():
|
||||
logging.info(result)
|
||||
assert result.success
|
||||
numpy.testing.assert_allclose(result.x, expected_solution, err_msg="Even well specified problem solution was wrong.", rtol=1e-6, atol=1e-11)
|
||||
|
||||
# Do it again with an initial point
|
||||
result = pdme.solver.sol(model, dots, initial_pt=[2, 2, 2, 2])
|
||||
logging.info(result)
|
||||
assert result.success
|
||||
numpy.testing.assert_allclose(result.x, expected_solution, err_msg="Even well specified problem solution was wrong.", rtol=1e-6, atol=1e-11)
|
||||
|
Loading…
x
Reference in New Issue
Block a user