当前位置: 首页>>代码示例>>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;未经允许,请勿转载。