"""安全在庫配置問題（sqrt関数による非線形モデル）."""
from amplpy import AMPL

n = 4
h = {i: 1.0*i for i in range(1, n+1)}
T = {i: 2 for i in range(1, n+1)}

ampl = AMPL()
ampl.read("ssa_sqrt.mod")
ampl.param["n"] = n
ampl.param["h"] = h
ampl.param["T"] = T
ampl.option["solver"] = "scip"
ampl.solve(verbose=False)
assert ampl.solve_result == "solved"
print("Opt. Value=", round(ampl.get_objective("Cost").value(), 3))
print(ampl.get_variable("x").get_values().to_pandas())
