mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-12-25 02:15:29 +01:00
fix solver logger, once again
This commit is contained in:
parent
47664dd7e4
commit
94b4193ec6
@ -6,6 +6,7 @@ import SCS.SCSSolver
|
||||
using Memento
|
||||
|
||||
const logger = basic_config("info")
|
||||
const solver_logger = basic_config("info")
|
||||
|
||||
include("sdps.jl")
|
||||
include("checksolution.jl")
|
||||
@ -82,6 +83,9 @@ function κandA(name::String, sdp_constraints, Δ::GroupAlgebraElement, solver::
|
||||
if isfile("$name/solver.log")
|
||||
rm("$name/solver.log")
|
||||
end
|
||||
|
||||
add_handler(solver_logger, DefaultHandler("./$name/solver.log"), "solver")
|
||||
|
||||
t = @timed SDP_problem = create_SDP_problem(sdp_constraints, Δ; upper_bound=upper_bound)
|
||||
info(logger, timed_msg(t))
|
||||
|
||||
|
16
src/sdps.jl
16
src/sdps.jl
@ -68,21 +68,23 @@ function create_SDP_problem(matrix_constraints, Δ::GroupAlgebraElement; upper_b
|
||||
end
|
||||
|
||||
function solve_SDP(SDP_problem, solver)
|
||||
JuMP.setsolver(SDP_problem, solver)
|
||||
info(logger, Base.repr(SDP_problem))
|
||||
info(logger, solver)
|
||||
|
||||
JuMP.setsolver(SDP_problem, solver);
|
||||
# @time MathProgBase.writeproblem(SDP_problem, "/tmp/SDP_problem")
|
||||
|
||||
solver_logger = basic_config("info")
|
||||
add_handler(solver_logger, DefaultHandler("./$name/solver.log"), "solver")
|
||||
|
||||
TT = STDOUT
|
||||
out = STDOUT
|
||||
err = STDERR
|
||||
redirect_stdout(solver_logger.handlers["solver"].io)
|
||||
redirect_stderr(solver_logger.handlers["solver"].io)
|
||||
|
||||
solution_status = JuMP.solve(SDP_problem);
|
||||
|
||||
flush(solver_logger.handlers["solver"].io)
|
||||
info(solver_logger, "Finished!")
|
||||
remove_handler(solver_logger, "solver")
|
||||
redirect_stdout(TT)
|
||||
|
||||
redirect_stdout(out)
|
||||
|
||||
if solution_status != :Optimal
|
||||
warn(logger, "The solver did not solve the problem successfully!")
|
||||
|
Loading…
Reference in New Issue
Block a user