14 #ifndef OR_TOOLS_LINEAR_SOLVER_WRAPPERS_MODEL_BUILDER_HELPER_H_
15 #define OR_TOOLS_LINEAR_SOLVER_WRAPPERS_MODEL_BUILDER_HELPER_H_
24 #include "ortools/linear_solver/linear_solver.pb.h"
56 #if defined(USE_LP_PARSER)
57 bool ImportFromLpString(
const std::string& lp_string);
58 bool ImportFromLpFile(
const std::string& lp_file);
61 const MPModelProto&
model()
const;
83 std::string
VarName(
int var_index)
const;
92 std::string
name()
const;
142 std::optional<MPSolutionResponse>
SolveRequest(
const MPModelRequest& request);
148 void SetLogCallback(std::function<
void(
const std::string&)> log_callback);
154 const MPSolutionResponse&
response()
const;
172 const std::string& solver_specific_parameters);
178 std::atomic<bool> interrupt_solve_ =
false;
179 std::function<void(
const std::string&)> log_callback_;
180 std::optional<MPSolutionResponse> response_;
181 std::optional<MPModelRequest::SolverType> solver_type_;
182 std::optional<double> time_limit_in_second_;
183 std::string solver_specific_parameters_;
184 std::optional<const MPModelProto*> model_of_last_solve_;
185 std::vector<double> activities_;
186 bool solver_output_ =
false;
virtual void NewMessage(const std::string &message)=0
void SetMaximize(bool maximize)
bool WriteModelToFile(const std::string &filename)
double VarLowerBound(int var_index) const
void SetObjectiveOffset(double offset)
bool VarIsIntegral(int var_index) const
void SetVarUpperBound(int var_index, double ub)
int num_constraints() const
void SetConstraintUpperBound(int ct_index, double ub)
double VarObjectiveCoefficient(int var_index) const
void SetVarObjectiveCoefficient(int var_index, double coeff)
void AddConstraintTerm(int ct_index, int var_index, double coeff)
double ConstraintUpperBound(int ct_index) const
std::string VarName(int var_index) const
std::string ExportToMpsString(const operations_research::MPModelExportOptions &options=MPModelExportOptions())
std::string ConstraintName(int ct_index) const
void SetVarName(int var_index, const std::string &name)
double ObjectiveOffset() const
int num_variables() const
void SetConstraintName(int ct_index, const std::string &name)
std::vector< double > ConstraintCoefficients(int ct_index) const
const MPModelProto & model() const
void SetName(const std::string &name)
int AddLinearConstraint()
MPModelProto * mutable_model()
double VarUpperBound(int var_index) const
bool ImportFromMpsFile(const std::string &mps_file)
std::vector< int > ConstraintVarIndices(int ct_index) const
double ConstraintLowerBound(int ct_index) const
std::string ExportToLpString(const operations_research::MPModelExportOptions &options=MPModelExportOptions())
void SetConstraintLowerBound(int ct_index, double lb)
void SetVarLowerBound(int var_index, double lb)
void SetVarIntegrality(int var_index, bool is_integer)
bool ImportFromMpsString(const std::string &mps_string)
void SetTimeLimitInSeconds(double limit)
double best_objective_bound() const
double reduced_cost(int var_index) const
void EnableOutput(bool enabled)
double activity(int ct_index)
double variable_value(int var_index) const
void SetSolverSpecificParameters(const std::string &solver_specific_parameters)
bool has_response() const
double dual_value(int ct_index) const
bool has_solution() const
double objective_value() const
void SetLogCallbackFromDirectorClass(LogCallback *log_callback)
std::string status_string() const
void SetLogCallback(std::function< void(const std::string &)> log_callback)
bool SolverIsSupported() const
void Solve(const ModelBuilderHelper &model)
const MPSolutionResponse & response() const
std::optional< MPSolutionResponse > SolveRequest(const MPModelRequest &request)
ModelSolverHelper(const std::string &solver_name)
SolveStatus status() const
Collection of objects used to extend the Constraint Solver library.
@ SOLVER_TYPE_UNAVAILABLE
@ INVALID_SOLVER_PARAMETERS