Skip to content

the L2-norm ball in case of a mixed-integer problem#269

Draft
LJS42 wants to merge 21 commits into
ZIB-IOL:mainfrom
LJS42:moreLMO
Draft

the L2-norm ball in case of a mixed-integer problem#269
LJS42 wants to merge 21 commits into
ZIB-IOL:mainfrom
LJS42:moreLMO

Conversation

@LJS42

@LJS42 LJS42 commented Nov 29, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@codecov

codecov Bot commented Nov 29, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.19608% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.83%. Comparing base (ee5cc6c) to head (ce497c6).
⚠️ Report is 112 commits behind head on main.

Files with missing lines Patch % Lines
src/polytope_blmos.jl 90.19% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #269      +/-   ##
==========================================
- Coverage   86.23%   84.83%   -1.40%     
==========================================
  Files          17       22       +5     
  Lines        1482     2691    +1209     
==========================================
+ Hits         1278     2283    +1005     
- Misses        204      408     +204     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LJS42

LJS42 commented Dec 3, 2025

Copy link
Copy Markdown
Contributor Author

only 2normball here

Comment thread src/polytope_blmos.jl Outdated
count = 0
for idx in 1:length(int_vars)
if !(lb[idx] <= 0 <= ub[idx])
count = count + 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

count += count

Comment thread src/polytope_blmos.jl
if !(lb[idx] <= 0 <= ub[idx])
count = count + 1
end
if count > 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A comment would be helpful here, the code is not very clear.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added the comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So we are just tackling the case of radius=1? Then, this has to be more clear in the function definition.

Comment thread src/polytope_blmos.jl Outdated
BLMO denotes the L2normBall, It is unit ball which means R = 1
"""

struct L2normBallBLMO <: FrankWolfe.LinearMinimizationOracle end

Copy link
Copy Markdown
Member

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 an extra struct here.

Comment thread src/polytope_blmos.jl Outdated

struct L2normBallBLMO <: FrankWolfe.LinearMinimizationOracle end

function bounded_compute_extreme_point(blmo::L2normBallBLMO, d, lb, ub, int_vars; kwargs...)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Write instead

function bounded_compute_extreme_point(blmo::FrankWolfe.LpNormBallLMO{T,2}, d, lb, ub, int_vars; kwargs...)
...
end

And the same for the other two functions here.

Comment thread test/LMO_test.jl
end

# Test for L2normBallBLMO
@testset "L2normBall BLMO continuous" begin

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You are not testing the continuous case here, though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Now it test the continuous case

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You still have num_int=5. So it is still an integer problem.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

But for the optimum, the integer entries (dimension) are all 0, the values are all in continuous entries.

Comment thread test/LMO_test.jl Outdated
Comment on lines +249 to +250
lower_bounds = fill(-2.0, num_int)
upper_bounds = fill(2.0, num_int)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Directly, fill with 1.0 and -1.0 directly.

Comment thread test/LMO_test.jl
Comment on lines +226 to +235
# Generate a solution inside the L2 ball (||x|| <= 1)
x_sol = randn(rng, n)
x_sol = x_sol ./ (norm(x_sol) * 1.5)

# Round some coordinates to integers for testing
num_int = 5
int_indices = sort(rand(rng, 1:n, num_int))
for idx in int_indices
x_sol[idx] = 0
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How can you guarantee that x_sol will stay inside the ball? If you cannot, the tests later will fail even if we find the correct solution.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

x_sol = x_sol ./ (norm(x_sol) * 1.5) here guarantee that x_sol will stay inside the ball

Comment thread test/LMO_test.jl Outdated
@test isapprox(f(x), f(result[:raw_solution]), atol=1e-6, rtol=1e-3)
end

@testset "L2normBall BLMO integer 1" begin

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is not difference between the tests? One is sufficient.

@LJS42 LJS42 changed the title the L2-norm ball in case of a mixed-integer problem and the ConvexHullLMO the L2-norm ball in case of a mixed-integer problem Dec 17, 2025
Comment thread src/polytope_blmos.jl
Comment on lines +720 to +725
"""
2normBallBLMO()

BLMO denotes the L2normBall, It is unit ball which means R = 1
"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add some documentation here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes we are just tackling the case of radius=1. I am still thinking and working on the general case.

Comment thread src/polytope_blmos.jl
if !(lb[idx] <= 0 <= ub[idx])
count = count + 1
end
if count > 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So we are just tackling the case of radius=1? Then, this has to be more clear in the function definition.

Comment thread test/LMO_test.jl
end

# Test for L2normBallBLMO
@testset "L2normBall BLMO continuous" begin

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You still have num_int=5. So it is still an integer problem.

@dhendryc dhendryc marked this pull request as draft March 6, 2026 09:58
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