Author .......: Kurt Pagani
-- Date .........: Sun Jun 17 02:14:10 CEST 2018
fricas
)set break resume
fricas
)expose UnittestCount UnittestAux Unittest
UnittestCount is now explicitly exposed in frame initial
UnittestAux is now explicitly exposed in frame initial
Unittest is now explicitly exposed in frame initial
--)co linprog
fricas
)expose LINPROG
LinearProgramming is already explicitly exposed in frame initial
-- Test Suite
testsuite "Package: LinearProgramming"
All user variables and function definitions have been cleared.
WARNING: string for testsuite should have less than 15 characters!
Type: Void
fricas
-- Cases
testcase "revisedSimplex"
All user variables and function definitions have been cleared.
Type: Void
fricas
-- testEquals("", "")
A:=matrix [[0.7,1.0,1.0,0.0,0.0,0.0],[0.5,(5/6)::Float,0.0,1.0,0.0,0.0],
[1.0,(2/3)::Float,0.0,0.0,1.0,0.0],[0.1,0.25,0.0,0.0,0.0,1.0]]
Type: Matrix(Float)
fricas
c:=vector [-10.0,-9.0,0.0,0.0,0.0,0.0]
Type: Vector(Float)
fricas
b:=vector [630.0,600.0,708.0,135.0]
Type: Vector(Float)
fricas
B:=[3,4,5,6]
Type: List(PositiveInteger
?)
fricas
X1:Vector Float:= vector [540.0,252.0,0.0,120.0,0.0,18.0]
Type: Vector(Float)
fricas
objVal1:Float:= - 7668.0
Type: Float
fricas
Basis1:List Integer:= [2,4,1,6]
Type: List(Integer)
fricas
eps:=0.0000000001
Type: Float
fricas
floatNull(v:Vector Float):Boolean == sqrt dot(v,v) <= eps
Function declaration floatNull : Vector(Float) -> Boolean has been
added to workspace.
Type: Void
fricas
r1:=revisedSimplex( A, b, c, B)
Type: Record(X: Vector(Float),objVal: Float,Basis: List(Integer))
fricas
testEquals("floatNull(r1.X-X1)", "true")
fricas
Compiling function floatNull with type Vector(Float) -> Boolean
Type: Void
fricas
testEquals("abs(r1.objVal-objVal1)<eps", "true")
Type: Void
fricas
testEquals("r1.Basis", "Basis1")
Type: Void
fricas
r1lu:=revisedSimplexLU( A, b, c, B)
Type: Record(X: Vector(Float),objVal: Float,Basis: List(Integer))
fricas
testEquals("floatNull(r1lu.X-X1)", "true")
Type: Void
fricas
testEquals("abs(r1lu.objVal-objVal1)<eps", "true")
Type: Void
fricas
testEquals("r1lu.Basis", "Basis1")
Type: Void
fricas
--
---
A2 := matrix [[0,1,-1,0,0,0], [1,1,0,-1,0,0],
[-0.5,1,0,0,1,0],[-1,1,0,0,0,1]]
Type: Matrix(Float)
fricas
c2 := vector [2,-3,0,0,0,0]
Type: Vector(Integer)
fricas
b2 := vector [1,2,8,6]
Type: Vector(PositiveInteger
?)
fricas
B2 := [1,2,5,6]
Type: List(PositiveInteger
?)
fricas
X2:= [4.0,10.0,9.0,12.0,0.0,0.0]
Type: List(Float)
fricas
objVal2:= - 22.0
Type: Float
fricas
Basis2:= [3,2,1,4]
Type: List(PositiveInteger
?)
fricas
r2:=revisedSimplex( A2, b2, c2, B2)
Type: Record(X: Vector(Float),objVal: Float,Basis: List(Integer))
fricas
testEquals("floatNull(r2.X-X2)", "true")
Type: Void
fricas
testEquals("abs(r2.objVal-objVal2)<eps", "true")
Type: Void
fricas
testEquals("r2.Basis", "Basis2")
Type: Void
fricas
r2lu:=revisedSimplexLU( A2, b2, c2, B2)
Type: Record(X: Vector(Float),objVal: Float,Basis: List(Integer))
fricas
testEquals("floatNull(r2lu.X-X2)", "true")
Type: Void
fricas
testEquals("abs(r2lu.objVal-objVal2)<eps", "true")
Type: Void
fricas
testEquals("r2lu.Basis", "Basis2")
Type: Void
fricas
--
A3 := matrix [[0.4,0.5,1,0,0],[0,0.2,0,1,0],[0.6,0.3,0,0,1]]
Type: Matrix(Float)
fricas
c3 := vector [-40,-30,0,0,0]
Type: Vector(Integer)
fricas
b3 := vector [20,5,21]
Type: Vector(PositiveInteger
?)
fricas
B3 := [3,4,5]
Type: List(PositiveInteger
?)
fricas
X3:= [25.0,20.0,0.0,1.0,0.0]
Type: List(Float)
fricas
objVal3:= - 1600.0
Type: Float
fricas
Basis3:= [2,4,1]
Type: List(PositiveInteger
?)
fricas
r3:=revisedSimplex(A3, b3, c3, B3)
Type: Record(X: Vector(Float),objVal: Float,Basis: List(Integer))
fricas
testEquals("floatNull(r3.X-X3)", "true")
Type: Void
fricas
testEquals("abs(r3.objVal-objVal3)<eps", "true")
Type: Void
fricas
testEquals("r3.Basis", "Basis3")
Type: Void
fricas
r3lu:=revisedSimplexLU(A3, b3, c3, B3)
Type: Record(X: Vector(Float),objVal: Float,Basis: List(Integer))
fricas
testEquals("floatNull(r3lu.X-X3)", "true")
Type: Void
fricas
testEquals("abs(r3lu.objVal-objVal3)<eps", "true")
Type: Void
fricas
testEquals("r3lu.Basis", "Basis3")
Type: Void
fricas
--
A4 := matrix [[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],_
[0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],_
[0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],_
[0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0],_
[3, 0, 6, 0, 5, 0, 7, 0, 1, 0, 0, 0, 0, 0, 1, 0],_
[0, 2, 0, 4, 0, 10, 0, 4, 0, 1, 0, 0, 0, 0, 0, 1]]
Type: Matrix(NonNegativeInteger
?)
fricas
b4 := vector [1, 1, 1, 1, 13, 10]
Type: Vector(PositiveInteger
?)
fricas
c4 := vector [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]
Type: Vector(NonNegativeInteger
?)
fricas
B4 := [11, 12, 13, 14, 15, 16]
Type: List(PositiveInteger
?)
fricas
X4:= [1.0, 0.0, 0.25, 0.7500000000_0000000001, 0.3, 0.7, 1.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
Type: List(Float)
fricas
objVal4:= 0.0
Type: Float
fricas
Basis4:= [1,3,6,5,7,4]
Type: List(PositiveInteger
?)
fricas
r4 := revisedSimplex( A4, b4, c4, B4)
Type: Record(X: Vector(Float),objVal: Float,Basis: List(Integer))
fricas
testEquals("floatNull(r4.X-X4)", "true")
Type: Void
fricas
testEquals("abs(r4.objVal-objVal4)<eps", "true")
Type: Void
fricas
testEquals("r4.Basis", "Basis4")
Type: Void
fricas
r4lu := revisedSimplexLU( A4, b4, c4, B4)
Type: Record(X: Vector(Float),objVal: Float,Basis: List(Integer))
fricas
testEquals("floatNull(r4lu.X-X4)", "true")
Type: Void
fricas
testEquals("abs(r4lu.objVal-objVal4)<eps", "true")
Type: Void
fricas
testEquals("r4lu.Basis", "Basis4")
Type: Void
fricas
--
A5 := matrix [[1, -1, 1, 0, 0], [4, 9, 0, 1, 0], [-2, 4, 0, 0, 1]]
Type: Matrix(Integer)
fricas
c5 := vector [-1, -1, 0, 0, 0]
Type: Vector(Integer)
fricas
b5 := vector [2, 18, 4]
Type: Vector(PositiveInteger
?)
fricas
B5 := vector [3, 4, 5]
Type: Vector(PositiveInteger
?)
fricas
X5 := [2.7692307692_307692308, 0.7692307692_3076923077, 0.0, 0.0,
6.4615384615_384615385]
Type: List(Float)
fricas
objVal5:= - 3.5384615384_615384615
Type: Float
fricas
Basis5:= [1,2,5]
Type: List(PositiveInteger
?)
fricas
r5 := revisedSimplex( A5, b5, c5, B5)
Type: Record(X: Vector(Float),objVal: Float,Basis: List(Integer))
fricas
testEquals("floatNull(r5.X-X5)", "true")
Type: Void
fricas
testEquals("abs(r5.objVal-objVal5)<eps", "true")
Type: Void
fricas
testEquals("r5.Basis", "Basis5")
Type: Void
fricas
r5lu := revisedSimplexLU( A5, b5, c5, B5)
Type: Record(X: Vector(Float),objVal: Float,Basis: List(Integer))
fricas
testEquals("floatNull(r5lu.X-X5)", "true")
Type: Void
fricas
testEquals("abs(r5lu.objVal-objVal5)<eps", "true")
Type: Void
fricas
testEquals("r5lu.Basis", "Basis5")
Type: Void
fricas
-- Results/Statistics
fricas
)set output algebra on
fricas
)version
Value = "FriCAS 1.3.7 compiled at Wed Jun 30 16:44:06 UTC 2021"
fricas
)lisp (lisp-implementation-type)
Value = "SBCL"
fricas
)lisp (lisp-implementation-version)
Value = "1.1.1"
statistics()
=============================================================================
General WARNINGS:
* do not use ')clear completely' before having used 'statistics()'
It clears the statistics without warning!
* do not forget to pass the arguments of the testXxxx functions as Strings!
Otherwise, the test will fail and statistics() will not notice!
* testLibraryError does not prevent FriCAS from aborting the current block.
Thus, if a block contains other test functions, they will not be executed
and statistics() will not notice!
=============================================================================
Testsuite: Package: LinearProgramming
failed (total): 0 (1)
=============================================================================
testsuite | testcases: failed (total) | tests: failed (total)
Package: LinearProgramming 0 (1) 0 (30)
=============================================================================
File summary.
unexpected failures: 0
expected failures: 0
unexpected passes: 0
total tests: 30
Type: Void