Skip to content

Commit 59b468d

Browse files
committed
update python interface
1 parent b84e862 commit 59b468d

4 files changed

Lines changed: 4 additions & 19 deletions

File tree

python/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ Below is a list of commonly used parameters, their internal keys, and descriptio
163163
| `OptimalityNorm` | `optimality_norm` | string | `"l2"` | Norm for optimality criteria. Use `"l2"` for L2 norm or `"linf"` for infinity norm. |
164164
| `OptimalityTol` | `eps_optimal_relative` | float | `1e-4` | Relative tolerance for optimality gap. Solver stops if the relative primal-dual gap ≤ this value. |
165165
| `FeasibilityTol` | `eps_feasible_relative` | float | `1e-4` | Relative feasibility tolerance for primal/dual residuals. |
166-
| `RuizIters` | `l_inf_ruiz_iterations` | int | `10` | Number of iterations for L∞ Ruiz scaling. Improves numerical conditioning. |
166+
| `GeoMeanIters` | `geometric_mean_iterations` | int | `12` | Number of iterations of geometric-mean scaling. Improves numerical conditioning. |
167+
| `RuizIters` | `l_inf_ruiz_iterations` | int | `10` | Number of iterations of L∞ Ruiz scaling. Improves numerical conditioning. |
167168
| `UsePCAlpha` | `has_pock_chambolle_alpha` | bool | `True` | Whether to use the Pock–Chambolle α step size adjustment. |
168169
| `PCAlpha` | `pock_chambolle_alpha` | float | `1.0` | Value of the Pock–Chambolle α parameter. |
169170
| `BoundObjRescaling` | `bound_objective_rescaling` | bool | `True` | Whether to rescale the objective vector during preprocessing. |

python/cupdlpx/PDLP.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"OptimalityTol": "eps_optimal_relative",
4343
"FeasibilityTol": "eps_feasible_relative",
4444
# scaling / step size
45+
"GeoMeanIters": "geometric_mean_iterations",
4546
"RuizIters": "l_inf_ruiz_iterations",
4647
"UsePCAlpha": "has_pock_chambolle_alpha",
4748
"PCAlpha": "pock_chambolle_alpha",

src/utils.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ bool should_do_adaptive_restart(pdhg_solver_state_t *solver_state,
301301

302302
void set_default_parameters(pdhg_parameters_t *params)
303303
{
304-
params->l_inf_ruiz_iterations = 10;
305304
params->geometric_mean_iterations = 12;
305+
params->l_inf_ruiz_iterations = 10;
306306
params->has_pock_chambolle_alpha = true;
307307
params->pock_chambolle_alpha = 1.0;
308308
params->bound_objective_rescaling = true;

test/test_api_surface.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import os
16-
1715
import numpy as np
1816
import scipy.sparse as sp
1917
import pytest
@@ -412,18 +410,3 @@ def test_optimize_rejects_bad_sense(base_lp_data):
412410
model._model_sense = 999 # bypass the property to hit optimize()'s guard
413411
with pytest.raises(ValueError):
414412
model.optimize()
415-
416-
417-
def test_read_mps_roundtrip():
418-
"""read() loads an MPS file into a usable Model."""
419-
path = os.path.join(os.path.dirname(__file__), "cplex2.mps")
420-
model = read(path)
421-
assert model.num_vars > 0
422-
assert model.num_constrs > 0
423-
assert model.A.shape == (model.num_constrs, model.num_vars)
424-
assert model.ModelSense in (PDLP.MINIMIZE, PDLP.MAXIMIZE)
425-
426-
427-
def test_read_mps_missing_file():
428-
with pytest.raises(FileNotFoundError):
429-
read("this_file_does_not_exist.mps")

0 commit comments

Comments
 (0)