Replace sysimage.jl by juliaw; reformat source code

This commit is contained in:
2021-08-31 14:20:03 -05:00
parent d87476631a
commit 95b253429b
8 changed files with 90 additions and 61 deletions

View File

@@ -15,7 +15,7 @@ mutable struct FileInstance <: Instance
function FileInstance(filename::AbstractString, build_model::Function)::FileInstance
instance = new(nothing, nothing, filename, nothing, build_model)
instance.py = PyFileInstance(instance)
instance.h5 = Hdf5Sample("$filename.h5", mode="a")
instance.h5 = Hdf5Sample("$filename.h5", mode = "a")
instance.filename = filename
return instance
end

View File

@@ -569,13 +569,8 @@ function get_constraints(
end
end
lhs = sparse(
lhs_rows,
lhs_cols,
lhs_values,
length(rhs),
JuMP.num_variables(data.model),
)
lhs =
sparse(lhs_rows, lhs_cols, lhs_values, length(rhs), JuMP.num_variables(data.model))
if !isempty(data.x)
lhs_value = lhs * data.x
slacks = abs.(lhs_value - rhs)
@@ -652,11 +647,7 @@ function __init_JuMPSolver__()
"slacks",
]
if repr(self.data.optimizer_factory) in ["Gurobi.Optimizer"]
append!(attrs, [
"basis_status",
"sa_rhs_down",
"sa_rhs_up",
])
append!(attrs, ["basis_status", "sa_rhs_down", "sa_rhs_up"])
end
return attrs
end

View File

@@ -1,33 +0,0 @@
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
# Released under the modified BSD license. See COPYING.md for more details.
using PackageCompiler
using TOML
using Logging
Logging.disable_logging(Logging.Info)
mkpath("build")
println("Generating precompilation statements...")
run(`julia --project=. --trace-compile=build/precompile.jl $(ARGS)`)
println("Finding dependencies...")
project = TOML.parsefile("Project.toml")
manifest = TOML.parsefile("Manifest.toml")
deps = Symbol[]
for dep in keys(project["deps"])
if "path" in keys(manifest[dep][1])
println(" - $(dep) [skip]")
else
println(" - $(dep)")
push!(deps, Symbol(dep))
end
end
println("Building system image...")
create_sysimage(
deps,
precompile_statements_file = "build/precompile.jl",
sysimage_path = "build/sysimage.so",
)