this takes (without nogoods) under 2 sec for a ~1.5M nodes (golomb 10)
| 371 | |
| 372 | /// this takes (without nogoods) under 2 sec for a ~1.5M nodes (golomb 10) |
| 373 | void 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 | |
| 413 | std::shared_ptr<Execution> load_execution(const char *path, ExecID eid) |
| 414 | { |