コード例 #1
0
ファイル: MipSolverImpl.java プロジェクト: rma350/mip-java
  private void proposeIntegerSolution(Node sourceNode, Solution solution, NodeLog nodeLog) {

    boolean constrAdded =
        processCutCallbacks(
            sourceNode,
            this.lazyConstraintCallbacks,
            solution,
            this.mipLog.getLazyConstraintCallbackLog());
    if (constrAdded) {

    } else {

      this.submitFeasibleSolution(solution);
      nodeLog.setIncumbent(Optional.of(solution.getObjValue()));
      nodeLog.setNewSolutionStatus(NewSolutionStatus.INTEGRAL);
      if (this.excludeOptimumCallback.isPresent()) {

        processCutCallbacks(
            sourceNode,
            Lists.newArrayList(excludeOptimumCallback.get()),
            solution,
            this.mipLog.getExcludeOptimumCallbackLog());
      }
    }
  }
コード例 #2
0
ファイル: MipSolverImpl.java プロジェクト: rma350/mip-java
  private void setBasicNodeLogInfo(Node node, NodeLog nodeLog) {
    nodeLog.setBestBound(node.getBestBound());
    nodeLog.setCurrentNode(node.getId());

    if (!this.optimalSolutions.isEmpty()) {
      nodeLog.setIncumbent(Optional.of(optimalSolutions.first().getObjValue()));
    } else if (!this.otherSolutions.isEmpty()) {
      nodeLog.setIncumbent(Optional.of(otherSolutions.first().getObjValue()));
    } else {
      nodeLog.setIncumbent(Optional.<Double>absent());
    }
    nodeLog.setNodesCreated(this.nodesCreated);
    nodeLog.setNodeStackSize(this.nodeStack.size());
    SolutionStatus solutionStatus = basicLpSolver.getSolutionStatus();
    nodeLog.setCurrentLpStatus(solutionStatus);
    if (solutionStatus == SolutionStatus.OPTIMAL || solutionStatus == SolutionStatus.FEASIBLE) {
      nodeLog.setCurrentLp(Optional.of(basicLpSolver.getObjValue()));
    } else {
      nodeLog.setCurrentLp(Optional.<Double>absent());
    }
    nodeLog.setNewSolutionStatus(NewSolutionStatus.NONE);
    this.mipLog.setLastNodeLog(nodeLog);
    this.mipLog.onNewNode();
  }