| 544 | } |
| 545 | |
| 546 | QJsonObject SolverConfiguration::toJSONObject(void) const |
| 547 | { |
| 548 | QJsonObject config; |
| 549 | config["solver"] = solver; |
| 550 | if (timeLimit > 0) { |
| 551 | config["time-limit"] = timeLimit; |
| 552 | } |
| 553 | if ((supports("-a") || supports("-i"))) { |
| 554 | config["intermediate-solutions"] = printIntermediate; |
| 555 | } |
| 556 | if (numSolutions > 1 && supports("-n")) { |
| 557 | config["num-solutions"] = numSolutions; |
| 558 | } |
| 559 | if (numSolutions == 0 && supports("-a")) { |
| 560 | config["all-satisfaction"] = true; |
| 561 | } |
| 562 | if (numOptimal > 1 && supports("-n-o")) { |
| 563 | config["num-optimal"] = numOptimal; |
| 564 | } |
| 565 | if (numOptimal == 0 && supports("-a-o")) { |
| 566 | config["all-optimal"] = true; |
| 567 | } |
| 568 | if (verboseCompilation) { |
| 569 | config["verbose-compilation"] = verboseCompilation; |
| 570 | } |
| 571 | if (verboseSolving && supports("-v")) { |
| 572 | config["verbose-solving"] = verboseSolving; |
| 573 | } |
| 574 | if (compilationStats) { |
| 575 | config["compiler-statistics"] = compilationStats; |
| 576 | } |
| 577 | if (solvingStats && supports("-s")) { |
| 578 | config["solver-statistics"] = solvingStats; |
| 579 | } |
| 580 | if (outputTiming) { |
| 581 | config["output-time"] = outputTiming; |
| 582 | } |
| 583 | if (outputObjective && (solverDefinition.inputType != Solver::I_MZN || supports("--output-objective"))) { |
| 584 | config["output-objective"] = true; |
| 585 | } |
| 586 | if (optimizationLevel != 1) { |
| 587 | config["-O"] = optimizationLevel; |
| 588 | } |
| 589 | QJsonArray arr; |
| 590 | for (auto& d : additionalData) { |
| 591 | arr.push_back(d); |
| 592 | } |
| 593 | if (arr.size() > 0) { |
| 594 | config["cmdline-data"] = arr; |
| 595 | } |
| 596 | if (numThreads > 1 && supports("-p")) { |
| 597 | config["parallel"] = numThreads; |
| 598 | } |
| 599 | if (!randomSeed.isNull() && supports("-r")) { |
| 600 | config["random-seed"] = QJsonValue::fromVariant(randomSeed); |
| 601 | } |
| 602 | if (freeSearch && supports("-f")) { |
| 603 | config["free-search"] = freeSearch; |