本文整理汇总了Java中ilog.cplex.IloCplex.setOut方法的典型用法代码示例。如果您正苦于以下问题:Java IloCplex.setOut方法的具体用法?Java IloCplex.setOut怎么用?Java IloCplex.setOut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilog.cplex.IloCplex
的用法示例。
在下文中一共展示了IloCplex.setOut方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tuning
import ilog.cplex.IloCplex; //导入方法依赖的package包/类
private void tuning(IloCplex cplex) throws IloException {
if (logLevel < 2) {
cplex.setOut(null);
cplex.setWarning(null);
}
if (isLBShared) {
cplex.use(new MIPCallback(logLevel == 0));
}
cplex.setParam(IloCplex.IntParam.Threads, threads);
cplex.setParam(IloCplex.IntParam.ParallelMode, -1);
cplex.setParam(IloCplex.IntParam.MIPOrdType, 3);
if (tl.getRemainingTime() <= 0) {
cplex.setParam(IloCplex.DoubleParam.TiLim, EPS);
} else if (tl.getRemainingTime() != Double.POSITIVE_INFINITY) {
cplex.setParam(IloCplex.DoubleParam.TiLim, tl.getRemainingTime());
}
}
示例2: buildModel
import ilog.cplex.IloCplex; //导入方法依赖的package包/类
/**
* Build the MIP model. Essentially this model calculates maximum weight independent sets.
*/
private void buildModel(){
try {
cplex=new IloCplex();
cplex.setParam(IloCplex.IntParam.AdvInd, 0);
cplex.setParam(IloCplex.IntParam.Threads, 1);
cplex.setOut(null);
//Create the variables (a single variable per edge)
vars=cplex.boolVarArray(dataModel.getNrVertices());
//Create the objective function
obj=cplex.addMaximize();
//Create the constraints z_i+z_j <= 1 for all (i,j)\in E:
for(DefaultEdge edge : dataModel.edgeSet())
cplex.addLe(cplex.sum(vars[dataModel.getEdgeSource(edge)], vars[dataModel.getEdgeTarget(edge)]), 1);
branchingConstraints=new HashMap<>();
} catch (IloException e) {
e.printStackTrace();
}
}
示例3: buildModel
import ilog.cplex.IloCplex; //导入方法依赖的package包/类
/**
* Build the MIP model
*/
private void buildModel(){
try {
cplex=new IloCplex();
cplex.setParam(IloCplex.IntParam.AdvInd, 0);
cplex.setParam(IloCplex.IntParam.Threads,config.MAXTHREADS);
cplex.setOut(null);
//Create the variables
vars=cplex.intVarArray(dataModel.nrFinals, 0, Integer.MAX_VALUE);
//Create the objective
obj=cplex.addMaximize(cplex.sum(vars));
//Create the constraints
cplex.addLe(cplex.scalProd(vars, dataModel.finals), dataModel.rollWidth);
} catch (IloException e) {
e.printStackTrace();
}
}
示例4: CycleChainPackingCplexSolver
import ilog.cplex.IloCplex; //导入方法依赖的package包/类
protected CycleChainPackingCplexSolver(KepInstance<V, E> kepInstance,
boolean displayOutput, Optional<Double> maxTimeSeconds,
boolean throwExceptionNoSolution) {
super(kepInstance, displayOutput, maxTimeSeconds);
try {
cplex = new IloCplex();
this.displayOutput = displayOutput;
if (maxTimeSeconds.isPresent()) {
cplex.setParam(DoubleParam.TiLim, maxTimeSeconds.get().doubleValue());
}
if (!displayOutput) {
cplex.setOut(null);
cplex.setWarning(null);
}
} catch (IloException e) {
throw new RuntimeException(e);
}
}
示例5: setControlParams
import ilog.cplex.IloCplex; //导入方法依赖的package包/类
public void setControlParams(IloCplex cplex, Iterable<SolveParam> params, Function<SolveParam, Object> getValue) {
for (SolveParam solveParam : params) {
Object value = getValue.apply(solveParam);
if (!solveParam.isInternal()) {
Object cplexParam = getCplexParam(solveParam);
logger.debug("Setting " + solveParam.toString() + " to: " + value.toString());
try {
if (solveParam.isBoolean()) {
cplex.setParam((BooleanParam) cplexParam, ((Boolean) value).booleanValue());
} else if (solveParam.isInteger()) {
cplex.setParam((IloCplex.IntParam) cplexParam, ((Integer) value).intValue());
} else if (solveParam.isDouble()) {
cplex.setParam((DoubleParam) cplexParam, ((Double) value).doubleValue());
} else if (solveParam.isString()) {
cplex.setParam((StringParam) cplexParam, (String) value);
} else {
throw new MIPException("Invalid solver param time: " + value);
}
} catch (IloException e) {
throw new MIPException(solveParam + ": " + value + ": " + e.toString());
}
} else if (solveParam == SolveParam.DISPLAY_OUTPUT && !(Boolean)getValue.apply(SolveParam.DISPLAY_OUTPUT)) {
cplex.setOut(null);
}
}
}
示例6: CplexHandler
import ilog.cplex.IloCplex; //导入方法依赖的package包/类
/**
* Constructor
*
* @throws IloException
*/
public CplexHandler() throws IloException {
m_cplex = new IloCplex();
m_lp = m_cplex.addLPMatrix();
m_solved = false;
m_obj = m_cplex.addMaximize();
m_cplex.setOut(null);
}
示例7: buildModel
import ilog.cplex.IloCplex; //导入方法依赖的package包/类
/**
* Build the cplex problem
*/
@Override
protected CuttingStockMasterData buildModel() {
try {
cplex =new IloCplex(); //Create cplex instance
cplex.setOut(null); //Disable cplex output
cplex.setParam(IloCplex.IntParam.Threads, config.MAXTHREADS); //Set number of threads that may be used by the cplex
//Define the objective
obj= cplex.addMinimize();
//Define constraints
satisfyDemandConstr=new IloRange[dataModel.nrFinals];
for(int i=0; i< dataModel.nrFinals; i++)
satisfyDemandConstr[i]= cplex.addRange(dataModel.demandForFinals[i], dataModel.demandForFinals[i], "satisfyDemandFinal_"+i);
//Define a container for the variables
} catch (IloException e) {
e.printStackTrace();
}
//Define a container for the variables
Map<PricingProblem,OrderedBiMap<CuttingPattern, IloNumVar>> varMap=new LinkedHashMap<>();
varMap.put(pricingProblems.get(0),new OrderedBiMap<>());
//Return a new data object which will hold data from the Master Problem. Since we are not working with inequalities in this example,
//we can simply return the default.
return new CuttingStockMasterData(varMap);
}
示例8: configure
import ilog.cplex.IloCplex; //导入方法依赖的package包/类
public void configure(final IloCplex cplex, final Options options) {
cplex.setOut(new OutputStream() {
@Override
public void write(final int b) throws IOException {
}
});
}
示例9: buildModel
import ilog.cplex.IloCplex; //导入方法依赖的package包/类
/**
* Build the model
*
* @throws IloException
*/
private void buildModel() throws IloException {
mCplex = new IloCplex();
mCplex.setOut(null);
createAndAddCoverCtrs();
createAndAddVars();
}