本文整理汇总了Java中org.apache.commons.math3.optim.PointValuePair类的典型用法代码示例。如果您正苦于以下问题:Java PointValuePair类的具体用法?Java PointValuePair怎么用?Java PointValuePair使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PointValuePair类属于org.apache.commons.math3.optim包,在下文中一共展示了PointValuePair类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: applyToNetwork
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
@Override
public double applyToNetwork(final MixedClearingNetwork network) {
Preconditions.checkNotNull(network);
final int dimension = network.getNumberOfEdges();
final ResidualCostFunction aggregateCostFunction =
super.getResidualScalarCostFunction(network);
final RealVector
start = new ArrayRealVector(network.getNumberOfEdges());
start.set(1.0); // Initial rate guess.
final BOBYQAOptimizer optimizer = new BOBYQAOptimizer(2*dimension + 1, 1.2, 1.e-8);
final PointValuePair result = optimizer.optimize(
new MaxEval(maximumEvaluations),
new ObjectiveFunction(aggregateCostFunction),
GoalType.MINIMIZE,
new SimpleBounds(new double[dimension], ArrayUtil.ones(dimension)),
new InitialGuess(start.toArray())
);
final double residualCost = result.getValue();
System.out.println("Network cleared: residual cost: " + residualCost + ".");
return residualCost;
}
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:26,代码来源:BoundedQuadraticEstimationClearingAlgorithm.java
示例2: solve
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
public void solve(ActionEvent actionEvent) {
disableControls();
try{
solver=new SimplexSolver(1e-6);
LinearObjectiveFunction function=setObjective();
Collection<LinearConstraint> constraints=setConstrains();
PointValuePair result = solver.optimize(new MaxIter(1000000),function,new LinearConstraintSet(constraints), GoalType.MINIMIZE,new NonNegativeConstraint(true));
retrieveResults(result);
}catch(Exception e)
{
Alert alert=new Alert(Alert.AlertType.ERROR);
alert.setHeaderText("Optimization failed due to error");
alert.setContentText(e.getMessage());
alert.showAndWait();
e.printStackTrace();
}
enableControls();
}
开发者ID:superdurszlak,项目名称:Transport-Production-Issue,代码行数:19,代码来源:Controller.java
示例3: retrieveResults
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
private void retrieveResults(PointValuePair result) {
int rows=suppliers.getValue();
int cols=recipients.getValue();
if (excessCheckbox.isSelected())
cols++;
double[] data=result.getPoint();
for (int i = 0; i < rows; i++) {
setVectorElement(excess,i,0);
}
for (int i = 0; i < data.length; i++) {
int x=i%cols;
int y=i/cols;
if(x<recipients.getValue())
setMatrixElement(this.result,y,x,data[i]);
else
setVectorElement(this.excess,y,data[i]);
}
double value=result.getValue();
cost.setText(String.valueOf(value));
}
开发者ID:superdurszlak,项目名称:Transport-Production-Issue,代码行数:21,代码来源:Controller.java
示例4: findOptimum
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
@Override
public TreeMap<Double, TariffSpecification> findOptimum(TariffUtilityEstimate tariffUtilityEstimate,
int NUM_RATES, int numEval) {
double[] startingVertex = new double[NUM_RATES]; // start from the fixed-rate tariff's offset
Arrays.fill(startingVertex, 0.0);
PowellOptimizer optimizer = new PowellOptimizer(1e-3, 5);
// needed since one optimization found positive
// charges (paying customer to consume...)
double[][] boundaries = createBoundaries(NUM_RATES);
final PointValuePair optimum
= optimizer.optimize(
new MaxEval(numEval),
//new ObjectiveFunction(new MultivariateFunctionMappingAdapter(tariffUtilityEstimate, boundaries[0], boundaries[1])),
new ObjectiveFunction(new OptimizerWrapperApacheObjective(tariffUtilityEstimate)),
GoalType.MAXIMIZE,
new InitialGuess(startingVertex)
);
TreeMap<Double, TariffSpecification> eval2TOUTariff = new TreeMap<Double, TariffSpecification>();
eval2TOUTariff.put(optimum.getValue(), tariffUtilityEstimate.getCorrespondingSpec(optimum.getKey()));
return eval2TOUTariff;
}
开发者ID:LARG,项目名称:TacTex,代码行数:27,代码来源:OptimizerWrapperApachePowell.java
示例5: solve
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
@Override
public void solve(double[] dir)
{
/* Check the dimension of the vectorspace where lives dir */
if (dir.length != d)
throw new LinearProgrammingSolverException(dddirMessage);
/* Update the constraints set of the simplex solver if modification */
if (lcListModified)
{
List <LinearConstraint> lcList = new ArrayList <LinearConstraint>();
int n = dirList.size();
for (int i = 0 ; i < n ; i++) lcList.add(new LinearConstraint(dirList.get(i), Relationship.LEQ, valList.get(i)));
lcSet = new LinearConstraintSet(lcList);
}
/* Evaluation */
PointValuePair res = solver.optimize(new LinearObjectiveFunction(dir, 0), lcSet, GoalType.MAXIMIZE);
/* Update the results and the flags */
point = res.getPoint ();
value = res.getSecond ();
evaluated = true;
lcListModified = false;
}
开发者ID:viryfrederic,项目名称:3plib,代码行数:23,代码来源:ACMLinearProgrammingSolver.java
示例6: iteration
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
private PointValuePair iteration(final PointValuePair init) {
PointValuePair result = init;
if (bounds != null) {
result = select("CM", cmaes(init.getFirst(), 10), result);
}
result = select("NM", nelderMead(init.getFirst()), result);
if (ADDITIONAL_OPTIMIZERS) {
result = select("MD", multiDirection(init.getFirst()), result);
result = select("PO", powell(init.getFirst()), result);
try {
result = select("BO", bobyqa(init.getFirst()), result);
} catch (final Exception e) {
logger.error("{}", e);
}
}
return result;
}
开发者ID:ProfilingIO,项目名称:insight-ml,代码行数:18,代码来源:AbstractOptimizable.java
示例7: NonLinearConjugateGradientOptimizer
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
/**
* @param updateFormula formula to use for updating the β parameter,
* must be one of {@link Formula#FLETCHER_REEVES} or
* {@link Formula#POLAK_RIBIERE}.
* @param checker Convergence checker.
* @param preconditioner Preconditioner.
* @param relativeTolerance Relative threshold for line search.
* @param absoluteTolerance Absolute threshold for line search.
* @param initialBracketingRange Extent of the initial interval used to
* find an interval that brackets the optimum in order to perform the
* line search.
*
* @see LineSearch#LineSearch(MultivariateOptimizer,double,double,double)
* @since 3.3
*/
public NonLinearConjugateGradientOptimizer(final Formula updateFormula,
ConvergenceChecker<PointValuePair> checker,
double relativeTolerance,
double absoluteTolerance,
double initialBracketingRange,
final Preconditioner preconditioner) {
super(checker);
this.updateFormula = updateFormula;
this.preconditioner = preconditioner;
line = new LineSearch(this,
relativeTolerance,
absoluteTolerance,
initialBracketingRange);
}
开发者ID:biocompibens,项目名称:SME,代码行数:31,代码来源:NonLinearConjugateGradientOptimizer.java
示例8: getPairComparator
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
/**
* @return a comparator for sorting the optima.
*/
private Comparator<PointValuePair> getPairComparator() {
return new Comparator<PointValuePair>() {
/** {@inheritDoc} */
public int compare(final PointValuePair o1,
final PointValuePair o2) {
if (o1 == null) {
return (o2 == null) ? 0 : 1;
} else if (o2 == null) {
return -1;
}
final double v1 = o1.getValue();
final double v2 = o2.getValue();
return (optimizer.getGoalType() == GoalType.MINIMIZE) ?
Double.compare(v1, v2) : Double.compare(v2, v1);
}
};
}
开发者ID:biocompibens,项目名称:SME,代码行数:21,代码来源:MultiStartMultivariateOptimizer.java
示例9: doOptimize
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected PointValuePair doOptimize() {
final double[] lowerBound = getLowerBound();
final double[] upperBound = getUpperBound();
// Validity checks.
setup(lowerBound, upperBound);
isMinimize = (getGoalType() == GoalType.MINIMIZE);
currentBest = new ArrayRealVector(getStartPoint());
final double value = bobyqa(lowerBound, upperBound);
return new PointValuePair(currentBest.getDataRef(),
isMinimize ? value : -value);
}
开发者ID:biocompibens,项目名称:SME,代码行数:18,代码来源:BOBYQAOptimizer.java
示例10: build
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
/**
* Build an initial simplex.
*
* @param startPoint First point of the simplex.
* @throws DimensionMismatchException if the start point does not match
* simplex dimension.
*/
public void build(final double[] startPoint) {
if (dimension != startPoint.length) {
throw new DimensionMismatchException(dimension, startPoint.length);
}
// Set first vertex.
simplex = new PointValuePair[dimension + 1];
simplex[0] = new PointValuePair(startPoint, Double.NaN);
// Set remaining vertices.
for (int i = 0; i < dimension; i++) {
final double[] confI = startConfiguration[i];
final double[] vertexI = new double[dimension];
for (int k = 0; k < dimension; k++) {
vertexI[k] = startPoint[k] + confI[k];
}
simplex[i + 1] = new PointValuePair(vertexI, Double.NaN);
}
}
开发者ID:biocompibens,项目名称:SME,代码行数:27,代码来源:AbstractSimplex.java
示例11: evaluateNewSimplex
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
/**
* Compute and evaluate a new simplex.
*
* @param evaluationFunction Evaluation function.
* @param original Original simplex (to be preserved).
* @param coeff Linear coefficient.
* @param comparator Comparator to use to sort simplex vertices from best
* to poorest.
* @return the best point in the transformed simplex.
* @throws org.apache.commons.math3.exception.TooManyEvaluationsException
* if the maximal number of evaluations is exceeded.
*/
private PointValuePair evaluateNewSimplex(final MultivariateFunction evaluationFunction,
final PointValuePair[] original,
final double coeff,
final Comparator<PointValuePair> comparator) {
final double[] xSmallest = original[0].getPointRef();
// Perform a linear transformation on all the simplex points,
// except the first one.
setPoint(0, original[0]);
final int dim = getDimension();
for (int i = 1; i < getSize(); i++) {
final double[] xOriginal = original[i].getPointRef();
final double[] xTransformed = new double[dim];
for (int j = 0; j < dim; j++) {
xTransformed[j] = xSmallest[j] + coeff * (xSmallest[j] - xOriginal[j]);
}
setPoint(i, new PointValuePair(xTransformed, Double.NaN, false));
}
// Evaluate the simplex.
evaluate(evaluationFunction, comparator);
return getPoint(0);
}
开发者ID:biocompibens,项目名称:SME,代码行数:36,代码来源:MultiDirectionalSimplex.java
示例12: PowellOptimizer
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
/**
* This constructor allows to specify a user-defined convergence checker,
* in addition to the parameters that control the default convergence
* checking procedure and the line search tolerances.
*
* @param rel Relative threshold for this optimizer.
* @param abs Absolute threshold for this optimizer.
* @param lineRel Relative threshold for the internal line search optimizer.
* @param lineAbs Absolute threshold for the internal line search optimizer.
* @param checker Convergence checker.
* @throws NotStrictlyPositiveException if {@code abs <= 0}.
* @throws NumberIsTooSmallException if {@code rel < 2 * Math.ulp(1d)}.
*/
public PowellOptimizer(double rel,
double abs,
double lineRel,
double lineAbs,
ConvergenceChecker<PointValuePair> checker) {
super(checker);
if (rel < MIN_RELATIVE_TOLERANCE) {
throw new NumberIsTooSmallException(rel, MIN_RELATIVE_TOLERANCE, true);
}
if (abs <= 0) {
throw new NotStrictlyPositiveException(abs);
}
relativeThreshold = rel;
absoluteThreshold = abs;
// Create the line search optimizer.
line = new LineSearch(this,
lineRel,
lineAbs,
1d);
}
开发者ID:biocompibens,项目名称:SME,代码行数:36,代码来源:PowellOptimizer.java
示例13: CMAESOptimizer
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
/**
* @param maxIterations Maximal number of iterations.
* @param stopFitness Whether to stop if objective function value is smaller than
* {@code stopFitness}.
* @param isActiveCMA Chooses the covariance matrix update method.
* @param diagonalOnly Number of initial iterations, where the covariance matrix
* remains diagonal.
* @param checkFeasableCount Determines how often new random objective variables are
* generated in case they are out of bounds.
* @param random Random generator.
* @param generateStatistics Whether statistic data is collected.
* @param checker Convergence checker.
*
* @since 3.1
*/
public CMAESOptimizer(int maxIterations,
double stopFitness,
boolean isActiveCMA,
int diagonalOnly,
int checkFeasableCount,
RandomGenerator random,
boolean generateStatistics,
ConvergenceChecker<PointValuePair> checker) {
super(checker);
this.maxIterations = maxIterations;
this.stopFitness = stopFitness;
this.isActiveCMA = isActiveCMA;
this.diagonalOnly = diagonalOnly;
this.checkFeasableCount = checkFeasableCount;
this.random = random;
this.generateStatistics = generateStatistics;
}
开发者ID:biocompibens,项目名称:SME,代码行数:33,代码来源:CMAESOptimizer.java
示例14: optimize
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
/**
* Optimizes parameters using the Nelder-Mead Method
* @param initialGuess initial guess / state required for Nelder-Mead-Method
* @param costFunction which defines that the Mean Squared Error has to be minimized
* @return the optimized values
*/
private static double[] optimize(double[] initialGuess, MultivariateFunctionMappingAdapter costFunction) {
double[] result;
SimplexOptimizer optimizer = new SimplexOptimizer(simplexRelativeThreshold, simplexAbsoluteThreshold);
PointValuePair unBoundedResult = optimizer.optimize(
GoalType.MINIMIZE,
new MaxIter(MAX_ALLOWED_NUMBER_OF_ITERATION),
new MaxEval(MAX_ALLOWED_NUMBER_OF_EVALUATION),
new InitialGuess(initialGuess),
new ObjectiveFunction(costFunction),
new NelderMeadSimplex(initialGuess.length));
result = costFunction.unboundedToBounded(unBoundedResult.getPoint());
return result;
}
开发者ID:lidox,项目名称:reaction-test,代码行数:23,代码来源:NelderMeadOptimizer.java
示例15: testMath828Cycle
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
@Test
public void testMath828Cycle() {
LinearObjectiveFunction f = new LinearObjectiveFunction(
new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 0.0);
ArrayList <LinearConstraint>constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] {0.0, 16.0, 14.0, 69.0, 1.0, 85.0, 52.0, 43.0, 64.0, 97.0, 14.0, 74.0, 89.0, 28.0, 94.0, 58.0, 13.0, 22.0, 21.0, 17.0, 30.0, 25.0, 1.0, 59.0, 91.0, 78.0, 12.0, 74.0, 56.0, 3.0, 88.0,}, Relationship.GEQ, 91.0));
constraints.add(new LinearConstraint(new double[] {0.0, 60.0, 40.0, 81.0, 71.0, 72.0, 46.0, 45.0, 38.0, 48.0, 40.0, 17.0, 33.0, 85.0, 64.0, 32.0, 84.0, 3.0, 54.0, 44.0, 71.0, 67.0, 90.0, 95.0, 54.0, 99.0, 99.0, 29.0, 52.0, 98.0, 9.0,}, Relationship.GEQ, 54.0));
constraints.add(new LinearConstraint(new double[] {0.0, 41.0, 12.0, 86.0, 90.0, 61.0, 31.0, 41.0, 23.0, 89.0, 17.0, 74.0, 44.0, 27.0, 16.0, 47.0, 80.0, 32.0, 11.0, 56.0, 68.0, 82.0, 11.0, 62.0, 62.0, 53.0, 39.0, 16.0, 48.0, 1.0, 63.0,}, Relationship.GEQ, 62.0));
constraints.add(new LinearConstraint(new double[] {83.0, -76.0, -94.0, -19.0, -15.0, -70.0, -72.0, -57.0, -63.0, -65.0, -22.0, -94.0, -22.0, -88.0, -86.0, -89.0, -72.0, -16.0, -80.0, -49.0, -70.0, -93.0, -95.0, -17.0, -83.0, -97.0, -31.0, -47.0, -31.0, -13.0, -23.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {41.0, -96.0, -41.0, -48.0, -70.0, -43.0, -43.0, -43.0, -97.0, -37.0, -85.0, -70.0, -45.0, -67.0, -87.0, -69.0, -94.0, -54.0, -54.0, -92.0, -79.0, -10.0, -35.0, -20.0, -41.0, -41.0, -65.0, -25.0, -12.0, -8.0, -46.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {27.0, -42.0, -65.0, -49.0, -53.0, -42.0, -17.0, -2.0, -61.0, -31.0, -76.0, -47.0, -8.0, -93.0, -86.0, -62.0, -65.0, -63.0, -22.0, -43.0, -27.0, -23.0, -32.0, -74.0, -27.0, -63.0, -47.0, -78.0, -29.0, -95.0, -73.0,}, Relationship.GEQ, 0.0));
constraints.add(new LinearConstraint(new double[] {15.0, -46.0, -41.0, -83.0, -98.0, -99.0, -21.0, -35.0, -7.0, -14.0, -80.0, -63.0, -18.0, -42.0, -5.0, -34.0, -56.0, -70.0, -16.0, -18.0, -74.0, -61.0, -47.0, -41.0, -15.0, -79.0, -18.0, -47.0, -88.0, -68.0, -55.0,}, Relationship.GEQ, 0.0));
double epsilon = 1e-6;
PointValuePair solution = new SimplexSolver().optimize(DEFAULT_MAX_ITER, f,
new LinearConstraintSet(constraints),
GoalType.MINIMIZE, new NonNegativeConstraint(true),
PivotSelectionRule.BLAND);
Assert.assertEquals(1.0d, solution.getValue(), epsilon);
Assert.assertTrue(validSolution(solution, constraints, epsilon));
}
开发者ID:Quanticol,项目名称:CARMA,代码行数:24,代码来源:SimplexSolverTest.java
示例16: doTest
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
/**
* @param func Function to optimize.
* @param startPoint Starting point.
* @param boundaries Upper / lower point limit.
* @param goal Minimization or maximization.
* @param fTol Tolerance relative error on the objective function.
* @param pointTol Tolerance for checking that the optimum is correct.
* @param maxEvaluations Maximum number of evaluations.
* @param expected Expected point / value.
*/
private void doTest(MultivariateFunction func,
double[] startPoint,
double[][] boundaries,
GoalType goal,
double fTol,
double pointTol,
int maxEvaluations,
PointValuePair expected) {
doTest(func,
startPoint,
boundaries,
goal,
fTol,
pointTol,
maxEvaluations,
0,
expected,
"");
}
开发者ID:Quanticol,项目名称:CARMA,代码行数:30,代码来源:BOBYQAOptimizerTest.java
示例17: testConstrainedRosenWithMoreInterpolationPoints
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
@Ignore @Test
public void testConstrainedRosenWithMoreInterpolationPoints() {
final double[] startPoint = point(DIM, 0.1);
final double[][] boundaries = boundaries(DIM, -1, 2);
final PointValuePair expected = new PointValuePair(point(DIM, 1.0), 0.0);
// This should have been 78 because in the code the hard limit is
// said to be
// ((DIM + 1) * (DIM + 2)) / 2 - (2 * DIM + 1)
// i.e. 78 in this case, but the test fails for 48, 59, 62, 63, 64,
// 65, 66, ...
final int maxAdditionalPoints = 47;
for (int num = 1; num <= maxAdditionalPoints; num++) {
doTest(new Rosen(), startPoint, boundaries,
GoalType.MINIMIZE,
1e-12, 1e-6, 2000,
num,
expected,
"num=" + num);
}
}
开发者ID:Quanticol,项目名称:CARMA,代码行数:23,代码来源:BOBYQAOptimizerTest.java
示例18: getPairComparator
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
/**
* @return a comparator for sorting the optima.
*/
private Comparator<PointValuePair> getPairComparator() {
return new Comparator<PointValuePair>() {
public int compare(final PointValuePair o1,
final PointValuePair o2) {
if (o1 == null) {
return (o2 == null) ? 0 : 1;
} else if (o2 == null) {
return -1;
}
final double v1 = o1.getValue();
final double v2 = o2.getValue();
return (optimizer.getGoalType() == GoalType.MINIMIZE) ?
Double.compare(v1, v2) : Double.compare(v2, v1);
}
};
}
开发者ID:Quanticol,项目名称:CARMA,代码行数:20,代码来源:MultiStartMultivariateOptimizer.java
示例19: testMinimize1
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
@Test
public void testMinimize1() {
SimplexOptimizer optimizer = new SimplexOptimizer(1e-10, 1e-30);
final FourExtrema fourExtrema = new FourExtrema();
final PointValuePair optimum
= optimizer.optimize(new MaxEval(100),
new ObjectiveFunction(fourExtrema),
GoalType.MINIMIZE,
new InitialGuess(new double[] { -3, 0 }),
new NelderMeadSimplex(new double[] { 0.2, 0.2 }));
Assert.assertEquals(fourExtrema.xM, optimum.getPoint()[0], 2e-7);
Assert.assertEquals(fourExtrema.yP, optimum.getPoint()[1], 2e-5);
Assert.assertEquals(fourExtrema.valueXmYp, optimum.getValue(), 6e-12);
Assert.assertTrue(optimizer.getEvaluations() > 60);
Assert.assertTrue(optimizer.getEvaluations() < 90);
// Check that the number of iterations is updated (MATH-949).
Assert.assertTrue(optimizer.getIterations() > 0);
}
开发者ID:Quanticol,项目名称:CARMA,代码行数:21,代码来源:SimplexOptimizerNelderMeadTest.java
示例20: testMath272
import org.apache.commons.math3.optim.PointValuePair; //导入依赖的package包/类
@Test
public void testMath272() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 2, 2, 1 }, 0);
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 1, 1, 0 }, Relationship.GEQ, 1));
constraints.add(new LinearConstraint(new double[] { 1, 0, 1 }, Relationship.GEQ, 1));
constraints.add(new LinearConstraint(new double[] { 0, 1, 0 }, Relationship.GEQ, 1));
SimplexSolver solver = new SimplexSolver();
PointValuePair solution = solver.optimize(DEFAULT_MAX_ITER, f, new LinearConstraintSet(constraints),
GoalType.MINIMIZE, new NonNegativeConstraint(true));
Assert.assertEquals(0.0, solution.getPoint()[0], .0000001);
Assert.assertEquals(1.0, solution.getPoint()[1], .0000001);
Assert.assertEquals(1.0, solution.getPoint()[2], .0000001);
Assert.assertEquals(3.0, solution.getValue(), .0000001);
}
开发者ID:Quanticol,项目名称:CARMA,代码行数:18,代码来源:SimplexSolverTest.java
注:本文中的org.apache.commons.math3.optim.PointValuePair类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论