--test linear solver
--linearsolver.commands
-- Last Edited by: Beach, May 5, 1984 5:17:36 pm PDT

run LinearSolverImpl
←LinearSolverImpl
←Init[]

←StartDebug[]
�ug ← FALSE
�ug ← TRUE

-- problem on page 50
←Init[]
←&x←NewUnknown["x"]
←&y←NewUnknown["y"]
←&m←NewUnknown["m"]
←Restrict[&m]
←&n←NewUnknown["n"]
←Restrict[&n]
←Restrict[&y]
←&l←NewUnknown["l"]
𡤊ssertZero[LIST[C[[1, &y]], C[[-1, &m]], C[[1, &n]], C[[-2, &x]]]]
�ug["after AssertZero"]
𡤊ssertZero[LIST[C[[1, &l]], C[[1, &m]], C[[3, &n]], C[[1, unity]]]]
�ug["after AssertZero"]

←Init[]
←&m←NewUnknown["m"]
←&x←NewUnknown["x"]
←&y←NewUnknown["y"]
←&l←NewUnknown["l"]
𡤊ssertZero[LIST[C[[1, &x]], C[[-2, &l]], C[[-1, &y]], C[[-1, unity]]]]
�ug["after AssertZero"]
𡤊ssertZero[LIST[C[[1, &m]], C[[-2, &l]], C[[-1, &y]], C[[-3, unity]]]]
�ug["after AssertZero"]

-- Create a rectangle with diagonal (1,2) to (4,3)
-- x >= 1, x <=4, y >= 2, y <= 3
-- x+y >= 3, x+y <= 7
←Init[]
←&x←NewUnknown["x"]
←&y←NewUnknown["y"]
←&a←NewUnknown["a"]
←Restrict[&a]
𡤊ssertZero[LIST[C[[1, &x]], C[[-1, unity]], C[[-1, &a]]]]
←&b←NewUnknown["b"]
←Restrict[&b]
𡤊ssertZero[LIST[C[[-1, &x]], C[[4, unity]], C[[-1, &b]]]]
←&c←NewUnknown["c"]
←Restrict[&c]
𡤊ssertZero[LIST[C[[1, &y]], C[[-2, unity]], C[[-1, &c]]]]
←&d←NewUnknown["d"]
←Restrict[&d]
𡤊ssertZero[LIST[C[[-1, &y]], C[[3, unity]], C[[-1, &d]]]]
←&e←NewUnknown["e"]
←Restrict[&e]
𡤊ssertZero[LIST[C[[1, &x]], C[[1, &y]], C[[-1, &e]], C[[3, unity]]]]
←&f←NewUnknown["f"]
←Restrict[&f]
𡤊ssertZero[LIST[C[[-1, &x]], C[[-1, &y]], C[[-1, &f]], C[[7, unity]]]]
�ug["after AssertZero"]
←Maximize[&x]
←Solution[&x]
←Maximize[&y]
←Solution[&y]
←Maximize[&b]

-- problem on page 52
-- y <= x+1, x+y >= -3, x <= -4
←Init[]
←&x←NewUnknown["x"]
←&y←NewUnknown["y"]
←&a←NewUnknown["a"]
←Restrict[&a]
𡤊ssertZero[LIST[C[[-1, &a]], C[[1, &x]], C[[-1, &y]], C[[1, unity]]]]
�ug["after AssertZero"]
←&b←NewUnknown["b"]
←Restrict[&b]
𡤊ssertZero[LIST[C[[-1, &b]], C[[1, &x]], C[[1, &y]], C[[3, unity]]]]
�ug["after AssertZero"]
←&c←NewUnknown["c"]
𡤊ssertZero[LIST[C[[-1, &c]], C[[1, &x]], C[[-4, unity]]]]
�ug["after AssertZero"]
run -a LinearSolverImpl
run -a TableConstraintsImpl
interp
&v ← ViewerOps.FindViewer["TableTool"]
&t ← TableToolImpl.TableFromViewer[&v.child]
%LinearSolverImpl.debug ← FALSE
TableConstraintsImpl.SolveConstraints[&t]
%LinearSolverImpl.StartDebug[]
%LinearSolverImpl.debug ← TRUE
%LinearSolverImpl.Debug["Hmmm"]