Skip to content

Commit

Permalink
Merge pull request #11 from JuliaNonconvex/mt/highs
Browse files Browse the repository at this point in the history
Replace Cbc with HiGHS
  • Loading branch information
LucasMSpereira committed Feb 2, 2024
2 parents 9490874 + 4e0b644 commit b6246be
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name = "NonconvexTOBS"
uuid = "6c0b5230-d4c9-466e-bfd4-b31e6272ab65"
authors = ["Mohamed Tarek <mohamed82008@gmail.com> and contributors"]
version = "0.1.2"
version = "0.2.0"

[deps]
Cbc = "9961bab8-2fa3-5c5a-9d89-47fab24efd76"
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
NonconvexCore = "035190e5-69f1-488f-aaab-becca2889735"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[compat]
Cbc = "1.0.1"
HiGHS = "1"
JuMP = "1.1"
NonconvexCore = "1"
Parameters = "0.12"
Expand Down
26 changes: 13 additions & 13 deletions src/NonconvexTOBS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ module NonconvexTOBS

export TOBSAlg, TOBSOptions

using Reexport, Parameters, SparseArrays, Cbc
using Reexport, Parameters, SparseArrays, HiGHS
@reexport using NonconvexCore
using NonconvexCore: @params, VecModel, AbstractResult
using NonconvexCore: VecModel, AbstractResult
using NonconvexCore: AbstractOptimizer, CountingFunction
import NonconvexCore: optimize!
import JuMP
Expand All @@ -21,7 +21,7 @@ function TOBSOptions(;
convParam::Real = 0.001, # convergence parameter (upper bound of error)
constrRelax::Real = 0.1, # constraint relaxation parameter
timeLimit::Real = 1.0,
optimizer = Cbc.Optimizer,
optimizer = HiGHS.Optimizer,
maxiter::Int = 200,
timeStable::Bool = true,
)
Expand All @@ -37,10 +37,10 @@ function TOBSOptions(;
))
end

@params mutable struct TOBSWorkspace <: Workspace
model::VecModel
x0::AbstractVector
options::TOBSOptions
mutable struct TOBSWorkspace{TM <: VecModel, TX <: AbstractVector, TO <: TOBSOptions} <: Workspace
model::TM
x0::TX
options::TO
end
function TOBSWorkspace(
model::VecModel,
Expand All @@ -50,10 +50,10 @@ function TOBSWorkspace(
)
return TOBSWorkspace(model, copy(x0), options)
end
@params struct TOBSResult <: AbstractResult
minimizer::Any
minimum::Any
error::Any
struct TOBSResult{TM1, TM2, TE} <: AbstractResult
minimizer::TM1
minimum::TM2
error::TE
end

function optimize!(workspace::TOBSWorkspace)
Expand Down Expand Up @@ -84,8 +84,8 @@ function optimize!(workspace::TOBSWorkspace)
skip_step = false
while (convParam < er || any(currentConstr .> 0)) && count < maxiter
count > 1 && (m = JuMP.Model(milp_solver))
JuMP.set_optimizer_attribute(m, "logLevel", 0)
JuMP.set_optimizer_attribute(m, "seconds", timeLimit)
JuMP.set_optimizer_attribute(m, "log_to_console", false)
JuMP.set_optimizer_attribute(m, "time_limit", timeLimit)
if !skip_step || count == 1
if count > 1
currentConstr, jacConstr =
Expand Down

2 comments on commit b6246be

@mohamed82008
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/100168

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.0 -m "<description of version>" b6246be7e4b5eabf191fb8d8c140e432f88bfd18
git push origin v0.2.0

Please sign in to comment.