|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object junit.framework.Assert junit.framework.TestCase cc.mallet.optimize.tests.TestOptimizable
public class TestOptimizable
Contains static methods for testing subclasses of Maximizable and Maximizable.ByGradient. Especially useful are methods that verify the consistency of the value and gradient functions of an instance of Maximizable.ByGradient.
Constructor Summary | |
---|---|
TestOptimizable(java.lang.String name)
|
Method Summary | |
---|---|
static void |
main(java.lang.String[] args)
|
static void |
setNumComponents(int n)
Sets the number of gradient components that will be checked. |
protected void |
setUp()
|
static junit.framework.Test |
suite()
|
static boolean |
testGetSetParameters(Optimizable maxable)
Tests that parameters set by setParameters can be retrieved by getParameters. |
void |
testTestValueAndGradient()
|
static boolean |
testValueAndGradient(Optimizable.ByGradientValue maxable)
Tests that getValue and getValueGradient are consistent. |
static double |
testValueAndGradientCurrentParameters(Optimizable.ByGradientValue maxable)
Tests that the value and gradient function are consistent at the current parameters. |
static double |
testValueAndGradientInDirection(Optimizable.ByGradientValue maxable,
double[] direction)
|
static boolean |
testValueAndGradientRandomParameters(Optimizable.ByGradientValue maxable,
java.util.Random r)
Tests that getValue and getValueGradient are consistent at a random parameter setting. |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TestOptimizable(java.lang.String name)
Method Detail |
---|
public static void setNumComponents(int n)
public static boolean testGetSetParameters(Optimizable maxable)
maxable
- Instance of a Maximizable that should be tested.
Its current parameters will be overwritten.public static double testValueAndGradientInDirection(Optimizable.ByGradientValue maxable, double[] direction)
public static double testValueAndGradientCurrentParameters(Optimizable.ByGradientValue maxable)
java.lang.IllegalStateException
- If the angle is above the tolerancetestValueAndGradient
,
testValueAndGradientRandomParameters
public static boolean testValueAndGradient(Optimizable.ByGradientValue maxable)
java.lang.IllegalStateException
- If the test fails.testValueAndGradientCurrentParameters
public static boolean testValueAndGradientRandomParameters(Optimizable.ByGradientValue maxable, java.util.Random r)
java.lang.IllegalStateException
- If the test fails.testValueAndGradientCurrentParameters
public void testTestValueAndGradient()
public static junit.framework.Test suite()
protected void setUp()
setUp
in class junit.framework.TestCase
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |