예제 #1
0
파일: Allocator.java 프로젝트: ikfj/wmart
 /**
  * Given a market instance and a MaceDataModel this method computes an allocation (i.e., it solves
  * the winner determination problem)
  *
  * @param market Market instance
  * @param dataModel A vector of MaceDataModels
  * @throws SolverException
  * @throws FactoryException
  */
 public static void computeAllocation(Market market, Vector<MaceDataModel> dataModel)
     throws SolverException, FactoryException, MaceException {
   // Get the winner determination model
   AbstractWinnerDetermination solver =
       (AbstractWinnerDetermination)
           market.getWinnerDeterminationFactory().createAbstractProduct();
   // Generate a new outcome object
   Outcome outcome = market.getOutcome();
   outcome.setCurrentSolver(solver);
   solver.setOutcome(outcome);
   // Solve
   solver.solve(market, dataModel);
 }
예제 #2
0
파일: Allocator.java 프로젝트: ikfj/wmart
  public static void main(String args[]) {
    System.out.println("started Allocator");

    Market market = null;
    try {
      market = new Market();
    } catch (MaceException e1) {
      e1.printStackTrace();
    }
    try {
      Allocator.computeAllocation(market, market.getOrderBookManagement().getDataModels());
    } catch (SolverException e) {
      e.printStackTrace();
    } catch (FactoryException e) {
      e.printStackTrace();
    } catch (MaceException e) {
      e.printStackTrace();
    }

    System.out.println("finished Allocator");
  }