Skip to content

Instantly share code, notes, and snippets.

@gidden
Created November 21, 2013 19:48
Show Gist options
  • Save gidden/7588333 to your computer and use it in GitHub Desktop.
Save gidden/7588333 to your computer and use it in GitHub Desktop.
/// @brief execute the full resource sequence
void Execute() {
// collect resource exchange information
ResourceExchange<T> exchng(ctx_);
exchng.AddAllRequests();
exchng.AddAllBids();
exchng.DoAllAdjustments();
// translate graph
ExchangeTranslator<T> xlator(&exchng.ex_ctx());
ExchangeGraph::Ptr graph = xlator.Translate();
// solve graph
solver_->set_graph(graph.get());
solver_->Solve();
// get trades
std::vector< Trade<T> > trades;
xlator.BackTranslateSolution(graph->matches, trades);
std::for_each(trades.begin(), trades.end(), ExecuteTrade<T>);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment