Skip to content

Commit

Permalink
test with no random
Browse files Browse the repository at this point in the history
  • Loading branch information
zlukich committed Mar 27, 2024
1 parent d8ce677 commit 46cdd0b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 10 deletions.
50 changes: 40 additions & 10 deletions src/test/java/org/matsim/run/RunIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.matsim.api.core.v01.population.Population;
import org.matsim.application.MATSimApplication;
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.controler.OutputDirectoryHierarchy;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.population.PopulationUtils;
import org.matsim.simwrapper.SimWrapperConfigGroup;
import org.matsim.testcases.MatsimTestUtils;
import org.matsim.utils.eventsfilecomparison.ComparisonResult;
import org.matsim.utils.eventsfilecomparison.EventsFileFingerprintComparator;

import java.beans.EventHandler;
import java.io.File;

import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -24,30 +29,55 @@ public class RunIntegrationTest {
public void runScenario() {

String output = utils.getOutputDirectory();

//
Config config = ConfigUtils.loadConfig("input/v1.0/test_lausitz-v1.0-25pct.config.xml");

config.global().setNumberOfThreads(1);
config.qsim().setNumberOfThreads(1);
config.global().setNumberOfThreads(2);
config.qsim().setNumberOfThreads(2);
config.controller().setLastIteration(1);
config.routing().setRoutingRandomness(0);
config.controller().setOverwriteFileSetting(OutputDirectoryHierarchy.OverwriteFileSetting.deleteDirectoryIfExists);
config.controller().setOutputDirectory(output);

ConfigUtils.addOrGetModule(config, SimWrapperConfigGroup.class).defaultDashboards = SimWrapperConfigGroup.Mode.disabled;


//
//
MATSimApplication.execute(LausitzScenario.class, config, "run", "--1pct"
);
////////
//////
////
// EventsUtils.createEventsFingerprint(utils.getOutputDirectory()+"lausitz-1pct.output_events.xml.gz",
// utils.getInputDirectory()+"astarlandmark_lausitz.fp.zst");
// EventsUtils.createEventsFingerprint(output+"lausitz-1pct.output_events.xml.gz",
// utils.getInputDirectory()+"speedy_lausitz.fp.zst");


EventsUtils.assertEqualEventsFingerprint(
new File("test/output/org/matsim/run/RunIntegrationTest/runScenario/", "lausitz-1pct.output_events.xml.gz"),
new File(utils.getInputDirectory(), "astarlandmark_lausitz.fp.zst").toString()
new File(output, "lausitz-1pct.output_events.xml.gz"),
new File( utils.getInputDirectory(),"speedy_lausitz.fp.zst").toString()
);

// EventsManager manager = EventsUtils.createEventsManager();
// RandomnessEventHandler testEvents = new RandomnessEventHandler();
// manager.addHandler(testEvents);
//
// EventsUtils.readEvents(manager,new File("./output_dijkstra_thread1/", "lausitz-1pct.output_events.xml.gz").toString());
//
// manager.finishProcessing();
//
// testEvents.writePath("./output_dijkstra_thread1/"+"freight_7532_path.txt");
//
// Population pop1 = PopulationUtils.readPopulation("./output_speedy_thread1_norandom/"+"lausitz-1pct.output_plans.xml.gz");
// Population pop2 = PopulationUtils.readPopulation("./output_speedy_thread2_norandom/"+"lausitz-1pct.output_plans.xml.gz");
// boolean result = PopulationUtils.comparePopulations(pop1,pop2);
//
// System.out.println(result);

// var Result = EventsFileFingerprintComparator.createFingerprintHandler(
// new File("./output_speedy_thread1_norandom/", "lausitz-1pct.output_events.xml.gz").toString(),
// new File("./output_speedy_thread4_norandom/", "speedy_lausitz.fp.zst").toString());
//
// System.out.println(Result.getComparisonMessage());
//
// System.out.println(Result.getComparisonResult());

}
}
Binary file not shown.

0 comments on commit 46cdd0b

Please sign in to comment.