Skip to content

Develop#67

Draft
ocots wants to merge 196 commits intomainfrom
develop
Draft

Develop#67
ocots wants to merge 196 commits intomainfrom
develop

Conversation

@ocots
Copy link
Member

@ocots ocots commented Feb 11, 2026

No description provided.

ocots added 30 commits January 19, 2026 16:09
…ualify AbstractOptimizationSolver references
- Implement AbstractStrategy contract with type-level and instance-level methods
- Add StrategyMetadata for option specifications with validation
- Create StrategyRegistry for explicit dependency management
- Provide strategy builders and configuration utilities
- Include introspection API for metadata and option access
- Add comprehensive test suite (423 tests passing)
- Follow CTModels.jl patterns for consistency

Features:
- Two-level contract (type metadata + instance configuration)
- Immutable registry pattern for strategy lookup
- Option provenance tracking (user/default/computed)
- Alias resolution and suggestion utilities
- Full validation pipeline with detailed error messages
- Implement smart option routing with disambiguation support
- Add strategy-to-family mapping and option ownership detection
- Provide method-based strategy builders and introspection wrappers
- Support single and multi-strategy disambiguation syntax
- Include comprehensive test suite (79 tests passing)

Features:
- route_all_options() - main routing function with auto-routing
- extract_strategy_ids() - disambiguation syntax detection
- build_strategy_to_family_map() - strategy family mapping
- build_option_ownership_map() - option ownership detection
- build_strategy_from_method() - convenience strategy builders
- Detailed error messages with actionable suggestions

Disambiguation syntax:
- Single: backend = (:sparse, :adnlp)
- Multi: backend = ((:sparse, :adnlp), (:cpu, :ipopt))
- Auto-routing for unambiguous options
- Implement AbstractOptimizationProblem contract with builder interface
- Add concrete builder types for ADNLPModels and ExaModels backends
- Provide model and solution building functions (build_model, build_solution)
- Include solver info extraction utilities (extract_solver_infos)
- Add comprehensive test suite (139 tests passing)
- Update MadNLP extension with solver info extraction
- Migrate test problems from CTModels to CTSolvers

Features:
- AbstractOptimizationProblem contract with 4 required builder methods
- ADNLPModelBuilder and ExaModelBuilder callable builders
- ADNLPSolutionBuilder and ExaSolutionBuilder for solution conversion
- Type-stable builder patterns with proper error handling
- Integration with real test problems (Rosenbrock, Elec, etc.)
- Support for different numeric types (Float32, Float64)

Contract methods:
- get_adnlp_model_builder() / get_exa_model_builder()
- get_adnlp_solution_builder() / get_exa_solution_builder()
- build_model() / build_solution() for generic workflows
- extract_solver_infos() for standardized solver metadata
- Implement AbstractOptimizationModeler extending AbstractStrategy
- Add ADNLPModeler with comprehensive options and validation
- Add ExaModeler with type and backend flexibility
- Include robust validation functions and comprehensive tests (106 passing)

Features:
- ADNLPModeler: show_time, backend, matrix_free, name options
- Advanced backend overrides for expert users
- ExaModeler: base_type, backend options with KernelAbstractions support
- Full integration with Strategies and Options modules
- Generic option passing to backend builders
- Implement DiscretizedOptimalControlProblem type extending AbstractOptimizationProblem
- Provide contract implementation with ADNLP and ExaModel builders
- Include accessors for OCP model retrieval (ocp_model)
- Add convenient building functions (nlp_model, ocp_solution)
- Include comprehensive test suite (48 tests passing)

Features:
- DiscretizedOptimalControlProblem type with builder storage
- Full AbstractOptimizationProblem contract implementation
- Integration with CTModels.OCP.AbstractOptimalControlProblem
- Convenient API for model and solution building
- Type-safe accessors and builders
- Complete workflow testing with both backends

Contract methods:
- get_adnlp_model_builder() / get_exa_model_builder()
- get_adnlp_solution_builder() / get_exa_solution_builder()
- nlp_model() / ocp_solution() for convenient workflows
- ocp_model() for accessing original OCP
- Update end-to-end tests to use CTSolvers modules instead of CTModels
- Fix imports: CTModels.Optimization → CTSolvers.Optimization
- Fix imports: CTModels.DOCP → CTSolvers.DOCP
- Fix modeler references: CTModels.ADNLPModeler → Modelers.ADNLPModeler
- Fix modeler references: CTModels.ExaModeler → Modelers.ExaModeler
- Remove broken MadNLP extension tests (32 tests now passing)
- Add comprehensive end-to-end integration tests

Changes:
- test/suite/integration/test_end_to_end.jl: Updated for CTSolvers
- test/suite/extensions/: Cleaned up and fixed test structure
- All references now point to correct CTSolvers modules
- Modelers namespace properly qualified
- Integration tests verify complete workflows
- Fix Modelers namespace qualification in integration tests
- Ensure all modeler references use correct CTSolvers.Modelers module
- Update test structure for complete workflow verification
Phase A: Enriched exceptions
- Replace error() with Exceptions.IncorrectArgument in all solver validators
- Add detailed context to ExtensionError in solver stubs
- Update tests to expect new exception types

Phase B: DocStringExtensions
- Add  and  to all solver types
- Enhance documentation with structured sections and examples
- Document AbstractStrategy contracts and implementation notes

Phase C: Type stability
- Add comprehensive type stability tests (34 tests)
- Test @inferred for critical functions
- Verify type-stable solver construction and contract methods

All tests pass: 1112/1112
Production-ready code with full architectural compliance
- Add validator for linear_solver option with all 10 supported solvers
- Update docstring with detailed solver descriptions
- Include enriched exception messages with suggestions
- Reference Ipopt documentation for solver options

Supported solvers: ma27, ma57, ma77, ma86, ma97, pardiso, pardisomkl, spral, wsmp, mumps
- Add 3 new output options: print_timing_statistics, print_frequency_iter, print_frequency_time
- Enhanced validation with detailed error messages and usage suggestions
- Update docstring with structured Output Options section
- Maintain backward compatibility with existing options

New output options provide fine-grained control over solver verbosity
and timing information, following Ipopt documentation standards.

Note: Remember to add timing_statistics option for complete timing control.
- Add timing_statistics option in Algorithm Options section
- Enable measurement of time spent in Ipopt and NLP evaluation components
- Overall algorithm time remains unaffected by this option
- Add enriched validation with detailed error messages
- Update docstring with complete Algorithm Options documentation

Completes the timing control suite alongside print_timing_statistics option.
- Fix option names: max_iter→maxit, tol→feastol_abs+opttol_abs, outlev→print_level
- Add proper aliases for backward compatibility (max_iter, maxiter, outlev)
- Update docstring with correct option names and descriptions
- Fix examples to use correct option names
- Maintain enriched validation with detailed error messages

Options now correctly match the NLPModelsKnitro extension interface:
- maxit (max_iter, maxiter): Maximum iterations
- feastol_abs: Absolute feasibility tolerance
- opttol_abs: Absolute optimality tolerance
- print_level (outlev): Output verbosity level
- Add 7 termination options: maxit, maxtime, maxfevals, feastol_abs, opttol_abs, ftol, xtol
- Add 1 algorithm option: soltype for solution type selection
- Fix outlev option: correct name from print_level, update default to 2, and add range validation (0-6)
- Update docstring with detailed option descriptions based on Knitro documentation
- Organize options in clear sections: Termination, Algorithm, Output
- Maintain enriched validation with detailed error messages and suggestions

KnitroSolver now provides comprehensive control over:
- 7 termination options for convergence criteria
- Algorithm selection for solution type
- 6-level output verbosity control (0=no output to 6=all details)

All options follow Knitro documentation standards with proper validation.
- Source file now contains only: struct, Strategies.id(), tag dispatch stubs
- Extension contains: metadata with all options, constructor, callable interface
- Tag dispatch pattern: IpoptTag for clean separation
- Display handling in extension: print_level=0 when display=false
- All 13 Ipopt options with validation moved to extension

This follows the new architecture where sources have only abstract contracts
and extensions provide complete implementation.
- Source file now contains only: struct, Strategies.id(), tag dispatch stubs
- Removed all metadata (will be moved to extension)
- Added KnitroTag for tag dispatch pattern
- Constructor, callable, and metadata stubs throw ExtensionError

Next: Need to complete CTSolversKnitro extension with metadata and callable
- Extension now contains all 9 Knitro options with validation
- Termination: maxit, maxtime, maxfevals, feastol_abs, opttol_abs, ftol, xtol
- Algorithm: soltype
- Output: outlev (alias print_level)
- Constructor via tag dispatch: build_knitro_solver
- Callable with display handling: outlev=0 when display=false
- Backend interface: solve_with_knitro

KnitroSolver refactoring complete: source has only stubs, extension has full implementation
- Removed complex tag dispatch system for types/defaults
- Source file now contains only: struct, Strategies.id(), tag dispatch stubs
- Removed all metadata (will be moved to extension)
- Added MadNLPTag for tag dispatch pattern
- Constructor, callable, and metadata stubs throw ExtensionError

Next: Complete CTSolversMadNLP extension with proper options from old ext
- Extension now contains 4 MadNLP options from old extension
- max_iter (default: 3000), tol (default: 1e-8)
- print_level (MadNLP.LogLevels, default: MadNLP.INFO)
- linear_solver (Type{<:MadNLP.AbstractLinearSolver}, default: MadNLPMumps.MumpsSolver)
- Constructor via tag dispatch: build_madnlp_solver
- Callable with display handling: print_level=MadNLP.ERROR when display=false
- Backend interface: solve_with_madnlp
- Kept extract_solver_infos for MadNLP statistics

MadNLPSolver refactoring complete: source has only stubs, extension has full implementation
- Improved ExtensionError messages in all build_*_solver stubs
- Messages now clearly state: 'to create Solver, access options, and solve problems'
- Added explicit context: 'Load Extension first: using Package'
- Removed unnecessary callable and backend function stubs
- Removed unnecessary Strategies.metadata stubs (extension defines it directly)
- Simplified MadNCLSolver source file with tag dispatch pattern

All 4 solver source files now have clean, minimal stubs with helpful error messages
- Extension now contains 5 MadNCL options from old extension
- max_iter (default: 3000), tol (default: 1e-8)
- print_level (MadNLP.LogLevels, default: MadNLP.INFO)
- linear_solver (Type{<:MadNLP.AbstractLinearSolver}, default: MadNLPMumps.MumpsSolver)
- ncl_options (MadNCL.NCLOptions, default: NCLOptions with verbose=true, opt_tol=1e-8, feas_tol=1e-8)
- Constructor via tag dispatch: build_madncl_solver
- Callable with special display handling:
  * print_level=MadNLP.ERROR when display=false
  * ncl_options.verbose=false when display=false (reconstructs NCLOptions)
- Backend interface: solve_with_madncl

MadNCLSolver refactoring complete: source has only stubs, extension has full implementation
ALL 4 SOLVERS NOW REFACTORED: Ipopt, Knitro, MadNLP, MadNCL
- Remove obsolete migration_to_ctsolvers directory and files
- Clean up solver extension stubs
- Reorganize test problems and remove unused solution examples
- Update MadNLP solver info extraction tests
- Move old resources to archive directory
…ve API)

- test_solver_types.jl: Type hierarchy and Strategies.id() contracts (39 tests)
- test_extension_stubs.jl: ExtensionError stubs with concrete tags (24 tests)
- test_common_solve_api.jl: CommonSolve API with FakeSolver (19 tests)

