/** * Sets the value of a variable * * @param index Index of the variable * @param value Value to be assigned * @throws JMException */ public void setValue(int index, double value) throws JMException { if (type_.getClass() == RealSolutionType.class) solution_.getDecisionVariables()[index].setValue(value); else if (type_.getClass() == ArrayRealSolutionType.class) ((ArrayReal) (solution_.getDecisionVariables()[0])).array_[index] = value; else Configuration.logger_.severe( "jmetal.util.wrapper.XReal.setValue, solution type " + type_ + "+ invalid"); } // setValue
/** * Returns the number of variables of the solution * * @return */ public int size() { if ((type_.getClass().equals(RealSolutionType.class)) || (type_.getClass().equals(BinaryRealSolutionType.class))) return solution_.getDecisionVariables().length; else if (type_.getClass().equals(ArrayRealSolutionType.class)) return ((ArrayReal) (solution_.getDecisionVariables()[0])).getLength(); else Configuration.logger_.severe( "jmetal.util.wrapper.XReal.size, solution type " + type_ + "+ invalid"); return 0; } // size
/** * Gets the lower bound of a variable * * @param index Index of the variable * @return The lower bound of the variable * @throws JMException */ public double getLowerBound(int index) throws JMException { if ((type_.getClass() == RealSolutionType.class) || (type_.getClass() == BinaryRealSolutionType.class)) return solution_.getDecisionVariables()[index].getLowerBound(); else if (type_.getClass() == ArrayRealSolutionType.class) return ((ArrayReal) (solution_.getDecisionVariables()[0])).getLowerBound(index); else { Configuration.logger_.severe( "jmetal.util.wrapper.XReal.getLowerBound, solution type " + type_ + "+ invalid"); } return 0.0; } // getLowerBound