Switch to MOSEK solver
This commit is contained in:
parent
43b7526497
commit
fd5cffac9e
2 changed files with 5 additions and 9 deletions
|
@ -7,12 +7,11 @@ version = "0.1.0"
|
||||||
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
|
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
|
||||||
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
|
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
|
||||||
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
|
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
|
||||||
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
|
|
||||||
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
|
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
|
||||||
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
|
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
|
||||||
Juniper = "2ddba703-00a4-53a7-87a5-e8b9971dde84"
|
|
||||||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
|
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
|
||||||
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
|
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
|
||||||
|
MosekTools = "1ec41992-ff65-5c91-ac43-2df89e9693a4"
|
||||||
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
|
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
|
||||||
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
|
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
|
||||||
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
|
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
|
||||||
|
|
11
src/optim.jl
11
src/optim.jl
|
@ -1,6 +1,5 @@
|
||||||
using JuMP
|
using JuMP
|
||||||
using Ipopt
|
using MosekTools
|
||||||
using Juniper
|
|
||||||
|
|
||||||
function neighbourindices(mask::Matrix, idx::Int)::Vector{Int}
|
function neighbourindices(mask::Matrix, idx::Int)::Vector{Int}
|
||||||
if mask[idx] == 0
|
if mask[idx] == 0
|
||||||
|
@ -34,14 +33,12 @@ function definemodel(plantcounts::Vector, garden::Matrix, mask::Matrix, costs::M
|
||||||
N = length(mask)
|
N = length(mask)
|
||||||
Q = size(costs, 1)
|
Q = size(costs, 1)
|
||||||
|
|
||||||
optimizer = Juniper.Optimizer
|
optimizer = Mosek.Optimizer
|
||||||
nl_solver = optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 0)
|
model = Model(optimizer_with_attributes(optimizer, "QUIET" => false))
|
||||||
|
|
||||||
model = Model(optimizer_with_attributes(optimizer, "nl_solver" => nl_solver))
|
|
||||||
|
|
||||||
@variable(model, x[1:N, 1:Q], Bin)
|
@variable(model, x[1:N, 1:Q], Bin)
|
||||||
|
|
||||||
@NLobjective(
|
@objective(
|
||||||
model,
|
model,
|
||||||
Min,
|
Min,
|
||||||
sum(
|
sum(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue