Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: sat_proto_solver
Note: This documentation is automatically generated.
Solve the input MIP model with the SAT solver.
If possible, std::move the request into this function call to avoid a copy.
If you need to change the solver parameters, please use the EncodeSatParametersAsString() function below to set the request's solver_specific_parameters field.
The optional interrupt_solve can be used to interrupt the solve early. It must only be set to true, never reset to false. It is also used internally by the solver that will set it to true for its own internal logic. As a consequence the caller should ignore the stored value and should not use the same atomic for different concurrent calls.
The optional logging_callback will be called when the SAT parameter log_search_progress is set to true. Passing a callback will disable the default logging to INFO. Note though that by default the SAT parameter log_to_stdout is true so even with a callback, the logs will appear on stdout too unless log_to_stdout is set to false. The enable_internal_solver_output in the request will act as the SAT parameter log_search_progress.
The optional solution_callback will be called on each intermediate solution found by the solver. The solver may call solution_callback from multiple threads, but it will ensure that at most one thread executes solution_callback at a time.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["\u003cp\u003eThe primary function, \u003ccode\u003eSatSolveProto\u003c/code\u003e, is used to solve Mixed Integer Programming (MIP) models using the SAT solver within OR-Tools.\u003c/p\u003e\n"],["\u003cp\u003eUsers can customize solver behavior by encoding parameters as a string using \u003ccode\u003eEncodeSatParametersAsString\u003c/code\u003e and setting the \u003ccode\u003esolver_specific_parameters\u003c/code\u003e field in the request.\u003c/p\u003e\n"],["\u003cp\u003eOptional features include early solve interruption using \u003ccode\u003einterrupt_solve\u003c/code\u003e, custom logging through \u003ccode\u003elogging_callback\u003c/code\u003e, and processing intermediate solutions via \u003ccode\u003esolution_callback\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eSatSolveProto\u003c/code\u003e function accepts an \u003ccode\u003eMPModelRequest\u003c/code\u003e and returns an \u003ccode\u003eabsl::StatusOr<MPSolutionResponse>\u003c/code\u003e, indicating either the solution or an error status.\u003c/p\u003e\n"],["\u003cp\u003eTo avoid unnecessary copying, consider using \u003ccode\u003estd::move\u003c/code\u003e when passing the request to the \u003ccode\u003eSatSolveProto\u003c/code\u003e function.\u003c/p\u003e\n"]]],["The `SatSolveProto` function solves a MIP model using a SAT solver, optionally moving the request to avoid copying. Solver parameters are set via `EncodeSatParametersAsString`. An `interrupt_solve` flag can prematurely halt solving; its value should only be set to true. A `logging_callback` function allows custom logging, while `solution_callback` processes intermediate solutions, ensuring single-threaded execution at a time. The enable_internal_solver_output acts as SAT parameter `log_search_progress`.\n"],null,["# sat_proto_solver\n\nC++ Reference: sat_proto_solver\n===============================\n\n\nNote: This documentation is automatically generated.\n\n\u003cbr /\u003e\n\nSolve the input MIP model with the SAT solver. \n\nIf possible, std::move the request into this function call to avoid a copy. \n\nIf you need to change the solver parameters, please use the EncodeSatParametersAsString() function below to set the request's solver_specific_parameters field. \n\nThe optional interrupt_solve can be used to interrupt the solve early. It must only be set to true, never reset to false. It is also used internally by the solver that will set it to true for its own internal logic. As a consequence the caller should ignore the stored value and should not use the same atomic for different concurrent calls. \n\nThe optional logging_callback will be called when the SAT parameter log_search_progress is set to true. Passing a callback will disable the default logging to INFO. Note though that by default the SAT parameter log_to_stdout is true so even with a callback, the logs will appear on stdout too unless log_to_stdout is set to false. The enable_internal_solver_output in the request will act as the SAT parameter log_search_progress. \n\nThe optional solution_callback will be called on each intermediate solution found by the solver. The solver may call solution_callback from multiple threads, but it will ensure that at most one thread executes solution_callback at a time.\n\n| Function | Type | Arguments | Comments |\n|----------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------|----------|\n| [`EncodeSatParametersAsString`](https://github.com/google/or-tools/blob/v9.4/ortools/linear_solver/sat_proto_solver.h#L71) | Return type: `std::string ` Arguments: `const sat::SatParameters& parameters` \u003cbr /\u003e |\n| [`SatSolveProto`](https://github.com/google/or-tools/blob/v9.4/ortools/linear_solver/sat_proto_solver.h#L52) | Return type: `absl::StatusOr\u003cMPSolutionResponse\u003e ` Arguments: ` MPModelRequest request, std::atomic\u003cbool\u003e* interrupt_solve = nullptr, std::function\u003cvoid(const std::string&)\u003e logging_callback = nullptr, std::function\u003cvoid(const MPSolution&)\u003e solution_callback = nullptr` \u003cbr /\u003e |"]]