Skip to content

Commit

Permalink
replace Cbc with HiGHS
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamed82008 committed Feb 2, 2024
1 parent d80931b commit 4e0b644
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 <[email protected]> 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

0 comments on commit 4e0b644

Please sign in to comment.