-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbinary_seq_opt.jl
74 lines (59 loc) · 1.94 KB
/
binary_seq_opt.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using LinearAlgebra, SparseArrays, FFTW, JuMP
using ProgressBars, Printf, Random, Statistics, StatsBase
using Distributed, Dates, Serialization
include("src/utils.jl")
include("src/gold_codes.jl")
include("src/weil_codes.jl")
# block coordinate descent core
include("src/subproblem_data.jl")
include("src/bcd_subproblem.jl")
# load objective functions
include("src/objectives/isl.jl")
include("src/objectives/sos.jl")
include("src/objectives/acz.jl")
include("src/objectives/soq.jl")
include("src/objectives/msos.jl")
include("src/objectives/asl.jl")
include("src/objectives/mae.jl")
include("src/objectives/psl.jl")
include("src/objectives/spsl.jl")
include("src/objectives/mpsl.jl")
include("src/objectives/lpsl.jl")
# index selection strategies
abstract type IndexSelector end
include("src/index_selector/selector_data.jl")
include("src/index_selector/random_selector.jl")
include("src/index_selector/bist_selector.jl")
include("src/index_selector/bist_extended_selector.jl")
# block coordinate descent
include("src/bcd.jl")
# using Gurobi
# using Plots
# solver = optimizer_with_attributes(
# Gurobi.Optimizer,
# "OutputFlag" => 1,
# "MIPGap" => 1e-10,
# )
# # solver = nothing
# """ check that solver & brute force agree """
# function test_bcd(L::Int, K::Int, M::Int, obj::Function)
# solver = optimizer_with_attributes(
# Gurobi.Optimizer,
# "OutputFlag" => 1,
# "MIPGap" => 1e-10,
# )
# X0 = randb(L, K)
# index_selector = RandomSampler(L, K, M)
# index_list = pre(index_selector)
# Xsolve = solve_bcd_subproblem(X0, index_list, obj, solver)[1]
# Xbrute = solve_bcd_subproblem(X0, index_list, obj, nothing)[1]
# return obj(Xsolve) ≈ obj(Xbrute)
# end
# [@assert test_bcd(31, 13, 7, ISL) for _=1:1000]
# Random.seed!(0)
# X0 = randb(31, 2)
# index_selector = RandomSampler(31, 11, 7; columnwise_limit=8)
# bcd = BCD(index_selector, ISL, solver)
# bcd(100)
# using Plots
# plot(bcd.obj_values)