Skip to content

Commit

Permalink
now with 100 primal dimensions, 100 inequality constraints, and 90% r…
Browse files Browse the repository at this point in the history
…andom sparsity IP is only 5x slower than path
  • Loading branch information
dfridovi committed Dec 24, 2024
1 parent 8c7d91f commit f22ef5c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions benchmark/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[deps]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
MixedComplementarityProblems = "6c9e26cb-9263-41b8-a6c6-f4ca104ccdcd"
PATHSolver = "f5f7c340-0bb3-5c69-969a-41884d311d1b"
ParametricMCPs = "9b992ff8-05bb-4ea1-b9d2-5ef72d82f7ad"
Expand Down
1 change: 1 addition & 0 deletions benchmark/SolverBenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ using MixedComplementarityProblems: MixedComplementarityProblems
using ParametricMCPs: ParametricMCPs
using Random: Random
using Statistics: Statistics
using Distributions: Distributions
using PATHSolver: PATHSolver
using ProgressMeter: @showprogress

Expand Down
18 changes: 13 additions & 5 deletions benchmark/path.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@ function generate_test_problem(
rng = Random.MersenneTwister(1);
num_primals = 1000,
num_inequalities = 1000,
sparsity_rate = 0.9,
)
bernoulli = Distributions.Bernoulli(1 - sparsity_rate)

M = let
P = randn(rng, num_primals, num_primals)
P =
randn(rng, num_primals, num_primals) .*
rand(rng, bernoulli, num_primals, num_primals)
P' * P
end

A = randn(rng, num_inequalities, num_primals)
A =
randn(rng, num_inequalities, num_primals) .*
rand(rng, bernoulli, num_inequalities, num_primals)
b = randn(rng, num_inequalities)

G(x, y; θ) = M * x - θ - A' * y
Expand All @@ -34,14 +41,15 @@ end
function benchmark(;
num_problems = 10,
num_samples_per_problem = 100,
num_primals = 10,
num_inequalities = 10,
num_primals = 100,
num_inequalities = 100,
sparsity_rate = 0.9,
)
rng = Random.MersenneTwister(1)

# Generate random problems and parameters.
problems = @showprogress desc = "Generating test problems..." map(1:num_problems) do _
generate_test_problem(rng; num_primals, num_inequalities)
generate_test_problem(rng; num_primals, num_inequalities, sparsity_rate)
end

θs = map(1:num_samples_per_problem) do _
Expand Down

0 comments on commit f22ef5c

Please sign in to comment.