本文整理汇总了Java中org.apache.commons.math3.exception.MaxCountExceededException类的典型用法代码示例。如果您正苦于以下问题:Java MaxCountExceededException类的具体用法?Java MaxCountExceededException怎么用?Java MaxCountExceededException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MaxCountExceededException类属于org.apache.commons.math3.exception包,在下文中一共展示了MaxCountExceededException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeDerivatives
import org.apache.commons.math3.exception.MaxCountExceededException; //导入依赖的package包/类
@Override
public void computeDerivatives(double t, double[] y, double[] yDot)
throws MaxCountExceededException, DimensionMismatchException {
int i,j;
DoubleMatrix demeYdot;
updateMatrices(t,y);
demeYdot = births.columnSums().transpose();
demeYdot.addi(migrations.columnSums().transpose());
demeYdot.subi(migrations.rowSums());
demeYdot.subi(deaths);
for(i=0; i<numDemes; i++) { yDot[i] = demeYdot.get(i,0); }
for(j=0; i<numDemes+numNonDemes; i++,j++) { yDot[i] = nondemeYdot[j]; }
/* -- previous code optimisation
if (this.fixedStepSize) {
timeseries.addFG(t, births, migrations);
}
*/
}
示例2: computeDerivatives
import org.apache.commons.math3.exception.MaxCountExceededException; //导入依赖的package包/类
@Override
public void computeDerivatives(double t, double[] y, double[] yDot)
throws MaxCountExceededException, DimensionMismatchException
{
if(Double.isNaN(t))
{
throw new MaxCountExceededException(t);
}
setCurrentTime(t);
vectorWrapper.setValues(y);
computeAssignmentRules();
vectorWrapper.setRates(yDot);
computeRates();
}
示例3: computeDerivatives
import org.apache.commons.math3.exception.MaxCountExceededException; //导入依赖的package包/类
/** Get the current time derivative of the complete state vector.
* @param t current value of the independent <I>time</I> variable
* @param y array containing the current value of the complete state vector
* @return time derivative of the complete state vector
* @exception MaxCountExceededException if the number of functions evaluations is exceeded
* @exception DimensionMismatchException if arrays dimensions do not match equations settings
*/
public T[] computeDerivatives(final T t, final T[] y)
throws MaxCountExceededException, DimensionMismatchException {
final T[] yDot = MathArrays.buildArray(t.getField(), mapper.getTotalDimension());
// compute derivatives of the primary equations
int index = 0;
final T[] primaryState = mapper.extractEquationData(index, y);
final T[] primaryStateDot = primary.computeDerivatives(t, primaryState);
mapper.insertEquationData(index, primaryStateDot, yDot);
// Add contribution for secondary equations
while (++index < mapper.getNumberOfEquations()) {
final T[] componentState = mapper.extractEquationData(index, y);
final T[] componentStateDot = components.get(index - 1).computeDerivatives(t, primaryState, primaryStateDot,
componentState);
mapper.insertEquationData(index, componentStateDot, yDot);
}
return yDot;
}
示例4: doIntegrate
import org.apache.commons.math3.exception.MaxCountExceededException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected double doIntegrate()
throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException {
double oldt = stage(this, 0);
incrementCount();
while (true) {
final int i = getIterations();
final double t = stage(this, i);
if (i >= getMinimalIterationCount()) {
final double delta = FastMath.abs(t - oldt);
final double rLimit =
getRelativeAccuracy() * (FastMath.abs(oldt) + FastMath.abs(t)) * 0.5;
if ((delta <= rLimit) || (delta <= getAbsoluteAccuracy())) {
return t;
}
}
oldt = t;
incrementCount();
}
}
示例5: computeMainStateJacobian
import org.apache.commons.math3.exception.MaxCountExceededException; //导入依赖的package包/类
/** {@inheritDoc} */
public void computeMainStateJacobian(double t, double[] y, double[] yDot, double[][] dFdY)
throws MaxCountExceededException, DimensionMismatchException {
final int n = ode.getDimension();
final double[] tmpDot = new double[n];
for (int j = 0; j < n; ++j) {
final double savedYj = y[j];
y[j] += hY[j];
ode.computeDerivatives(t, y, tmpDot);
for (int i = 0; i < n; ++i) {
dFdY[i][j] = (tmpDot[i] - yDot[i]) / hY[j];
}
y[j] = savedYj;
}
}
示例6: doOptimize
import org.apache.commons.math3.exception.MaxCountExceededException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public PointValuePair doOptimize()
throws MaxCountExceededException, UnboundedSolutionException, NoFeasibleSolutionException {
final SimplexTableau tableau =
new SimplexTableau(getFunction(),
getConstraints(),
getGoalType(),
restrictToNonNegative(),
epsilon,
maxUlps);
solvePhase1(tableau);
tableau.dropPhase1Objective();
while (!tableau.isOptimal()) {
doIteration(tableau);
}
return tableau.getSolution();
}
示例7: computeParameterJacobian
import org.apache.commons.math3.exception.MaxCountExceededException; //导入依赖的package包/类
/** {@inheritDoc} */
public void computeParameterJacobian(double t, double[] y, double[] yDot,
String paramName, double[] dFdP)
throws DimensionMismatchException, MaxCountExceededException {
final int n = fode.getDimension();
if (pode.isSupported(paramName)) {
final double[] tmpDot = new double[n];
// compute the jacobian df/dp w.r.t. parameter
final double p = pode.getParameter(paramName);
final double hP = hParam.get(paramName);
pode.setParameter(paramName, p + hP);
fode.computeDerivatives(t, y, tmpDot);
for (int i = 0; i < n; ++i) {
dFdP[i] = (tmpDot[i] - yDot[i]) / hP;
}
pode.setParameter(paramName, p);
} else {
Arrays.fill(dFdP, 0, n, 0.0);
}
}
示例8: handleStep
import org.apache.commons.math3.exception.MaxCountExceededException; //导入依赖的package包/类
@Override
public void handleStep(StepInterpolator interpolator, boolean isLast) throws MaxCountExceededException {
double t = interpolator.getCurrentTime();
double[] y = interpolator.getInterpolatedState();
// make sure all y's are positive. Yes, then can become negative
for(int i=0; i<y.length;i++)
if (y[i]< 0) y[i]=0.0;
// System.out.println("--> Step handler: "+t);
timeseries.addY(t,y);
this.updateMatrices(t, y);
timeseries.addFG(t, births, migrations);
/* -- trying to optimise -too many special cases
if (this.fixedStepSize) {
timeseries.addY(t,y);
if (isLast) { // Final step in series
//System.out.println("Last iteration");
double[] yDot = new double[y.length];
this.computeDerivatives(t, y, yDot);
}
} else {
timeseries.addY(t,y);
// add last-computed FG matrices
timeseries.addFG(t,this.births,this.migrations);
}
*/
}
示例9: computeObjectiveValue
import org.apache.commons.math3.exception.MaxCountExceededException; //导入依赖的package包/类
/**
* Compute the objective function value.
*
* @param point Point at which the objective function must be evaluated.
* @return the objective function value at the specified point.
* @throws TooManyEvaluationsException if the maximal number of evaluations is
* exceeded.
*/
protected double[] computeObjectiveValue(double[] point) {
try {
evaluations.incrementCount();
} catch (MaxCountExceededException e) {
throw new TooManyEvaluationsException(e.getMax());
}
return function.value(point);
}
示例10: eval
import org.apache.commons.math3.exception.MaxCountExceededException; //导入依赖的package包/类
/**
* @param f Function.
* @param x Argument.
* @return {@code f(x)}
* @throws TooManyEvaluationsException if the maximal number of evaluations is
* exceeded.
*/
private double eval(UnivariateFunction f, double x) {
try {
evaluations.increment();
} catch (MaxCountExceededException e) {
throw new TooManyEvaluationsException(e.getMax());
}
return f.value(x);
}
示例11: computeObjectiveValue
import org.apache.commons.math3.exception.MaxCountExceededException; //导入依赖的package包/类
/**
* Compute the objective function value.
*
* @param point Point at which the objective function must be evaluated.
* @return the objective function value at specified point.
* @throws TooManyEvaluationsException if the maximal number of evaluations
* is exceeded.
*/
protected double computeObjectiveValue(double point) {
try {
evaluations.incrementCount();
} catch (MaxCountExceededException e) {
throw new TooManyEvaluationsException(e.getMax());
}
return function.value(point);
}
示例12: solve
import org.apache.commons.math3.exception.MaxCountExceededException; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @throws NonSelfAdjointOperatorException if {@link #getCheck()} is
* {@code true}, and {@code a} is not self-adjoint
* @throws IllConditionedOperatorException if {@code a} is ill-conditioned
*/
@Override
public RealVector solve(final RealLinearOperator a, final RealVector b)
throws NullArgumentException, NonSquareOperatorException,
DimensionMismatchException, NonSelfAdjointOperatorException,
IllConditionedOperatorException, MaxCountExceededException {
MathUtils.checkNotNull(a);
final RealVector x = new ArrayRealVector(a.getColumnDimension());
x.set(0.);
return solveInPlace(a, null, b, x, false, 0.);
}
示例13: computeObjectiveValue
import org.apache.commons.math3.exception.MaxCountExceededException; //导入依赖的package包/类
/**
* Compute the objective function value.
*
* @param point Point at which the objective function must be evaluated.
* @return the objective function value at specified point.
* @throws TooManyEvaluationsException if the maximal number of function
* evaluations is exceeded.
*/
protected double computeObjectiveValue(final double point)
throws TooManyEvaluationsException {
try {
evaluations.increment();
} catch (MaxCountExceededException e) {
throw new TooManyEvaluationsException(e.getMax());
}
return function.value(point);
}
示例14: eval
import org.apache.commons.math3.exception.MaxCountExceededException; //导入依赖的package包/类
/**
* @param f Function.
* @param x Argument.
* @return {@code f(x)}
* @throws TooManyEvaluationsException if the maximal number of evaluations is
* exceeded.
*/
private double eval(UnivariateFunction f, double x) {
try {
evaluations.incrementCount();
} catch (MaxCountExceededException e) {
throw new TooManyEvaluationsException(e.getMax());
}
return f.value(x);
}
示例15: start
import org.apache.commons.math3.exception.MaxCountExceededException; //导入依赖的package包/类
/** Start the integration.
* <p>This method computes one step using the underlying starter integrator,
* and initializes the Nordsieck vector at step start. The starter integrator
* purpose is only to establish initial conditions, it does not really change
* time by itself. The top level multistep integrator remains in charge of
* handling time propagation and events handling as it will starts its own
* computation right from the beginning. In a sense, the starter integrator
* can be seen as a dummy one and so it will never trigger any user event nor
* call any user step handler.</p>
* @param equations complete set of differential equations to integrate
* @param initialState initial state (time, primary and secondary state vectors)
* @param t target time for the integration
* (can be set to a value smaller than <code>t0</code> for backward integration)
* @exception DimensionMismatchException if arrays dimension do not match equations settings
* @exception NumberIsTooSmallException if integration step is too small
* @exception MaxCountExceededException if the number of functions evaluations is exceeded
* @exception NoBracketingException if the location of an event cannot be bracketed
*/
protected void start(final FieldExpandableODE<T> equations, final FieldODEState<T> initialState, final T t)
throws DimensionMismatchException, NumberIsTooSmallException,
MaxCountExceededException, NoBracketingException {
// make sure NO user event nor user step handler is triggered,
// this is the task of the top level integrator, not the task
// of the starter integrator
starter.clearEventHandlers();
starter.clearStepHandlers();
// set up one specific step handler to extract initial Nordsieck vector
starter.addStepHandler(new FieldNordsieckInitializer(equations.getMapper(), (nSteps + 3) / 2));
// start integration, expecting a InitializationCompletedMarkerException
try {
starter.integrate(equations, initialState, t);
// we should not reach this step
throw new MathIllegalStateException(LocalizedFormats.MULTISTEP_STARTER_STOPPED_EARLY);
} catch (InitializationCompletedMarkerException icme) { // NOPMD
// this is the expected nominal interruption of the start integrator
// count the evaluations used by the starter
getEvaluationsCounter().increment(starter.getEvaluations());
}
// remove the specific step handler
starter.clearStepHandlers();
}