Skip to content
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

Support blmo type and passed test for Cube polytope #188

Draft
wants to merge 299 commits into
base: main
Choose a base branch
from

Conversation

WenjieXiao-2022
Copy link

@WenjieXiao-2022 WenjieXiao-2022 commented May 3, 2024

Modified code in frank_wolfe_variants.jl, Boscia.jl, node.jl, polytope_blmos.jl, time_tracking_lmo.jl, managed_blmo.jl.

All changed or added code is wrapped by
#=========================#
......
#=========================#

Comment on lines -30 to +33
n = 3
k = 2

Random.seed!(5)
n = 4
k = 3
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please reset.

Comment on lines -97 to +99
x, _, _ = Boscia.solve(f, grad!, lmo, verbose=true)
x, _, _ = Boscia.solve(f, grad!, lmo, verbose=true, lazy=false, variant=Boscia.DICG())
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 nice to have both variants here. Also, it can function as a nice example for using DICG.

Comment on lines +28 to +48

param_mu = 0.4
param_lambda = 0.1

linVector = CSV.read("./data/qp_linVector.csv", DataFrame; header = false) |> Matrix
lapMatrix = CSV.read("./data/qp_lapMatrix.csv", DataFrame; header = false) |> Matrix
rrMatrix = CSV.read("./data/qp_rrMatrix.csv", DataFrame; header = false) |> Matrix
A = lapMatrix + param_mu * rrMatrix
@show size(A)
b = param_lambda * linVector

function f(x)

return (1 / 2) * (transpose(x) * A * x) + sum(transpose(b) * x)
end

function grad!(storage, x)
@. storage = $(A * x) + b
end

return f, grad!
Copy link
Collaborator

Choose a reason for hiding this comment

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

Indent.

Comment on lines +17 to +19
seed = rand(UInt64)
@show seed
Random.seed!(seed)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please comment if not needed so the whole test suite runs with the same seed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is a nice additional example in Boscia. Please redo it in the classical example format. It is enough if we have one Boscia run using DICG.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Have you added dummies for the other DICG methods also?

# Otherwise, assgin one to the entry corresponding to the smallest entry of d.
# Same for the UnitSimplex and ProbabilitySimplex.
function bounded_dicg_maximum_step(sblmo::CubeSimpleBLMO, x, direction, lb, ub, int_vars; kwargs...)
return FrankWolfe.dicg_maximum_step(FrankWolfe.ZeroOneHypercube(), x, direction)
Copy link
Collaborator

Choose a reason for hiding this comment

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

In our case, the hypercube does not necessarily correspond to the Zero One hypercube!

end

function bounded_dicg_maximum_step(sblmo::ProbabilitySimplexSimpleBLMO, x, direction, lb, ub, int_vars; kwargs...)
return FrankWolfe.dicg_maximum_step(FrankWolfe.ProbabilitySimplexOracle{Float64}(), x, direction)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You have to give the Probability Simplex the correct right side. Aka N in our case.



function bounded_dicg_maximum_step(sblmo::UnitSimplexSimpleBLMO, x, direction, lb, ub, int_vars; kwargs...)
return FrankWolfe.dicg_maximum_step(FrankWolfe.UnitSimplexOracle{Float64}(), x, direction)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remember the right side!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove this. I have written an example in the example folder.

@dhendryc
Copy link
Collaborator

dhendryc commented Feb 3, 2025

In terms of formatting, you have a lot of large indents. Please only use one tab, e.g.

function test(...)
   # TO DO
end

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.

Using DICG
3 participants