OptimizerUtil { public static boolean isWithinBounds (int[] rgParams, int[] rgLowerBound, int[] rgUpperBound) { OptimizerUtil.checkBoundVars (rgLowerBound, rgUpperBound); if (rgParams == null) throw new NullPointerException ("The argument rgParams must not be null."); if (rgParams.length != rgLowerBound.length) throw new RuntimeException ("The parameter array must be of the same length (" + rgLowerBound.length + ") as the upper and lower bounds."); for (int i = 0; i < rgParams.length; i++) if (rgParams[i] < rgLowerBound[i] || rgParams[i] > rgUpperBound[i]) return false; return true; }  static void checkBoundVars(int[] rgLowerBound, int[] rgUpperBound); static boolean isWithinBounds(int[] rgParams, int[] rgLowerBound, int[] rgUpperBound); static boolean isWithinBounds(int[] rgParams, int[] rgLowerBound, int[] rgUpperBound, Iterable<Expression> itConstraints); static boolean areConstraintsSatisfied(int[] rgParams, Iterable<Expression> itConstraints); static Expression substituteValues(Expression expr, int[] rgValues); static void adjustToBounds(int[] rgParams, int[] rgLower, int[] rgUpper); static boolean isInParamSet(int[] rgParams, int[][] rgParamSet); static void getRandomPointWithinBounds(int[] rgPoint, int[] rgLowerBound, int[] rgUpperBound); static int[] getRandomPointWithinBounds(int[] rgLowerBound, int[] rgUpperBound); static int[] getRandomPoint(int[][] rgParamSet); static void getNextConfigInPlace(int[] rgConfig, int[] rgParameterLowerBounds, int[] rgParameterUpperBounds); static int[] getNextConfig(int[] rgCurrent, int[] rgParameterLowerBounds, int[] rgParameterUpperBounds);  }
@Test public void testWithinBounds1 () { Assert.assertTrue (OptimizerUtil.isWithinBounds (new int[] { 8, 8, 8 }, m_rgLowerBounds, m_rgUpperBounds, m_listConstraints)); }
@Test public void testWithinBounds2 () { Assert.assertTrue (OptimizerUtil.isWithinBounds (new int[] { 1, 4, 128 }, m_rgLowerBounds, m_rgUpperBounds, m_listConstraints)); }
@Test public void testWithinBounds3 () { Assert.assertTrue (OptimizerUtil.isWithinBounds (new int[] { 8, 16, 8 }, m_rgLowerBounds, m_rgUpperBounds, m_listConstraints)); }
@Test public void testWithinBounds4 () { Assert.assertFalse (OptimizerUtil.isWithinBounds (new int[] { 16, 16, 16 }, m_rgLowerBounds, m_rgUpperBounds, m_listConstraints)); }
@Test public void testWithinBounds5 () { Assert.assertFalse (OptimizerUtil.isWithinBounds (new int[] { 8, 32, 16 }, m_rgLowerBounds, m_rgUpperBounds, m_listConstraints)); }