mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-12-26 02:30: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
|
using Memento
|
||||||
|
|
||||||
const logger = basic_config("info")
|
const logger = basic_config("info")
|
||||||
|
const solver_logger = basic_config("info")
|
||||||
|
|
||||||
include("sdps.jl")
|
include("sdps.jl")
|
||||||
include("checksolution.jl")
|
include("checksolution.jl")
|
||||||
@ -82,6 +83,9 @@ function κandA(name::String, sdp_constraints, Δ::GroupAlgebraElement, solver::
|
|||||||
if isfile("$name/solver.log")
|
if isfile("$name/solver.log")
|
||||||
rm("$name/solver.log")
|
rm("$name/solver.log")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_handler(solver_logger, DefaultHandler("./$name/solver.log"), "solver")
|
||||||
|
|
||||||
t = @timed SDP_problem = create_SDP_problem(sdp_constraints, Δ; upper_bound=upper_bound)
|
t = @timed SDP_problem = create_SDP_problem(sdp_constraints, Δ; upper_bound=upper_bound)
|
||||||
info(logger, timed_msg(t))
|
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
|
end
|
||||||
|
|
||||||
function solve_SDP(SDP_problem, solver)
|
function solve_SDP(SDP_problem, solver)
|
||||||
|
JuMP.setsolver(SDP_problem, solver)
|
||||||
info(logger, Base.repr(SDP_problem))
|
info(logger, Base.repr(SDP_problem))
|
||||||
info(logger, solver)
|
|
||||||
|
|
||||||
JuMP.setsolver(SDP_problem, solver);
|
|
||||||
# @time MathProgBase.writeproblem(SDP_problem, "/tmp/SDP_problem")
|
# @time MathProgBase.writeproblem(SDP_problem, "/tmp/SDP_problem")
|
||||||
|
|
||||||
solver_logger = basic_config("info")
|
out = STDOUT
|
||||||
add_handler(solver_logger, DefaultHandler("./$name/solver.log"), "solver")
|
err = STDERR
|
||||||
|
|
||||||
TT = STDOUT
|
|
||||||
redirect_stdout(solver_logger.handlers["solver"].io)
|
redirect_stdout(solver_logger.handlers["solver"].io)
|
||||||
|
redirect_stderr(solver_logger.handlers["solver"].io)
|
||||||
|
|
||||||
solution_status = JuMP.solve(SDP_problem);
|
solution_status = JuMP.solve(SDP_problem);
|
||||||
|
|
||||||
flush(solver_logger.handlers["solver"].io)
|
flush(solver_logger.handlers["solver"].io)
|
||||||
|
info(solver_logger, "Finished!")
|
||||||
remove_handler(solver_logger, "solver")
|
remove_handler(solver_logger, "solver")
|
||||||
redirect_stdout(TT)
|
|
||||||
|
redirect_stdout(out)
|
||||||
|
|
||||||
if solution_status != :Optimal
|
if solution_status != :Optimal
|
||||||
warn(logger, "The solver did not solve the problem successfully!")
|
warn(logger, "The solver did not solve the problem successfully!")
|
||||||
|
Loading…
Reference in New Issue
Block a user