MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / save_execution

Function save_execution

cp-profiler/src/cpprofiler/db_handler.cpp:373–411  ·  view source on GitHub ↗

this takes (without nogoods) under 2 sec for a ~1.5M nodes (golomb 10)

Source from the content-addressed store, hash-verified

371
372/// this takes (without nogoods) under 2 sec for a ~1.5M nodes (golomb 10)
373void save_execution(const Execution *ex, const char *path)
374{
375 print("creating file: {}", path);
376 std::ofstream file(path);
377 file.close();
378
379 QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
380 db.setDatabaseName(path);
381
382 if (!db.open()) {
383 print("Cannot open database file.");
384 return;
385 }
386
387 perfHelper.begin("save execution");
388
389 if(!create_db(&db)) {
390 print("Cannot create tables in database.");
391 return;
392 }
393
394 save_nodes(&db, ex);
395
396 save_user_data(&db, ex);
397
398 const auto &sd = ex->solver_data();
399
400 if (sd.hasNogoods())
401 {
402 save_nogoods(&db, ex);
403 }
404
405 if (sd.hasInfo())
406 {
407 save_info(&db, ex);
408 }
409
410 perfHelper.end();
411}
412
413std::shared_ptr<Execution> load_execution(const char *path, ExecID eid)
414{

Callers 3

onExecutionDoneMethod · 0.85
saveExecutionMethod · 0.85
save_and_loadFunction · 0.85

Calls 10

create_dbFunction · 0.85
save_nodesFunction · 0.85
save_user_dataFunction · 0.85
save_nogoodsFunction · 0.85
save_infoFunction · 0.85
hasInfoMethod · 0.80
printFunction · 0.50
beginMethod · 0.45
hasNogoodsMethod · 0.45
endMethod · 0.45

Tested by 1

save_and_loadFunction · 0.68