Пример #1
0
  /** Initialize and setup the post-optimizer */
  public void setupPostOp() {
    setPostOp(
        new SCGurobiSolver(
            getInstance(),
            getParams(),
            mTourPoolCB.getHasher(),
            !getALNSSol().getUnservedRequests().isEmpty()));

    getPostOp().addColumns(mTourPoolCB.getTourPool().getAllTours());

    mTourPoolSize = getTourPool().size();
    // Free some memory
    mTourPoolCB.getTourPool().clear();

    // Set initial solution
    getPostOp().setIncumbent(getALNSSol());

    if (getModelWriter() != null)
      try {
        getModelWriter()
            .write(
                getPostOp().getModel(),
                String.format("%s-%s", getInstance().getName(), getComment()));
      } catch (IOException e) {
        TRSPLogging.getOptimizationLogger()
            .exception(this.getClass().getSimpleName() + ".setupPostOp", e);
      }

    // Add stat writer
    if (getGRBStatCollector() != null) getGRBStatCollector().setModel(getPostOp().getModel());
  }
Пример #2
0
 /**
  * Returns the number of hash collisions detected, returns -1 if @link {@link
  * HashTourPool#sCountCollisions} is set to {@code false}
  *
  * @return the number of hash collisions detected
  */
 public int getHashPoolCollisionCount() {
   if (mTourPoolCB != null && HashTourPool.sCountCollisions)
     return ((HashTourPool) mTourPoolCB.getTourPool()).getCollisionsCount();
   else return -1;
 }
Пример #3
0
 /**
  * Returns the tour pool containing the tours collected during the ALNS
  *
  * @return the tour pool containing the tours collected during the ALNS
  */
 public ITRSPTourPool getTourPool() {
   return mTourPoolCB.getTourPool();
 }