Skip to content

Commit

Permalink
use gzip compression in WriteModelToMpsFile in Java/Python/.Net
Browse files Browse the repository at this point in the history
Defaults to false (no compression).
  • Loading branch information
omer-candan committed Nov 12, 2024
1 parent 98da690 commit 1ab2658
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions ortools/linear_solver/csharp/linear_solver.i
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ CONVERT_VECTOR(operations_research::MPVariable, MPVariable)
%unignore operations_research::MPSolver::ExportModelAsLpFormat(bool);
%unignore operations_research::MPSolver::ExportModelAsMpsFormat(bool, bool);
%unignore operations_research::MPSolver::WriteModelToMpsFile(
const std::string& filename, bool, bool);
const std::string& filename, bool, bool, bool);
%unignore operations_research::MPSolver::SetHint(
const std::vector<operations_research::MPVariable*>&,
const std::vector<double>&);
Expand All @@ -190,9 +190,10 @@ CONVERT_VECTOR(operations_research::MPVariable, MPVariable)
}

bool WriteModelToMpsFile(const std::string& filename, bool fixed_format,
bool obfuscated) {
bool obfuscated, bool use_gzip_compression = false) {
operations_research::MPModelExportOptions options;
options.obfuscate = obfuscated;
options.use_gzip_compression = use_gzip_compression;
operations_research::MPModelProto model;
$self->ExportModelToProto(&model);
return WriteModelToMpsFile(filename, model, options).ok();
Expand Down
3 changes: 2 additions & 1 deletion ortools/linear_solver/java/linear_solver.i
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,10 @@ PROTO2_RETURN(
* Write the loaded model to file in MPS format.
*/
bool writeModelToMpsFile(const std::string& filename, bool fixed_format,
bool obfuscate) {
bool obfuscate, bool use_gzip_compression=false) {
operations_research::MPModelExportOptions options;
options.obfuscate = obfuscate;
options.use_gzip_compression = use_gzip_compression;
operations_research::MPModelProto model;
$self->ExportModelToProto(&model);
return WriteModelToMpsFile(filename, model, options).ok();
Expand Down
3 changes: 2 additions & 1 deletion ortools/linear_solver/python/linear_solver.i
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ from ortools.linear_solver.python.linear_solver_natural_api import VariableExpr
}

bool WriteModelToMpsFile(const std::string& filename, bool fixed_format,
bool obfuscate) {
bool obfuscate, bool use_gzip_compression=false) {
operations_research::MPModelExportOptions options;
options.obfuscate = obfuscate;
options.use_gzip_compression = use_gzip_compression;
operations_research::MPModelProto model;
$self->ExportModelToProto(&model);
return WriteModelToMpsFile(filename, model, options).ok();
Expand Down

0 comments on commit 1ab2658

Please sign in to comment.