Beispiel #1
0
 private void setVarUBs(OpenIntToDoubleHashMap newUpperBounds) {
   variableUpperBoundsToRestore = new OpenIntToDoubleHashMap();
   for (OpenIntToDoubleHashMap.Iterator iterator = newUpperBounds.iterator();
       iterator.hasNext(); ) {
     iterator.advance();
     variableUpperBoundsToRestore.put(iterator.key(), basicLpSolver.getVarUB(iterator.key()));
     basicLpSolver.setVarUB(iterator.key(), iterator.value());
   }
 }
 @Override
 public double get(int constraint, int variable) {
   if (values.size() < constraint) {
     OpenIntToDoubleHashMap constraintVals = values.get(constraint);
     if (constraintVals.containsKey(variable)) {
       return constraintVals.get(variable);
     }
   }
   return 0;
 }
Beispiel #3
0
 private Solution advancedStartToSolution(OpenIntToDoubleHashMap advancedStart) {
   double[] values = new double[basicLpSolver.getNumVars()];
   for (int i = 0; i < values.length; i++) {
     if (advancedStart.containsKey(i)) {
       values[i] = advancedStart.get(i);
     } else {
       return null;
     }
   }
   return new Solution(
       this.basicLpSolver.evaluateObjective(advancedStart),
       values,
       this.integralityTol,
       this.integerVariables);
 }
Beispiel #4
0
 private void revertVarUBs() {
   for (OpenIntToDoubleHashMap.Iterator iterator = variableUpperBoundsToRestore.iterator();
       iterator.hasNext(); ) {
     iterator.advance();
     basicLpSolver.setVarUB(iterator.key(), iterator.value());
   }
 }