當前位置: 首頁>>代碼示例>>Java>>正文


Java Primitive64Array.set方法代碼示例

本文整理匯總了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;
            }
        }
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:36,代碼來源:ExpressionsBasedModel.java

示例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;
    }
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:12,代碼來源:Process1D.java

示例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;
            }
        }
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:23,代碼來源:ExpressionsBasedModel.java

示例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);
        }
    }
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:21,代碼來源:PrimitiveSeries.java

示例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);
    }
 
開發者ID:optimatika,項目名稱:ojAlgo-extensions,代碼行數:38,代碼來源:SolverCPLEX.java

示例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);
    }
 
開發者ID:optimatika,項目名稱:ojAlgo-extensions,代碼行數:40,代碼來源:SolverGurobi.java


注:本文中的org.ojalgo.array.Primitive64Array.set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。