Skip to content

Commit

Permalink
Merge pull request #15 from exanauts/kk/dev
Browse files Browse the repository at this point in the history
Rename SQP to SqpSolver
  • Loading branch information
kibaekkim authored May 12, 2023
2 parents c1fce0a + 822b5e5 commit 8bcae2a
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: ['1.8']
julia-version: ['1.9']
julia-arch: [x64]
os: [ubuntu-latest]

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = "SQP"
name = "SqpSolver"
uuid = "ffdd34ce-459d-4fc7-82a1-202b2ab8becf"
authors = ["Kibaek Kim <kibaek.k@gmail.com>"]
version = "0.1.0"
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# SQP.jl
# SqpSolver.jl

![Run tests](https://github.com/exanauts/SQP.jl/workflows/Run%20tests/badge.svg?branch=master)
[![codecov](https://codecov.io/gh/exanauts/SQP.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/exanauts/SQP.jl)
![Run tests](https://github.com/exanauts/SqpSolver.jl/workflows/Run%20tests/badge.svg?branch=master)
[![codecov](https://codecov.io/gh/exanauts/SqpSolver.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/exanauts/SqpSolver.jl)

This is a Julia package that implements sequantial quadratic programming algorithms for continuous nonlinear optimization.

## Installation

```julia
]add https://github.com/exanauts/SQP.jl
]add SqpSolver
```

## Example
Expand All @@ -23,15 +23,15 @@ s.t. x^2 - x = 2
This problem can be solved by the following code snippet:
```julia
# Load packages
using SQP, JuMP
using SqpSolver, JuMP
using Ipopt # can be any QP solver

# Number of variables
n = 1

# Build nonlinear problem model via JuMP
model = Model(optimizer_with_attributes(
SQP.Optimizer,
SqpSolver.Optimizer,
"external_optimizer" => Ipopt.Optimizer,
))
@variable(model, x)
Expand Down
2 changes: 1 addition & 1 deletion examples/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[deps]
SQP = "ffdd34ce-459d-4fc7-82a1-202b2ab8becf"
SqpSolver = "ffdd34ce-459d-4fc7-82a1-202b2ab8becf"
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Expand Down
2 changes: 1 addition & 1 deletion examples/acopf/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
PowerModels = "c36e90e8-916a-50a6-bd94-075b64ef4655"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
SQP = "ffdd34ce-459d-4fc7-82a1-202b2ab8becf"
SqpSolver = "ffdd34ce-459d-4fc7-82a1-202b2ab8becf"
filterSQP = "f1ca9057-ba27-4701-aaf7-0436ee83bb57"
4 changes: 2 additions & 2 deletions examples/acopf/opf.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Revise
using SQP
using SqpSolver
using PowerModels, JuMP, Ipopt
using filterSQP
using CPLEX
Expand Down Expand Up @@ -70,7 +70,7 @@ function run_sqp_opf(data_file::String, max_iter::Int = 100)
)

result = optimize_model!(pm, optimizer = optimizer_with_attributes(
SQP.Optimizer,
SqpSolver.Optimizer,
"algorithm" => "SQP-TR",
"external_optimizer" => qp_solver,
"tol_infeas" => 1.e-6,
Expand Down
4 changes: 2 additions & 2 deletions examples/toy_example.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using SQP, Ipopt
using SqpSolver, Ipopt
using JuMP

ipopt_solver = optimizer_with_attributes(
Expand All @@ -7,7 +7,7 @@ ipopt_solver = optimizer_with_attributes(
"warm_start_init_point" => "yes",
)
optimizer = optimizer_with_attributes(
SQP.Optimizer,
SqpSolver.Optimizer,
"external_optimizer" => ipopt_solver,
"max_iter" => 100,
"algorithm" => "SQP-TR",
Expand Down
8 changes: 4 additions & 4 deletions src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ _ConstraintInfo(func, set) = _ConstraintInfo(func, set, nothing)
"""
Optimizer()
Create a new SQP optimizer.
Create a new SqpSolver optimizer.
"""
mutable struct Optimizer <: MOI.AbstractOptimizer
inner::Union{Model,Nothing}
Expand Down Expand Up @@ -173,7 +173,7 @@ function MOI.copy_to(model::Optimizer, src::MOI.ModelLike)
return MOI.Utilities.default_copy_to(model, src)
end

MOI.get(::Optimizer, ::MOI.SolverName) = "SQP"
MOI.get(::Optimizer, ::MOI.SolverName) = "SqpSolver"

function MOI.supports_constraint(
::Optimizer,
Expand Down Expand Up @@ -746,8 +746,8 @@ function MOI.set(
return
end

### SQP callback functions
### In setting up the data for SQP, we order the constraints as follows:
### SqpSolver callback functions
### In setting up the data for SqpSolver, we order the constraints as follows:
### - linear_le_constraints
### - linear_ge_constraints
### - linear_eq_constraints
Expand Down
2 changes: 1 addition & 1 deletion src/SQP.jl → src/SqpSolver.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module SQP
module SqpSolver

using LinearAlgebra
using SparseArrays
Expand Down
6 changes: 3 additions & 3 deletions test/MOI_wrapper.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
module TestMOIWrapper

using SQP
using SqpSolver
using Ipopt
using JuMP
using Test

const MOI = SQP.MathOptInterface
const MOI = SqpSolver.MathOptInterface
const MOIT = MOI.Test
const MOIU = MOI.Utilities
const MOIB = MOI.Bridges

const optimizer = SQP.Optimizer()
const optimizer = SqpSolver.Optimizer()
const ipopt_optimizer = optimizer_with_attributes(
Ipopt.Optimizer,
"print_level" => 0,
Expand Down
1 change: 0 additions & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
PowerModels = "c36e90e8-916a-50a6-bd94-075b64ef4655"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2 changes: 1 addition & 1 deletion test/ext_solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ qp_solver = optimizer_with_attributes(
"warm_start_init_point" => "yes",
)
optimizer_solver = optimizer_with_attributes(
SQP.Optimizer,
SqpSolver.Optimizer,
"external_optimizer" => qp_solver,
"algorithm" => "SQP-TR",
"OutputFlag" => 0,
Expand Down
2 changes: 1 addition & 1 deletion test/opf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function run_sqp_opf(data_file::String, max_iter::Int = 100)
"warm_start_init_point" => "yes",
)
result = optimize_model!(pm, optimizer = optimizer_with_attributes(
SQP.Optimizer,
SqpSolver.Optimizer,
"algorithm" => "SQP-TR",
"external_optimizer" => qp_solver,
"max_iter" => max_iter,
Expand Down
8 changes: 1 addition & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using SQP
using SqpSolver
using JuMP, MathOptInterface
using Ipopt
using Test
Expand All @@ -13,9 +13,3 @@ end
@test isapprox(ysol, -1.0, rtol=1e-4)
@test status == MOI.LOCALLY_SOLVED
end

@testset "opf.jl" begin
include("opf.jl")
result = run_sqp_opf("../examples/acopf/case3.m", 100)
@test isapprox(result["objective"], +5.90687949e+03, rtol=1e-2)
end

0 comments on commit 8bcae2a

Please sign in to comment.