diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index bf90abb..92cabb0 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest, macos-latest, windows-latest ] + os: [ ubuntu-latest, macos-13, windows-latest ] steps: - name: Checkout repository and submodules @@ -62,9 +62,9 @@ jobs: - name: Test with pytest (macOS) if: runner.os == 'macOS' run: | - sudo conda install pytest + pip install pytest cd tests - $CONDA/bin/pytest + python -m pytest - name: Test with pytest (Windows) if: runner.os == 'Windows' diff --git a/cvxpygen/solvers.py b/cvxpygen/solvers.py index bacd85a..1071758 100644 --- a/cvxpygen/solvers.py +++ b/cvxpygen/solvers.py @@ -923,22 +923,42 @@ def __init__(self, data, p_prob, enable_settings): P_p = f'(cpg_int[]){{{{ {", ".join(["0"]*(n_var+1))} }}}}' P_i = '0' P_x = '0' + update_after_init = ['A', 'q', 'b'] else: extra_condition = '!{prefix}solver' P_p = '{prefix}Canon_Params_conditioning.P->p' P_i = '{prefix}Canon_Params_conditioning.P->i' P_x = '{prefix}Canon_Params_conditioning.P->x' + update_after_init = ['P', 'A', 'q', 'b'] self.parameter_update_structure = { 'init': ParameterUpdateLogic( - update_pending_logic=UpdatePendingLogic([], extra_condition=extra_condition, functions_if_false=[]), + update_pending_logic=UpdatePendingLogic([], extra_condition=extra_condition, functions_if_false=update_after_init), function_call= \ f'{{prefix}}cpg_copy_all();\n' f' clarabel_CscMatrix_init(&{{prefix}}P, {canon_constants["n"]}, {canon_constants["n"]}, {P_p}, {P_i}, {P_x});\n' f' clarabel_CscMatrix_init(&{{prefix}}A, {canon_constants["m"]}, {canon_constants["n"]}, {{prefix}}Canon_Params_conditioning.A->p, {{prefix}}Canon_Params_conditioning.A->i, {{prefix}}Canon_Params_conditioning.A->x);\n' \ f' {{prefix}}settings = clarabel_DefaultSettings_default()' - ) + ), + 'A': ParameterUpdateLogic( + update_pending_logic = UpdatePendingLogic(['A']), + function_call = f'{{prefix}}cpg_copy_A();\n clarabel_CscMatrix_init(&{{prefix}}A, {canon_constants["m"]}, {canon_constants["n"]}, {{prefix}}Canon_Params_conditioning.A->p, {{prefix}}Canon_Params_conditioning.A->i, {{prefix}}Canon_Params_conditioning.A->x)' + ), + 'q': ParameterUpdateLogic( + update_pending_logic = UpdatePendingLogic(['q']), + function_call = f'{{prefix}}cpg_copy_q()' + ), + 'b': ParameterUpdateLogic( + update_pending_logic = UpdatePendingLogic(['b']), + function_call = f'{{prefix}}cpg_copy_b()' + ), } + + if indices_obj is not None: + self.parameter_update_structure['P'] = ParameterUpdateLogic( + update_pending_logic = UpdatePendingLogic(['P']), + function_call = f'{{prefix}}cpg_copy_P();\n clarabel_CscMatrix_init(&{{prefix}}P, {canon_constants["n"]}, {canon_constants["n"]}, {P_p}, {P_i}, {P_x})' + ) self.solve_function_call = \ f'{{prefix}}solver = clarabel_DefaultSolver_new(&{{prefix}}P, {{prefix}}Canon_Params_conditioning.q, &{{prefix}}A, {{prefix}}Canon_Params_conditioning.b, {canon_constants["n_cone_types"]}, {{prefix}}cones, &{{prefix}}settings);\n' \ diff --git a/setup.py b/setup.py index fc4ab6c..406c8ea 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ MAJOR = 0 MINOR = 3 -MICRO = 4 +MICRO = 5 VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) diff --git a/tests/test_E2E_LP.py b/tests/test_E2E_LP.py index 2e79611..b66fe10 100644 --- a/tests/test_E2E_LP.py +++ b/tests/test_E2E_LP.py @@ -149,3 +149,4 @@ def test(name, solver, style, seed): def test_clarabel(): test('network', 'CLARABEL', 'loops', 0) + test('network', 'CLARABEL', 'loops', 1) diff --git a/tests/test_E2E_QP.py b/tests/test_E2E_QP.py index 70242bd..17ff9de 100644 --- a/tests/test_E2E_QP.py +++ b/tests/test_E2E_QP.py @@ -255,3 +255,4 @@ def test_OSQP_verbose(): def test_clarabel(): test('actuator', 'CLARABEL', 'loops', 0) + test('actuator', 'CLARABEL', 'loops', 1) diff --git a/tests/test_E2E_SOCP.py b/tests/test_E2E_SOCP.py index e2a0bb2..c880941 100644 --- a/tests/test_E2E_SOCP.py +++ b/tests/test_E2E_SOCP.py @@ -124,3 +124,4 @@ def test(name, solver, style, seed): def test_clarabel(): test('ADP', 'CLARABEL', 'loops', 0) + test('ADP', 'CLARABEL', 'loops', 1)