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

[Bridges] rename files in /bridges to their type #2586

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/src/developer/checklists.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,21 @@ The steps are mostly the same, but locations depend on whether the bridge is a
```
## Basic

- [ ] Create a new file in `src/Bridges/XXX/bridges`
- [ ] Create a new file in `src/Bridges/XXX/bridges` named after the type of
the bridge
- [ ] Define the bridge, following existing examples. The name of the bridge
struct must end in `Bridge`
- [ ] Check if your bridge can be a subtype of [`MOI.Bridges.Constraint.SetMapBridge`](@ref)
- [ ] Define a new `const` that is a `SingleBridgeOptimizer` wrapping the
new bridge. The name of the const must be the name of the bridge, less
the `Bridge` suffix
- [ ] `include` the file in `src/Bridges/XXX/bridges/XXX.jl`
- [ ] If the bridge should be enabled by default, add the bridge to
`add_all_bridges` at the bottom of `src/Bridges/XXX/XXX.jl`

## Tests

- [ ] Create a new file in the appropriate subdirectory of `tests/Bridges/XXX`
named after the type of the bridge
- [ ] Use `MOI.Bridges.runtests` to test various inputs and outputs of the
bridge
- [ ] If, after opening the pull request to add the bridge, some lines are not
Expand Down
54 changes: 3 additions & 51 deletions src/Bridges/Constraint/Constraint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,57 +17,9 @@ include("map.jl")
include("set_map.jl")
include("single_bridge_optimizer.jl")

include("bridges/all_different.jl")
include("bridges/all_different_reif.jl")
include("bridges/bin_packing.jl")
include("bridges/circuit.jl")
include("bridges/complex_norm_infinity.jl")
include("bridges/count_at_least.jl")
include("bridges/count_belongs.jl")
include("bridges/count_distinct.jl")
include("bridges/count_distinct_reif.jl")
include("bridges/count_greater_than.jl")
include("bridges/det.jl")
include("bridges/flip_sign.jl")
include("bridges/functionize.jl")
include("bridges/geomean_to_power.jl")
include("bridges/geomean_to_relentr.jl")
include("bridges/geomean.jl")
include("bridges/indicator_activate_on_zero.jl")
include("bridges/indicator_flipsign.jl")
include("bridges/indicator_sos.jl")
include("bridges/inequality_to_complements.jl")
include("bridges/integer_to_zeroone.jl")
include("bridges/interval.jl")
include("bridges/ltgt_to_interval.jl")
include("bridges/norm_infinity.jl")
include("bridges/norm_one.jl")
include("bridges/norm_to_power.jl")
include("bridges/norm_special_case.jl")
include("bridges/norm_spec_nuc_to_psd.jl")
include("bridges/number_conversion.jl")
include("bridges/quad_to_soc.jl")
include("bridges/relentr_to_exp.jl")
include("bridges/rsoc_soc.jl")
include("bridges/scalarize.jl")
include("bridges/semi_to_binary.jl")
include("bridges/slack.jl")
include("bridges/soc_rsoc.jl")
include("bridges/soc_to_nonconvex_quad.jl") # do not add these bridges by default
include("bridges/soc_to_psd.jl")
include("bridges/split_complex_equalto.jl")
include("bridges/split_complex_zeros.jl")
include("bridges/split_hyperrectangle.jl")
include("bridges/hermitian.jl")
include("bridges/square.jl")
include("bridges/set_conversion.jl")
include("bridges/set_dot_scaling.jl")
include("bridges/table.jl")
include("bridges/vectorize.jl")
include("bridges/zero_one.jl")
include("bridges/sos1_to_milp.jl")
include("bridges/sos2_to_milp.jl")
include("bridges/indicator_to_milp.jl")
for filename in readdir(joinpath(@__DIR__, "bridges"); join = true)
include(filename)
end

"""
add_all_bridges(bridged_model, ::Type{T}) where {T}
Expand Down
6 changes: 3 additions & 3 deletions src/Bridges/Objective/Objective.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ include("bridge.jl")
include("map.jl")
include("single_bridge_optimizer.jl")

include("bridges/conversion.jl")
include("bridges/slack.jl")
include("bridges/vector_slack.jl")
for filename in readdir(joinpath(@__DIR__, "bridges"); join = true)
include(filename)
end

"""
add_all_bridges(model, ::Type{T}) where {T}
Expand Down
12 changes: 3 additions & 9 deletions src/Bridges/Variable/Variable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,9 @@ include("map.jl")
include("set_map.jl")
include("single_bridge_optimizer.jl")

include("bridges/flip_sign.jl")
include("bridges/free.jl")
include("bridges/rsoc_to_psd.jl")
include("bridges/rsoc_soc.jl")
include("bridges/soc_rsoc.jl")
include("bridges/vectorize.jl")
include("bridges/zeros.jl")
include("bridges/hermitian.jl")
include("bridges/parameter.jl")
for filename in readdir(joinpath(@__DIR__, "bridges"); join = true)
include(filename)
end

"""
add_all_bridges(model, ::Type{T}) where {T}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading