Beispiel #1
0
void Simulation::run(){
     // initialize an iterator
    int counter = 0;
    // create a new business cycle pointer
    BusinessCycle* cycler = new BusinessCycle(allFirms, workForce, unemployedpeeps);
    cycler->setConfigurator(config);
    std::cout << "Cycler Created" << std::endl;
    // run the first cycle
    
    Snapshot cyclesnap = cycler->firstcycle();
    std::cout << "Starting Cycles" << std::endl;
    // while we have not run all the cycles
    while(counter < numcycles)
    {
           cycler->cycle();
           std::cout << std::endl << "Cycle: " << counter + 1 << std::endl;
           // cycle out
           cyclesnap = cycler->cycleout();
           std::cout << "cycleout ok" << std::endl;
           // cycle in
           cycler->cyclein(cyclesnap);
           std::cout << "cyclein ok" << std::endl;
           // output to screen
           cyclesnap.print_toscreen();
           cyclesnap.print_toCSV(counter,config->get_csv_path());
           cyclesnap.appendToGraph(counter);
           std::cout << std::endl << "Cycle " << counter + 1 << " completed." << std::endl << std::endl;
           counter++;
    }
    cyclesnap.print_toGraphML(config->get_graphml_path());
}