Skip to content

Conversation

@lb3825
Copy link

@lb3825 lb3825 commented Dec 3, 2025

Added a T/F setting to allow the user to choose whether to have the termination criteria be based off of the infinity norm or the L-2 norm. This is to be more robust and consistent with other solvers who commonly utilize the infinity norm in their termination criteria.

@ZedongPeng ZedongPeng self-requested a review December 4, 2025 05:30
Copy link
Collaborator

@ZedongPeng ZedongPeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! Supporting L_INF is indeed a great addition for robustness and consistency with other solvers.

However, regarding the API design, let's use a specific option instead of a T/F toggle. I recommend naming it optimality_norm with values L2 and L_INF. This aligns better with our design standards and makes it easier to extend later.

@lb3825
Copy link
Author

lb3825 commented Dec 18, 2025

The API has been updated, please let me know if this is what you had intended or if you had something else in mind.

@lb3825 lb3825 requested a review from ZedongPeng December 18, 2025 20:39
Copy link
Collaborator

@ZedongPeng ZedongPeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @lb3825. I left some feedback on the interface/API design. I know these design choices can be subjective, so feel free to discuss or push back if you have other ideas.

{"verbose", no_argument, 0, 'v'},
{"time_limit", required_argument, 0, 1001},
{"iter_limit", required_argument, 0, 1002},
{"linf_norm", no_argument, 0, 'f'},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be removed.

if (val > max_val) max_val = val;
}
state->objective_vector_norm = sqrt(sum_of_squares);
state->objective_vector_norm_inf = max_val;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to keep both objective_vector_norm and objective_vector_norm_inf. Let's only keep objective_vector_norm and the value of it depends on optimality_norm.

state->absolute_primal_residual / (1.0 + state->constraint_bound_norm);
state->relative_dual_residual =
state->absolute_dual_residual / (1.0 + state->objective_vector_norm);
if (state->optimality_norm == NORM_TYPE_L_INF) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once constraint_bound_norm_inf is removed, the if-else condition can be simplified here.

{"sv_max_iter", required_argument, 0, 1011},
{"sv_tol", required_argument, 0, 1012},
{"eval_freq", required_argument, 0, 1013},
{"optimality_norm", required_argument, 0, 1014},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the CLI, we can use opt_norm here for consistency.

| `-v`, `--verbose` | `flag` | Enable verbose logging. | `false` |
| `--time_limit` | `double` | Time limit in seconds. | `3600.0` |
| `--iter_limit` | `int` | Iteration limit. | `2147483647` |
| `--optimality_norm` | `int` | Norm for optimality criteria: L2 (0) or L_INF (1) | `0` (L2) |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to use

  • L2 and L_INF (or LINF)
  • or l2 and l_inf (or linf) (I personally prefer this one)
    instead of using 0 and 1 here.

UNSPECIFIED = -1

# Norm types for optimality criteria
L2 = 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we remove these constants to keep the namespace clean. Users usually prefer passing strings like l2 or linf, which we can map to the C enums inside the wrapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants