Skip to content

Add bridges to map to zero-based - #28

Merged
blegat merged 3 commits into
mainfrom
bl/zero_based
Aug 15, 2026
Merged

Add bridges to map to zero-based#28
blegat merged 3 commits into
mainfrom
bl/zero_based

Conversation

@blegat

@blegat blegat commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

We could have just hardcoded the -1 in the wrapper, but then we'd have to do the substitutions in all expressions which feels like reimplementing variable bridges.
In the end, let's just substitute in all expressions, it's easier because then we'll get play MOI.VectorOfVariables when there is a constraint on a route. Otherwise I get

  Got exception outside of a @test
  MethodError: no method matching substitute_variables(::MathOptInterface.Bridges.var"#bridged_function##0#bridged_function##1"{MathOptInterface.Bridges.LazyBridgeOptimizer{Hexaly.Optimizer}}, ::MathOptInterface.VectorOfVariables)
  The function `substitute_variables` exists, but no method is defined for this combination of argument types.

  Closest candidates are:
    substitute_variables(::F, ::Vector{MathOptInterface.VariableIndex}) where F<:Function
     @ MathOptInterface ~/.julia/packages/MathOptInterface/j3fye/src/Utilities/functions.jl:462
    substitute_variables(::F, ::MathOptInterface.VariableIndex) where F<:Function
     @ MathOptInterface ~/.julia/packages/MathOptInterface/j3fye/src/Utilities/functions.jl:450
    substitute_variables(::F, ::MathOptInterface.ScalarNonlinearFunction) where F<:Function
     @ MathOptInterface ~/.julia/packages/MathOptInterface/j3fye/src/Utilities/functions.jl:531
    ...

  Stacktrace:
    [1] substitute_variables(variable_map::MathOptInterface.Bridges.var"#bridged_function##0#bridged_function##1"{MathOptInterface.Bridges.LazyBridgeOptimizer{Hexaly.Optimizer}}, f::MathOptInterface.ScalarNonlinearFunction)
      @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/j3fye/src/Utilities/functions.jl:540
    [2] bridged_function
      @ ~/.julia/packages/MathOptInterface/j3fye/src/Bridges/bridge_optimizer.jl:2419 [inlined]
    [3] set
      @ ~/.julia/packages/MathOptInterface/j3fye/src/Bridges/bridge_optimizer.jl:1319 [inlined]

@codecov-commenter

codecov-commenter commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 25 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/MOI/list.jl 0.00% 15 Missing ⚠️
src/MOI/sum_distances_objective.jl 0.00% 10 Missing ⚠️
Files with missing lines Coverage Δ
src/MOI/sum_distances_objective.jl 0.00% <0.00%> (ø)
src/MOI/list.jl 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@blegat

blegat commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author
julia --project
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.12.6 (2026-04-09)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org release
|__/                   |

(Hexaly) pkg> test
     Testing Hexaly
┌ Warning: Entry in manifest at "/home/blegat/.julia/dev/Hexaly/test" for package "CodecZlib" differs from that in "/home/blegat/.julia/dev/Hexaly/Manifest.toml"
└ @ Pkg.Operations ~/.julia/juliaup/julia-1.12.6+0.x64.linux.gnu/share/julia/stdlib/v1.12/Pkg/src/Operations.jl:2262
      Status `/tmp/jl_21QNe0/Project.toml`
  [4e695617] Hexaly v0.1.0 `~/.julia/dev/Hexaly`
  [4076af6c] JuMP v1.31.1
  [b8f27783] MathOptInterface v1.52.0
  [ee161a15] MathOptVRP v0.1.0 `~/.julia/dev/MathOptVRP`
  [9a3f8284] Random v1.11.0
  [8dfed614] Test v1.11.0
      Status `/tmp/jl_21QNe0/Manifest.toml`
  [fa961155] CEnum v0.5.0
  [523fee87] CodecBzip2 v0.8.5
  [944b1d66] CodecZlib v0.7.9
  [bbf7d656] CommonSubexpressions v0.3.1
  [163ba53b] DiffResults v1.1.0
  [b552c78f] DiffRules v1.16.0
  [ffbed154] DocStringExtensions v0.9.5
  [f6369f11] ForwardDiff v1.4.5
  [4e695617] Hexaly v0.1.0 `~/.julia/dev/Hexaly`
  [92d709cd] IrrationalConstants v0.2.6
  [692b3bcd] JLLWrappers v1.8.0
  [682c06a0] JSON v1.7.1
  [4076af6c] JuMP v1.31.1
  [2ab3a3ac] LogExpFunctions v1.0.1
  [1914dd2f] MacroTools v0.5.16
  [b8f27783] MathOptInterface v1.52.0
  [ee161a15] MathOptVRP v0.1.0 `~/.julia/dev/MathOptVRP`
  [d8a4904e] MutableArithmetics v1.8.0
  [77ba4419] NaNMath v1.1.4
⌅ [bac558e1] OrderedCollections v1.8.2
  [69de0a69] Parsers v2.8.7
  [aea7be01] PrecompileTools v1.3.4
  [21216c6a] Preferences v1.5.2
  [276daf66] SpecialFunctions v2.8.3
  [1e83bf80] StaticArraysCore v1.4.4
  [ec057cc2] StructUtils v2.8.5
  [3bb67fe8] TranscodingStreams v0.11.3
  [6e34b625] Bzip2_jll v1.0.9+0
  [efe28fd5] OpenSpecFun_jll v0.5.6+0
  [0dad84c5] ArgTools v1.1.2
  [56f22d72] Artifacts v1.11.0
  [2a0f44e3] Base64 v1.11.0
  [ade2ca70] Dates v1.11.0
  [f43a241f] Downloads v1.7.0
  [7b1f6079] FileWatching v1.11.0
  [b77e0a4c] InteractiveUtils v1.11.0
  [ac6e5ff7] JuliaSyntaxHighlighting v1.12.0
  [b27032c2] LibCURL v0.6.4
  [76f85450] LibGit2 v1.11.0
  [8f399da3] Libdl v1.11.0
  [37e2e46d] LinearAlgebra v1.12.0
  [56ddb016] Logging v1.11.0
  [d6f4376e] Markdown v1.11.0
  [ca575930] NetworkOptions v1.3.0
  [44cfe95a] Pkg v1.12.1
  [de0858da] Printf v1.11.0
  [9a3f8284] Random v1.11.0
  [ea8e919c] SHA v0.7.0
  [9e88b42a] Serialization v1.11.0
  [2f01184e] SparseArrays v1.12.0
  [f489334b] StyledStrings v1.11.0
  [fa267f1f] TOML v1.0.3
  [a4e569a6] Tar v1.10.0
  [8dfed614] Test v1.11.0
  [cf7118a7] UUIDs v1.11.0
  [4ec0a83e] Unicode v1.11.0
  [e66e0078] CompilerSupportLibraries_jll v1.3.0+1
  [deac9b47] LibCURL_jll v8.15.0+0
  [e37daf67] LibGit2_jll v1.9.0+0
  [29816b5a] LibSSH2_jll v1.11.3+1
  [14a3606d] MozillaCACerts_jll v2025.11.4
  [4536629a] OpenBLAS_jll v0.3.29+0
  [05823500] OpenLibm_jll v0.8.7+0
  [458c3c95] OpenSSL_jll v3.5.4+0
  [bea87d4a] SuiteSparse_jll v7.8.3+2
  [83775a58] Zlib_jll v1.3.1+2
  [8e850b90] libblastrampoline_jll v5.15.0+0
  [8e850ede] nghttp2_jll v1.64.0+1
  [3f19e933] p7zip_jll v17.7.0+0
        Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading.
Precompiling for configuration --code-coverage=none --color=yes --check-bounds=yes --warn-overwrite=yes --depwarn=yes --inline=yes --startup-file=no --track-allocation=none
Precompiling packages finished.
  1 dependency successfully precompiled in 3 seconds. 62 already precompiled.
     Testing Running tests...
[ Info: Hexaly version: 15.0.0
[ Info: TSP optimal cost: 80
[ Info: Running test_HermitianPSDCone_basic
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_HermitianPSDCone_min_t
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_NormNuclearCone_VectorAffineFunction_with_transform
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_NormNuclearCone_VectorAffineFunction_without_transform
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_NormNuclearCone_VectorOfVariables_with_transform
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_NormNuclearCone_VectorOfVariables_without_transform
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_NormSpectralCone_VectorAffineFunction_with_transform
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_NormSpectralCone_VectorAffineFunction_without_transform
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_NormSpectralCone_VectorOfVariables_with_transform
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_NormSpectralCone_VectorOfVariables_without_transform
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_VectorNonlinearOracle_LagrangeMultipliers_MAX_SENSE
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_VectorNonlinearOracle_LagrangeMultipliers_MIN_SENSE
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_add_constrained_PositiveSemidefiniteConeTriangle
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_add_constrained_PositiveSemidefiniteConeTriangle_VariableName
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_add_constrained_PositiveSemidefiniteConeTriangle_VariablePrimalStart
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_attribute_AbsoluteGapTolerance
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_attribute_NodeLimit
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_attribute_NumberThreads
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_attribute_ObjectiveLimit
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_attribute_RawStatusString
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_attribute_RelativeGapTolerance
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_attribute_Silent
[ Info: Running test_attribute_SolutionLimit
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_attribute_SolveTimeSec
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_attribute_SolverName
[ Info: Running test_attribute_SolverVersion
[ Info: Running test_attribute_TimeLimitSec
[ Info: Running test_attribute_VariableBridgingCost
[ Info: Running test_attribute_after_empty
[ Info: Running test_attribute_unsupported_constraint
[ Info: Running test_constraint_ConstraintDualStart
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_constraint_ConstraintPrimalStart
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_constraint_Indicator_ACTIVATE_ON_ONE
[ Info: Running test_constraint_Indicator_ACTIVATE_ON_ZERO
[ Info: Running test_constraint_Indicator_ConstraintName
[ Info: Running test_constraint_PrimalStart_DualStart_SecondOrderCone
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_constraint_qcp_duplicate_diagonal
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_constraint_qcp_duplicate_off_diagonal
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_cpsat_AllDifferent
[ Info: Running test_cpsat_Circuit
[ Info: Running test_cpsat_CountAtLeast
[ Info: Running test_cpsat_CountBelongs
[ Info: Running test_cpsat_CountDistinct
[ Info: Running test_cpsat_CountGreaterThan
[ Info: Running test_cpsat_Cumulative
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_cpsat_Path
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_cpsat_ReifiedAllDifferent
  Test errored with MathOptInterface.SetAttributeNotAllowed{MathOptInterface.ConstraintSet}
[ Info: Running test_cpsat_Table
[ Info: Running test_model_ListOfConstraintsWithAttributeSet
[ Info: Running test_model_ListOfVariablesWithAttributeSet
[ Info: Running test_model_LowerBoundAlreadySet
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_model_Name
[ Info: Running test_model_ScalarFunctionConstantNotZero
[ Info: Running test_model_UpperBoundAlreadySet
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_model_VariableIndex_ConstraintName
[ Info: Running test_model_VariableName
[ Info: Running test_model_VariablePrimalStart
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_model_copy_to_UnsupportedAttribute
[ Info: Running test_model_copy_to_UnsupportedConstraint
[ Info: Running test_model_default_DualStatus
[ Info: Running test_model_default_ObjectiveSense
[ Info: Running test_model_default_PrimalStatus
[ Info: Running test_model_default_TerminationStatus
[ Info: Running test_model_delete
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_model_duplicate_VariableName
[ Info: Running test_model_empty
[ Info: Running test_model_is_valid
[ Info: Running test_model_show
[ Info: Running test_model_supports_constraint_ScalarAffineFunction_EqualTo
[ Info: Running test_model_supports_constraint_VariableIndex_EqualTo
[ Info: Running test_model_supports_constraint_VectorOfVariables_Nonnegatives
[ Info: Running test_multi_objective_solve_and_objective_value
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_multiobjective_vector_affine_function
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_multiobjective_vector_affine_function_delete
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_multiobjective_vector_affine_function_delete_vector
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_multiobjective_vector_affine_function_modify
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_multiobjective_vector_nonlinear
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_multiobjective_vector_nonlinear_delete
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_multiobjective_vector_nonlinear_delete_vector
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_multiobjective_vector_nonlinear_modify
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_multiobjective_vector_of_variables
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_multiobjective_vector_of_variables_delete
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_multiobjective_vector_of_variables_delete_all
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_multiobjective_vector_of_variables_delete_vector
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_multiobjective_vector_quadratic_function
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_multiobjective_vector_quadratic_function_delete
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_multiobjective_vector_quadratic_function_delete_vector
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_multiobjective_vector_quadratic_function_modify
  Test errored with MathOptInterface.Test.RequirementUnmet
[ Info: Running test_objective_ObjectiveFunction_blank
[ Info: Running test_objective_ObjectiveSense_FEASIBILITY_SENSE
[ Info: Running test_objective_ObjectiveSense_MAX_SENSE
[ Info: Running test_objective_ObjectiveSense_MIN_SENSE
[ Info: Running test_objective_ScalarAffineFunction_in_ListOfModelAttributesSet
[ Info: Running test_objective_ScalarQuadraticFunction_in_ListOfModelAttributesSet
[ Info: Running test_objective_VariableIndex_in_ListOfModelAttributesSet
[ Info: Running test_variable_VariableName
[ Info: Running test_variable_get_VariableIndex
Test Summary: | Pass  Total   Time
Hexaly        |  208    208  57.7s
     Testing Hexaly tests passed

julia> versioninfo()
Julia Version 1.12.6
Commit 15346901f00 (2026-04-09 19:20 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 20 × 12th Gen Intel(R) Core(TM) i7-12700K
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, alderlake)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 20 virtual cores)

julia> import Hexaly

julia> Hexaly.version()
v"15.0.0"

@blegat
blegat merged commit 5e07a3d into main Aug 15, 2026
2 checks passed
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