本文整理汇总了Java中org.ojalgo.array.Primitive64Array.set方法的典型用法代码示例。如果您正苦于以下问题:Java Primitive64Array.set方法的具体用法?Java Primitive64Array.set怎么用?Java Primitive64Array.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ojalgo.array.Primitive64Array
的用法示例。
在下文中一共展示了Primitive64Array.set方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toModelState
import org.ojalgo.array.Primitive64Array; //导入方法依赖的package包/类
public Result toModelState(final Result solverState, final ExpressionsBasedModel model) {
final int numbVariables = model.countVariables();
if (this.isSolutionMapped()) {
final List<Variable> freeVariables = model.getFreeVariables();
final Set<IntIndex> fixedVariables = model.getFixedVariables();
if (solverState.count() != freeVariables.size()) {
throw new IllegalStateException();
}
final Primitive64Array modelSolution = Primitive64Array.make(numbVariables);
for (final IntIndex fixedIndex : fixedVariables) {
modelSolution.set(fixedIndex.index, model.getVariable(fixedIndex.index).getValue());
}
for (int f = 0; f < freeVariables.size(); f++) {
final int freeIndex = model.indexOf(freeVariables.get(f));
modelSolution.set(freeIndex, solverState.doubleValue(f));
}
return new Result(solverState.getState(), modelSolution);
} else {
if (solverState.count() != numbVariables) {
throw new IllegalStateException();
}
return solverState;
}
}
示例2: getValues
import org.ojalgo.array.Primitive64Array; //导入方法依赖的package包/类
public Primitive64Array getValues() {
final int tmpLength = myProcesses.length;
final Primitive64Array retVal = Primitive64Array.make(tmpLength);
for (int p = 0; p < tmpLength; p++) {
retVal.set(p, myProcesses[p].getValue());
}
return retVal;
}
示例3: toSolverState
import org.ojalgo.array.Primitive64Array; //导入方法依赖的package包/类
public Result toSolverState(final Result modelState, final ExpressionsBasedModel model) {
if (this.isSolutionMapped()) {
final List<Variable> tmpFreeVariables = model.getFreeVariables();
final int numbFreeVars = tmpFreeVariables.size();
final Primitive64Array solverSolution = Primitive64Array.make(numbFreeVars);
for (int i = 0; i < numbFreeVars; i++) {
final Variable variable = tmpFreeVariables.get(i);
final int modelIndex = model.indexOf(variable);
solverSolution.set(i, modelState.doubleValue(modelIndex));
}
return new Result(modelState.getState(), solverSolution);
} else {
return modelState;
}
}
示例4: sample
import org.ojalgo.array.Primitive64Array; //导入方法依赖的package包/类
public PrimitiveSeries sample(final int interval) {
if (interval <= 1) {
throw new IllegalArgumentException();
} else {
final int tmpSampleSize = this.size() / interval;
final int tmpLastIndex = this.size() - 1;
final Primitive64Array tmpValues = Primitive64Array.make(tmpSampleSize);
for (int i = 0; i < tmpSampleSize; i++) {
tmpValues.set(i, tmpLastIndex - (i * interval));
}
return PrimitiveSeries.wrap(this);
}
}
示例5: solve
import org.ojalgo.array.Primitive64Array; //导入方法依赖的package包/类
public Result solve(final Result kickStarter) {
try {
final List<IloNumVar> solVariables = this.getDelegateVariables();
Optimisation.State retState = Optimisation.State.UNEXPLORED;
double retValue = Double.NaN;
final Primitive64Array retSolution = Primitive64Array.make(solVariables.size());
DEFAULT.configure(myDelegateSolver, myOptions);
final Optional<Configurator> optional = myOptions.getConfigurator(Configurator.class);
if (optional.isPresent()) {
optional.get().configure(myDelegateSolver, myOptions);
}
if (myDelegateSolver.solve()) {
// Feasible or Optimal
for (int i = 0; i < solVariables.size(); i++) {
retSolution.set(i, myDelegateSolver.getValue(solVariables.get(i)));
}
retValue = myDelegateSolver.getObjValue();
}
retState = this.translate(myDelegateSolver.getStatus());
return new Result(retState, retValue, retSolution);
} catch (final IloException exception) {
exception.printStackTrace();
}
return new Result(Optimisation.State.FAILED, Double.NaN, kickStarter);
}
示例6: solve
import org.ojalgo.array.Primitive64Array; //导入方法依赖的package包/类
public Result solve(final Result kickStarter) {
final GRBVar[] tmpVars = myDelegateSolver.getVars();
Optimisation.State retState = Optimisation.State.UNEXPLORED;
double retValue = NaN;
final Primitive64Array retSolution = Primitive64Array.make(myDelegateSolver.getVars().length);
try {
final GRBEnv tmpEnvironment = INTEGRATION.getEnvironment();
DEFAULT.configure(tmpEnvironment, myDelegateSolver, myOptions);
final Optional<Configurator> optional = myOptions.getConfigurator(Configurator.class);
if (optional.isPresent()) {
optional.get().configure(tmpEnvironment, myDelegateSolver, myOptions);
}
myDelegateSolver.getEnv().set(gurobi.GRB.IntParam.OutputFlag, 0);
myDelegateSolver.optimize();
retState = this.translate(myDelegateSolver.get(IntAttr.Status));
if (retState.isFeasible()) {
retValue = myDelegateSolver.get(DoubleAttr.ObjVal);
for (int i = 0; i < tmpVars.length; i++) {
retSolution.set(i, tmpVars[i].get(DoubleAttr.X));
}
}
} catch (final GRBException exception) {
exception.printStackTrace();
}
return new Optimisation.Result(retState, retValue, retSolution);
}