Skip to content

lazied_dicg #532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 38 commits into from
Feb 26, 2025
Merged

lazied_dicg #532

merged 38 commits into from
Feb 26, 2025

Conversation

WenjieXiao-2022
Copy link
Contributor

No description provided.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@dhendryc dhendryc reopened this Nov 19, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
src/dicg.jl Outdated
extra_vertex_storage=nothing,
lazy_tolerance=2.0,
memory_mode::MemoryEmphasis=InplaceEmphasis(),
variant = "standard",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since you only have two variants it might be cleaner to use a boolean flag here. For example, using_blended which would be true if blended_dicg was used and false otherwise.

src/dicg.jl Outdated
memory_mode::MemoryEmphasis=InplaceEmphasis(),
variant = "standard",
strong_lazification = false,
use_extra_vertex_storage = false,
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is a specific function for the lazy version of dicg, we always use the extra vertex storage, no? In which case, the default value for use_extra_vertex_storage should be true.

src/dicg.jl Outdated
Comment on lines 567 to 577
if !strong_lazification
a = a_taken
d = muladd_memory_mode(memory_mode, d, a, v_taken)
step_type = ST_PAIRWISE
away_index = -1
else
a = a_taken
d = muladd_memory_mode(memory_mode, d, a, v_taken)
step_type = ST_PAIRWISE
away_index = a_local_loc
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

The only thing that is different is away_index, isn't it? That can be done cleaner as

away_index = strong_lazification ? a_local_loc : -1

src/dicg.jl Outdated
away_index = a_local_loc
end
else
a = compute_inface_extreme_point(lmo, NegatingArray(gradient), x)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You seem to be calling this twice! For Blended in line 559 and for non strong lazification in line 538.

return reshape(a, n, n)
end

# Fast way to compute gamma_max.
# Check every constraint and compute the corresponding gamma_upper_bound.
function dicg_maximum_step(lmo::MathOptLMO{OT}, direction, x) where {OT}
function dicg_maximum_step(lmo::MathOptLMO{OT}, direction, x;tol=1e-6) where {OT}
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be good to have a doc string here, i.e.

"""
Description of the function.
"""

This would also be good for the compute_inface_extreme_point as well as is_inface_feasible function.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Copy link
Collaborator

@dhendryc dhendryc left a comment

Choose a reason for hiding this comment

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

Make sure that every function has a comment like

"""
Description.
"""

This way, it will be automatically listed in the API for the package.


if grad_dot_a_taken - grad_dot_v_inface >= phi &&
grad_dot_a_taken - grad_dot_v_inface >= epsilon
step_type = ST_LAZY
Copy link
Collaborator

Choose a reason for hiding this comment

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

How is your convention here? Is a step lazy as soon as one of the vertices was computed lazily?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, as long as one of vertices is lazifized, it is called lazy here

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@dhendryc dhendryc merged commit e55674e into ZIB-IOL:master Feb 26, 2025
6 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.

None yet

2 participants