All 82 tests pass. Structure follows testing rules with modules and qualification.
ocots added 30 commits February 14, 2026 13:00
- Add v0.3.1-beta section to CHANGELOG with backend override enhancements
- Note no breaking changes in v0.3.1-beta in BREAKING.md
- Document Type{<:ADBackend} and ADBackend instance support
- Include technical details and usage examples
- Fix MD060 table formatting in CHANGELOG.md
- Replace @info logs with silent comments for CUDA GPU skips
- Redirect stdout for show_time=true test to suppress timing output
- Keep test logic intact while reducing noise
- Implement extract_solver_infos for MadNCL.NCLStats in CTSolversMadNCL.jl
- MadNCL correctly handles maximization (no sign flip needed, unlike MadNLP)
- Add comprehensive test suite with consistency check for maximization
- Tests use proven TestProblems (Rosenbrock, Max1MinusX2) for reliability
- Include unit tests and integration tests following project standards
- Consistency test detects if MadNCL behavior changes in future
- Add SolverInfos construction verification tests for all solver extensions
- Create new generic extract_solver_infos test file with MockStats
- Enhance MadNLP and MadNCL extension tests with complete contract verification
- Verify types and structure compatibility with build_solution function
- Add 60 new tests covering contract safety and integration
- Ensure extracted solver data can construct SolverInfos objects correctly

Tests: 548 pass (was 488), all extensions verified
- Add comprehensive build_solution contract tests (60 new tests)
- Verify SolverInfos construction compatibility
- Enhance MadNLP, MadNCL, and generic extension tests
- Ensure complete contract safety with build_solution function
- Add comprehensive build solution contract tests entry
- Document 60 new tests for SolverInfos construction verification
- Note test coverage increase from 488 to 548 tests
- Record contract compliance verification for all solver extensions
… bypass, remove mode parameter from route_all_options

- route_all_options: remove mode parameter, focus on pure routing
- build_strategy_options: detect and handle BypassValue unconditionally
- Add bypass(val) wrapper for explicit validation bypass
- Update all tests to use new bypass API instead of mode=:permissive
- Improve error messages with bypass suggestions
- Simplify responsibilities: route_all_options routes, build_strategy_options validates
- test_bypass.jl: Add unit tests for bypassing type validation and overwriting defaults with different types
- test_configuration.jl: Add unit tests for BypassValue handling in build_strategy_options
BREAKING.md:
- Document removal of mode parameter from route_all_options
- Add migration guide for mode=:permissive → bypass(val)
- Explain new BypassValue{T} type and benefits

CHANGELOG.md:
- Add comprehensive v0.3.6-beta section
- Document breaking changes, new features, and migration path
- Highlight architectural improvements and benefits
When an action option (e.g., display or initial_guess) is explicitly
provided by the user and it also exists in a strategy family, it intercepts
the option before strategy routing. We now detect this shadowing and emit an
@info message to warn the user, suggesting the use of route_to.
- routing.jl: exclude RoutedOptions from action extraction so that
  route_to(strategy=val) correctly bypasses action option interception
- routing.jl: re-integrate RoutedOptions into remaining_kwargs for
  normal strategy routing after action extraction
- test_routing.jl: add ShadowingSolver mock (top-level) and 3 tests:
  1. @info emitted when user provides an option that shadows a strategy
  2. no log when action option is at default (not user-provided)
  3. route_to correctly bypasses action extraction and reaches strategy
…entation

- Add @info warning when action options shadow strategy options
- Fix route_to to bypass action extraction for RoutedOptions
- Add comprehensive tests for shadowing detection and bypass
- All tests passing (65/65 in test_routing.jl)
- BREAKING.md: Document new shadowing warnings and fixed route_to behavior
- CHANGELOG.md: Add comprehensive changelog entry with examples
- Note: Changes are non-breaking, only add warnings and fix bugs
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.

1 participant