Skip to content

MindtPy short-circuit follow-up: avoid duplicate structure checks and refine continuous QP/QCP routing #3906

@bernalde

Description

@bernalde

Summary

In the no-discrete short-circuit path, MindtPy currently does two things that are worth revisiting:

  1. It recomputes structural information in model_is_valid() by walking polynomial degree over every constraint and the objective, even though the utility block setup has already classified constraints into linear and nonlinear lists.
  2. It routes any continuous non-LP model to the NLP solver without considering whether the selected MIP solver can directly handle a continuous QP or QCP.

This issue tracks a follow-up refactor separate from #3861, which should stay focused on returning consistent results and loading primal values in the existing short-circuit path.

Related: #3861

Proposed work

1. Remove duplicate structure checks

Reuse the structure information already built during utility-block setup instead of re-walking polynomial degree in the short-circuit check.

Concretely:

  • reuse the preclassified linear/nonlinear constraint lists that are already built for the working model
  • cache or reuse the objective degree once where needed
  • keep existing quadratic_strategy semantics unchanged unless a separate design decision explicitly changes them

2. Evaluate capability-aware routing for continuous QP/QCP models

Refine the no-discrete short-circuit path so that continuous QP/QCP models can use the selected MIP solver when that solver explicitly supports the required quadratic structure.

Concretely:

  • prefer the selected mip_solver for continuous QP models only when its interface explicitly supports quadratic objectives
  • prefer the selected mip_solver for continuous QCP models only when its interface explicitly supports quadratic constraints
  • otherwise continue routing to the configured nlp_solver
  • preserve current behavior for plain LP and general NLP models unless the new routing rules apply

Non-goals

  • Do not implement a blanket "try MIP and fall back to NLP on any failure" policy.
  • Do not treat infeasible, unbounded, time-limit, or solver-error outcomes from the MIP solver as a signal to silently retry with the NLP solver.
  • Do not add a new public config option unless the implementation proves it is necessary.

Test plan

Add targeted short-circuit tests for:

  • continuous QP models where a quadratic-capable MIP solver should be preferred
  • continuous QCP models only for solver interfaces that explicitly support quadratic constraints
  • unsupported quadratic cases that should remain on the NLP path
  • failure cases proving infeasible, error, or time-limit results are not silently converted into a fallback solve

Acceptance criteria

  • The short-circuit path no longer duplicates the full constraint degree walk already done during utility-block setup.
  • Continuous QP/QCP routing depends on explicit solver capability, not just degree classification.
  • Existing quadratic_strategy behavior remains unchanged unless intentionally revised in the follow-up implementation.
  • The current Fix no results returned when no discrete variables are present in MindtPy #3861 regression tests remain valid without broadening that PR scope.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions