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"
62#if defined(USE_LP_PARSER)
63 bool ImportFromLpString(
const std::string& lp_string);
64 bool ImportFromLpFile(
const std::string& lp_file);
67 const MPModelProto&
model()
const;
121 std::string
name()
const;
173 std::optional<MPSolutionResponse>
SolveRequest(
const MPModelRequest& request);
179 void SetLogCallback(std::function<
void(
const std::string&)> log_callback);
185 const MPSolutionResponse&
response()
const;
203 const std::string& solver_specific_parameters);
210 std::atomic<bool> interrupt_solve_ =
false;
211 std::function<void(
const std::string&)> log_callback_;
212 std::optional<MPSolutionResponse> response_;
213 std::optional<MPModelRequest::SolverType> solver_type_;
214 std::optional<double> time_limit_in_second_;
215 std::string solver_specific_parameters_;
216 std::optional<const MPModelProto*> model_of_last_solve_;
217 std::vector<double> activities_;
218 bool solver_output_ =
false;
Simple director class for C#.
virtual void NewMessage(const std::string &message)=0
void SetEnforcedConstraintLowerBound(int ct_index, double lb)
std::string ExportToLpString(const operations_research::MPModelExportOptions &options=MPModelExportOptions())
double ConstraintUpperBound(int ct_index) const
bool ReadModelFromProtoFile(const std::string &filename)
int AddEnforcedLinearConstraint()
int AddLinearConstraint()
const MPModelProto & model() const
void SetConstraintCoefficient(int ct_index, int var_index, double coeff)
void SafeAddEnforcedConstraintTerm(int ct_index, int var_index, double coeff)
double ConstraintLowerBound(int ct_index) const
bool EnforcedIndicatorValue(int ct_index) const
void SetMaximize(bool maximize)
void SetConstraintUpperBound(int ct_index, double ub)
void SetName(const std::string &name)
int num_constraints() const
void SetConstraintName(int ct_index, const std::string &name)
void SafeAddConstraintTerm(int ct_index, int var_index, double coeff)
void AddHint(int var_index, double var_value)
std::string VarName(int var_index) const
void SetVarObjectiveCoefficient(int var_index, double coeff)
void SetVarName(int var_index, const std::string &name)
int AddVar()
Direct low level model building API.
bool ImportFromMpsFile(const std::string &mps_file)
void ClearEnforcedConstraintTerms(int ct_index)
void SetEnforcedConstraintUpperBound(int ct_index, double ub)
void SetEnforcedConstraintName(int ct_index, const std::string &name)
double VarUpperBound(int var_index) const
double VarObjectiveCoefficient(int var_index) const
void SetObjectiveOffset(double offset)
bool VarIsIntegral(int var_index) const
double EnforcedConstraintLowerBound(int ct_index) const
void AddConstraintTerm(int ct_index, int var_index, double coeff)
void SetEnforcedIndicatorVariableIndex(int ct_index, int var_index)
std::vector< double > ConstraintCoefficients(int ct_index) const
void ClearConstraintTerms(int ct_index)
void SetConstraintLowerBound(int ct_index, double lb)
void SetEnforcedConstraintCoefficient(int ct_index, int var_index, double coeff)
bool ImportFromMpsString(const std::string &mps_string)
void AddEnforcedConstraintTerm(int ct_index, int var_index, double coeff)
bool WriteToMpsFile(const std::string &filename, const operations_research::MPModelExportOptions &options=MPModelExportOptions())
double VarLowerBound(int var_index) const
std::string ConstraintName(int ct_index) const
std::vector< double > EnforcedConstraintCoefficients(int ct_index) const
void SetEnforcedIndicatorValue(int ct_index, bool positive)
void SetVarIntegrality(int var_index, bool is_integer)
int num_variables() const
std::string EnforcedConstraintName(int ct_index) const
bool IsEnforcedConstraint(int ct_index) const
std::vector< int > EnforcedConstraintVarIndices(int ct_index) const
int EnforcedIndicatorVariableIndex(int ct_index) const
void SetVarUpperBound(int var_index, double ub)
std::string ExportToMpsString(const operations_research::MPModelExportOptions &options=MPModelExportOptions())
double EnforcedConstraintUpperBound(int ct_index) const
MPModelProto * mutable_model()
void SetVarLowerBound(int var_index, double lb)
bool WriteModelToProtoFile(const std::string &filename)
std::vector< int > ConstraintVarIndices(int ct_index) const
void OverwriteModel(const ModelBuilderHelper &other_helper)
double ObjectiveOffset() const
void Solve(const ModelBuilderHelper &model)
bool SolverIsSupported() const
bool has_solution() const
SolveStatus status() const
void SetSolverSpecificParameters(const std::string &solver_specific_parameters)
double objective_value() const
If not defined, or no solution, they will silently return 0.
bool has_response() const
std::optional< MPSolutionResponse > SolveRequest(const MPModelRequest &request)
Only used by the CVXPY interface. Does not store the response internally.
void SetLogCallback(std::function< void(const std::string &)> log_callback)
double dual_value(int ct_index) const
std::string status_string() const
double variable_value(int var_index) const
const MPSolutionResponse & response() const
double best_objective_bound() const
void SetLogCallbackFromDirectorClass(MbLogCallback *log_callback)
double activity(int ct_index)
void EnableOutput(bool enabled)
double reduced_cost(int var_index) const
ModelSolverHelper(const std::string &solver_name)
void SetTimeLimitInSeconds(double limit)
Solve parameters.
In SWIG mode, we don't want anything besides these top-level includes.
@ SOLVER_TYPE_UNAVAILABLE
@ INVALID_SOLVER_PARAMETERS