reindent
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
#if defined(USE_LP_PARSER)
|
||||
|
||||
#include "ortools/lp_data/lp_parser.h"
|
||||
|
||||
@@ -34,6 +33,8 @@
|
||||
#include "ortools/lp_data/proto_utils.h"
|
||||
#include "re2/re2.h"
|
||||
|
||||
#if defined(USE_LP_PARSER)
|
||||
|
||||
namespace operations_research {
|
||||
namespace glop {
|
||||
|
||||
@@ -462,4 +463,5 @@ absl::StatusOr<MPModelProto> ModelProtoFromLpFormat(absl::string_view model) {
|
||||
}
|
||||
|
||||
} // namespace operations_research
|
||||
#endif // #if defined(USE_LP_PARSER)
|
||||
|
||||
#endif // defined(USE_LP_PARSER)
|
||||
|
||||
@@ -123,6 +123,6 @@ absl::StatusOr<ParsedConstraint> ParseConstraint(absl::string_view constraint);
|
||||
} // namespace glop
|
||||
} // namespace operations_research
|
||||
|
||||
#endif // #if defined(USE_LP_PARSER)
|
||||
#endif // defined(USE_LP_PARSER)
|
||||
|
||||
#endif // OR_TOOLS_LP_DATA_LP_PARSER_H_
|
||||
|
||||
@@ -222,28 +222,27 @@ PYBIND11_MODULE(pywrap_model_builder_helper, m) {
|
||||
// The GIL is released during the solve to allow Python threads to do
|
||||
// other things in parallel, e.g., log and interrupt.
|
||||
pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def(
|
||||
"solve_serialized_request",
|
||||
[](ModelSolverHelper* solver, const std::string& request_str) {
|
||||
std::string result;
|
||||
{
|
||||
// The GIL is released during the solve to allow Python threads to
|
||||
// do other things in parallel, e.g., log and interrupt.
|
||||
pybind11::gil_scoped_release release;
|
||||
MPModelRequest request;
|
||||
.def("solve_serialized_request",
|
||||
[](ModelSolverHelper* solver, const std::string& request_str) {
|
||||
std::string result;
|
||||
{
|
||||
// The GIL is released during the solve to allow Python threads
|
||||
// to do other things in parallel, e.g., log and interrupt.
|
||||
pybind11::gil_scoped_release release;
|
||||
MPModelRequest request;
|
||||
|
||||
if (!request.ParseFromString(request_str)) {
|
||||
throw std::invalid_argument(
|
||||
"Unable to parse request as MPModelRequest.");
|
||||
}
|
||||
std::optional<MPSolutionResponse> solution =
|
||||
solver->SolveRequest(request);
|
||||
if (solution.has_value()) {
|
||||
result = solution.value().SerializeAsString();
|
||||
}
|
||||
}
|
||||
return pybind11::bytes(result);
|
||||
})
|
||||
if (!request.ParseFromString(request_str)) {
|
||||
throw std::invalid_argument(
|
||||
"Unable to parse request as MPModelRequest.");
|
||||
}
|
||||
std::optional<MPSolutionResponse> solution =
|
||||
solver->SolveRequest(request);
|
||||
if (solution.has_value()) {
|
||||
result = solution.value().SerializeAsString();
|
||||
}
|
||||
}
|
||||
return pybind11::bytes(result);
|
||||
})
|
||||
.def("interrupt_solve", &ModelSolverHelper::InterruptSolve,
|
||||
"Returns true if the interrupt signal was correctly sent, that is, "
|
||||
"if the underlying solver supports it.")
|
||||
|
||||
Reference in New Issue
Block a user