-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Apply JuliaFormatter * Update Project.toml
- Loading branch information
Showing
96 changed files
with
2,267 additions
and
1,715 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Configuration file for JuliaFormatter.jl | ||
# For more information, see: https://domluna.github.io/JuliaFormatter.jl/stable/config/ | ||
|
||
always_for_in = true | ||
always_use_return = true | ||
margin = 80 | ||
remove_extra_newlines = true | ||
short_to_long_function_def = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: format-check | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- release-* | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: julia-actions/setup-julia@latest | ||
with: | ||
version: '1' | ||
- uses: actions/checkout@v1 | ||
- name: Format check | ||
shell: julia --color=yes {0} | ||
run: | | ||
using Pkg | ||
Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.9")) | ||
using JuliaFormatter | ||
format("src", verbose=true) | ||
format("test", verbose=true) | ||
out = String(read(Cmd(`git diff`))) | ||
if isempty(out) | ||
exit(0) | ||
end | ||
@error "Some files have not been formatted !!!" | ||
write(stdout, out) | ||
exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,38 @@ | ||
function nlp_cvx_001_010(optimizer, objective_tol, primal_tol, dual_tol, | ||
termination_target = TERMINATION_TARGET_LOCAL, | ||
primal_target = PRIMAL_TARGET_LOCAL) | ||
function nlp_cvx_001_010( | ||
optimizer, | ||
objective_tol, | ||
primal_tol, | ||
dual_tol, | ||
termination_target = TERMINATION_TARGET_LOCAL, | ||
primal_target = PRIMAL_TARGET_LOCAL, | ||
) | ||
# Test Goals: | ||
# - linear objective | ||
# - quadratic objective | ||
# - linear constraints forming a closed set | ||
# Variants | ||
# 010 - binding constraints | ||
# 011 - non-binding constraints | ||
|
||
m = Model(optimizer) | ||
|
||
@variable(m, x) | ||
@variable(m, y) | ||
|
||
@objective(m, Min, x) | ||
@constraint(m, x+y <= 5) | ||
@constraint(m, 2*x-y <= 3) | ||
@constraint(m, 3*x+9*y >= -10) | ||
@constraint(m, 10*x-y >= -20) | ||
@constraint(m, -x+2*y <= 8) | ||
|
||
optimize!(m) | ||
|
||
check_status(m, FEASIBLE_PROBLEM, termination_target, primal_target) | ||
check_objective(m, -2.0430107680954848, tol = objective_tol) | ||
check_solution([x,y], [-2.0430107680954848, -0.4301075068564087], tol = primal_tol) | ||
|
||
end | ||
# 011 - non-binding constraints | ||
|
||
model = Model(optimizer) | ||
|
||
@variable(model, x) | ||
@variable(model, y) | ||
|
||
@objective(model, Min, x) | ||
@constraint(model, x + y <= 5) | ||
@constraint(model, 2 * x - y <= 3) | ||
@constraint(model, 3 * x + 9 * y >= -10) | ||
@constraint(model, 10 * x - y >= -20) | ||
@constraint(model, -x + 2 * y <= 8) | ||
|
||
optimize!(model) | ||
|
||
check_status(model, FEASIBLE_PROBLEM, termination_target, primal_target) | ||
check_objective(model, -2.0430107680954848, tol = objective_tol) | ||
return check_solution( | ||
[x, y], | ||
[-2.0430107680954848, -0.4301075068564087], | ||
tol = primal_tol, | ||
) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
function nlp_cvx_001_011(optimizer, objective_tol, primal_tol, dual_tol, | ||
termination_target = TERMINATION_TARGET_LOCAL, | ||
primal_target = PRIMAL_TARGET_LOCAL) | ||
m = Model(optimizer) | ||
|
||
@variable(m, x) | ||
@variable(m, y) | ||
|
||
@objective(m, Min, (x-1)^2 + (y-2)^2) | ||
@constraint(m, x+y <= 5) | ||
@constraint(m, 2*x-y <= 3) | ||
@constraint(m, 3*x+9*y >= -10) | ||
@constraint(m, 10*x-y >= -20) | ||
@constraint(m, -x+2*y <= 8) | ||
|
||
optimize!(m) | ||
|
||
check_status(m, FEASIBLE_PROBLEM, termination_target, primal_target) | ||
check_objective(m, 0.0, tol = objective_tol) | ||
check_solution([x,y], [1.0, 2.0], tol = primal_tol) | ||
|
||
end | ||
function nlp_cvx_001_011( | ||
optimizer, | ||
objective_tol, | ||
primal_tol, | ||
dual_tol, | ||
termination_target = TERMINATION_TARGET_LOCAL, | ||
primal_target = PRIMAL_TARGET_LOCAL, | ||
) | ||
model = Model(optimizer) | ||
|
||
@variable(model, x) | ||
@variable(model, y) | ||
|
||
@objective(model, Min, (x - 1)^2 + (y - 2)^2) | ||
@constraint(model, x + y <= 5) | ||
@constraint(model, 2 * x - y <= 3) | ||
@constraint(model, 3 * x + 9 * y >= -10) | ||
@constraint(model, 10 * x - y >= -20) | ||
@constraint(model, -x + 2 * y <= 8) | ||
|
||
optimize!(model) | ||
|
||
check_status(model, FEASIBLE_PROBLEM, termination_target, primal_target) | ||
check_objective(model, 0.0, tol = objective_tol) | ||
return check_solution([x, y], [1.0, 2.0], tol = primal_tol) | ||
end |
Oops, something went wrong.