direct gurobi proto solve; support SOS in gurobi proto solve

This commit is contained in:
Laurent Perron
2019-07-22 11:10:30 -07:00
parent 04e1c9ecc0
commit 738d23fe4a
6 changed files with 151 additions and 29 deletions

View File

@@ -75,6 +75,10 @@
* * \code LinearExpr e1 = LinearExpr(x) + (y + 5); \endcode
* * \code LinearExpr e1 = y + 5 + LinearExpr(x); \endcode
*/
#include <ostream>
#include <string>
#include "absl/container/flat_hash_map.h"
namespace operations_research {
@@ -147,11 +151,19 @@ class LinearExpr {
*/
double SolutionValue() const;
/**
* A human readable representation of this. Variables will be printed in order
* of lowest index first.
*/
std::string ToString() const;
private:
double offset_;
absl::flat_hash_map<const MPVariable*, double> terms_;
};
std::ostream& operator<<(std::ostream& stream, const LinearExpr& linear_expr);
// NOTE(user): in the ops below, the non-"const LinearExpr&" are intentional.
// We need to create a new LinearExpr for the result, so we lose nothing by
// passing one argument by value, mutating it, and then returning it. In