Skip to content

Commit

Permalink
export JuMP and HiGHS for external use
Browse files Browse the repository at this point in the history
  • Loading branch information
jbytecode committed May 10, 2024
1 parent 5aed0c6 commit 958a1a4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### 0.2.1 (Upcoming Release)

- Export JuMP and HiGHS for external use
- Fix documentation of CpmActivity
- Fix documentation of Knapsack solver

Expand Down
8 changes: 3 additions & 5 deletions src/OperationsResearchModels.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
module OperationsResearchModels


# Default Optimizer
using HiGHS
const theoptimizerpackage = Symbol("HiGHS")
const theoptimizer = HiGHS.Optimizer
using JuMP, HiGHS

solve() = nothing

Expand Down Expand Up @@ -67,6 +63,8 @@ export Simplex
export Utility
export latex

export JuMP, HiGHS




Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ using OperationsResearchModels
using OperationsResearchModels.Simplex

include("testutility.jl")
include("testjump.jl")
include("testtransportation.jl")
include("testassignment.jl")
include("testshortestpath.jl")
Expand Down
24 changes: 24 additions & 0 deletions test/testjump.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@testset "JuMP and HiGHS" begin

eps = 0.001

import OperationsResearchModels: JuMP, HiGHS
import .JuMP: MOI

m = JuMP.Model(OperationsResearchModels.HiGHS.Optimizer)
MOI.set(m, MOI.Silent(), true)

JuMP.@variable(m, x >= 0)
JuMP.@variable(m, y >= 0)

JuMP.@objective(m, Max, x + 2y)

JuMP.@constraint(m, x + y <= 1)

JuMP.optimize!(m)

@test isapprox(JuMP.value(x), 0.0, atol = eps)
@test isapprox(JuMP.value(y), 1.0, atol = eps)

@test isapprox(JuMP.objective_value(m), 2.0, atol = eps)
end

0 comments on commit 958a1a4

Please sign in to comment.