update xpress interface with dynamic load

This commit is contained in:
Andrea Sgattoni
2023-10-17 10:09:20 +02:00
parent b190d1d799
commit 3c4a76e68f
16 changed files with 2463 additions and 214 deletions

View File

@@ -47,6 +47,9 @@ class MPSolutionResponse;
class IISResponse;
} // namespace operations_research
// cross-language polymorphism should be enabled to support MPCallback feature
%module(directors="1") operations_research;
%{
#include "ortools/linear_solver/linear_solver.h"
#include "ortools/linear_solver/model_exporter.h"
@@ -275,6 +278,12 @@ PY_CONVERT(MPConstraint);
PY_CONVERT_HELPER_PTR(MPVariable);
PY_CONVERT(MPVariable);
PY_CONVERT_HELPER_PTR(MPCallback);
PY_CONVERT(MPCallback);
PY_CONVERT_HELPER_PTR(MPCallbackContext);
PY_CONVERT(MPCallbackContext);
%ignoreall
%unignore operations_research;
@@ -366,6 +375,7 @@ PY_CONVERT(MPVariable);
%unignore operations_research::MPSolver::NextSolution;
// ExportModelAsLpFormat() is also visible: it's overridden by an %extend, above.
// ExportModelAsMpsFormat() is also visible: it's overridden by an %extend, above.
%unignore operations_research::MPSolver::Write;
// Expose very advanced parts of the MPSolver API. For expert users only.
%unignore operations_research::MPSolver::ComputeConstraintActivities;
@@ -493,6 +503,39 @@ PY_CONVERT(MPVariable);
// Expose the model validator.
%rename (FindErrorInModelProto) operations_research::FindErrorInMPModelProto;
// Expose the MPCallback & MPCallbackContext APIs
// Enable cross-language polymorphism for MPCallback virtual class
%feature("director") operations_research::MPCallback;
%unignore operations_research::MPCallback;
%unignore operations_research::MPCallbackContext;
%unignore operations_research::MPCallback::MPCallback;
%unignore operations_research::MPCallback::~MPCallback;
%unignore operations_research::MPCallback::RunCallback;
%unignore operations_research::MPCallback::might_add_cuts;
%unignore operations_research::MPCallback::might_add_lazy_constraints;
%unignore operations_research::MPCallbackContext::MPCallbackContext;
%unignore operations_research::MPCallbackContext::~MPCallbackContext;
%unignore operations_research::MPCallbackEvent;
%rename (UNKNOWN) operations_research::MPCallbackEvent::kUnknown;
%rename (POLLING) operations_research::MPCallbackEvent::kPolling;
%rename (PRESOLVE) operations_research::MPCallbackEvent::kPresolve;
%rename (SIMPLEX) operations_research::MPCallbackEvent::kSimplex;
%rename (MIP) operations_research::MPCallbackEvent::kMip;
%rename (MIP_SOLUTION) operations_research::MPCallbackEvent::kMipSolution;
%rename (MIP_NODE) operations_research::MPCallbackEvent::kMipNode;
%rename (BARRIER) operations_research::MPCallbackEvent::kBarrier;
%rename (MESSAGE) operations_research::MPCallbackEvent::kMessage;
%rename (MULTI_OBJ) operations_research::MPCallbackContext::MPCallbackEvent::kMultiObj;
%unignore operations_research::MPCallbackContext::Event;
%unignore operations_research::MPCallbackContext::CanQueryVariableValues;
%unignore operations_research::MPCallbackContext::VariableValue;
%unignore operations_research::MPCallbackContext::AddCut;
%unignore operations_research::MPCallbackContext::AddLazyConstraint;
%unignore operations_research::MPCallbackContext::SuggestSolution;
%unignore operations_research::MPCallbackContext::NumExploredNodes;
%unignore operations_research::MPSolver::SetCallback;
%include "ortools/linear_solver/linear_solver_callback.h"
%include "ortools/linear_solver/linear_solver.h"
%include "ortools/linear_solver/model_exporter.h"
%include "ortools/linear_solver/model_exporter_swig_helper.h"