forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
issue173.cc
32 lines (26 loc) · 864 Bytes
/
issue173.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "ortools/base/commandlineflags.h"
#include "ortools/base/logging.h"
#include "ortools/linear_solver/linear_solver.h"
namespace operations_research {
void SolveLP() {
MPSolver solver("test", MPSolver::CBC_MIXED_INTEGER_PROGRAMMING);
const double kInfinity = solver.infinity();
MPVariable* const x = solver.MakeNumVar(-kInfinity, kInfinity, "x");
MPObjective* const objective = solver.MutableObjective();
objective->SetMaximization();
objective->SetCoefficient(x, 1);
MPConstraint* const constraint = solver.MakeRowConstraint(0, 5);
constraint->SetCoefficient(x, 1);
solver.Solve();
}
void BreakLoop() {
for (int i = 0; i < 500; i++) {
SolveLP();
}
}
} // namespace operations_research
int main(int argc, char** argv) {
gflags::ParseCommandLineFlags( &argc, &argv, true);
operations_research::BreakLoop();
return 0;
}