|
|
@ -13,38 +13,21 @@ using Gurobi
|
|
|
|
[505., 352., 458., 220.],
|
|
|
|
[505., 352., 458., 220.],
|
|
|
|
67.0)
|
|
|
|
67.0)
|
|
|
|
model = instance.to_model()
|
|
|
|
model = instance.to_model()
|
|
|
|
|
|
|
|
solver = LearningSolver(solver=JuMPSolver(optimizer=optimizer),
|
|
|
|
solver = LearningSolver(solver=JuMPSolver(optimizer=optimizer))
|
|
|
|
mode="heuristic")
|
|
|
|
stats = solver.solve(instance, model)
|
|
|
|
stats = solver.solve(instance, model)
|
|
|
|
|
|
|
|
@test instance.solution["x"]["1"] == 1.0
|
|
|
|
@test stats["Lower bound"] == 1183.0
|
|
|
|
@test instance.solution["x"]["2"] == 0.0
|
|
|
|
@test stats["Upper bound"] == 1183.0
|
|
|
|
@test instance.solution["x"]["3"] == 1.0
|
|
|
|
@test stats["Sense"] == "max"
|
|
|
|
@test instance.solution["x"]["4"] == 1.0
|
|
|
|
@test stats["Wallclock time"] > 0
|
|
|
|
@test instance.lower_bound == 1183.0
|
|
|
|
|
|
|
|
@test instance.upper_bound == 1183.0
|
|
|
|
# solution = solver.get_solution()
|
|
|
|
@test round(instance.lp_solution["x"]["1"], digits=3) == 1.000
|
|
|
|
# @test solution["x[1]"] == 1.0
|
|
|
|
@test round(instance.lp_solution["x"]["2"], digits=3) == 0.923
|
|
|
|
# @test solution["x[2]"] == 0.0
|
|
|
|
@test round(instance.lp_solution["x"]["3"], digits=3) == 1.000
|
|
|
|
# @test solution["x[3]"] == 1.0
|
|
|
|
@test round(instance.lp_solution["x"]["4"], digits=3) == 0.000
|
|
|
|
# @test solution["x[4]"] == 1.0
|
|
|
|
@test round(instance.lp_value, digits=3) == 1287.923
|
|
|
|
#
|
|
|
|
solver.fit([instance])
|
|
|
|
# stats = solver.solve_lp()
|
|
|
|
solver.solve(instance)
|
|
|
|
# @test round(stats["Optimal value"], digits=3) == 1287.923
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# solution = solver.get_solution()
|
|
|
|
|
|
|
|
# @test round(solution["x[1]"], digits=3) == 1.000
|
|
|
|
|
|
|
|
# @test round(solution["x[2]"], digits=3) == 0.923
|
|
|
|
|
|
|
|
# @test round(solution["x[3]"], digits=3) == 1.000
|
|
|
|
|
|
|
|
# @test round(solution["x[4]"], digits=3) == 0.000
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# solver.fix(Dict(
|
|
|
|
|
|
|
|
# "x[1]" => 1.0,
|
|
|
|
|
|
|
|
# "x[2]" => 0.0,
|
|
|
|
|
|
|
|
# "x[3]" => 0.0,
|
|
|
|
|
|
|
|
# "x[4]" => 1.0,
|
|
|
|
|
|
|
|
# ))
|
|
|
|
|
|
|
|
# stats = solver.solve()
|
|
|
|
|
|
|
|
# @test stats["Lower bound"] == 725.0
|
|
|
|
|
|
|
|
# @test stats["Upper bound"] == 725.0
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|