OKlibrary  0.2.1.6
LinearProgramming.mac
Go to the documentation of this file.
00001 /* Oliver Kullmann, 18.7.2008 (Swansea) */
00002 /* Copyright 2008 Oliver Kullmann
00003 This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
00004 it and/or modify it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation and included in this library; either version 3 of the
00006 License, or any later version. */
00007 
00022 oklib_include("OKlib/ComputerAlgebra/TestSystem/Lisp/Asserts.mac")$
00023 
00024 
00025 kill(f)$
00026 
00027 
00028 /* ******************************************
00029    * Solving systems of linear inequalities *
00030    ******************************************
00031 */
00032 
00033 okltest_solve_lineq(f) := block([A, special_symbol : "x", x1,x2],
00034   x1 : 777, x2 : -9999,
00035   assert(f(matrix(),[],[],[]) = []),
00036   assert(f(matrix([0]),[],[],[]) = [0]),
00037   assert(f(matrix([0]),[1],[],[]) = [1]),
00038   assert(f(matrix([0]),[],[1],[]) = [-1]),
00039   assert(f(matrix([0]),[],[],[1]) = [0]),
00040   assert(f(matrix([0]),[1],[1],[]) = false),
00041   assert(f(matrix([1]),[],[],[]) = [0]),
00042   assert(f(matrix([1]),[1],[],[]) = [1]),
00043   assert(f(matrix([1]),[],[1],[]) = false),
00044   assert(f(matrix([1]),[],[],[1]) = [0]),
00045   A : matrix([0,0],[0,0]),
00046   assert(f(A,[],[],[]) = [0,0]),
00047   assert(f(A,[1,2],[],[]) = [1,1]),
00048   assert(f(A,[1],[2],[]) = [1,-1]),
00049   assert(f(A,[],[2],[1]) = [0,-1]),
00050   assert(f(A,[],[],[1]) = [0,0]),
00051   A : matrix([1,1],[-1,-1]),
00052   assert(f(A,[],[],[]) = [0,0]),
00053   assert(f(A,[1],[],[]) = [1,-1]),
00054   assert(f(A,[],[1],[]) = [-1,1]),
00055   assert(f(A,[1],[2],[]) = [1,-1]),
00056   assert(f(A,[1],[1],[]) = false),
00057   true)$
00058