Sync g3 -> gh part_2

This commit is contained in:
Corentin Le Molgat
2020-03-09 17:52:25 +01:00
parent b587d27a4a
commit 22356ff523
230 changed files with 2828 additions and 778 deletions

View File

@@ -19,6 +19,6 @@
<ItemGroup>
<Compile Include="LinearProgrammingExample.cs" />
<PackageReference Include="Google.OrTools" Version="7.5.*" />
<PackageReference Include="Google.OrTools" Version="7.6.*" />
</ItemGroup>
</Project>

View File

@@ -52,7 +52,7 @@ public class MipVarArray
MPVariable[] x = new MPVariable[data.NumVars];
for (int j = 0; j < data.NumVars; j++)
{
x[j] = MakeIntVar(0.0, double.PositiveInfinity, "x");
x[j] = MakeIntVar(0.0, double.PositiveInfinity, String.Format("x_{0}", j));
}
Console.WriteLine("Number of variables = " + solver.NumVariables());
// [END variables]

View File

@@ -19,6 +19,6 @@
<ItemGroup>
<Compile Include="MipVarArray.cs" />
<PackageReference Include="Google.OrTools" Version="7.5.*" />
<PackageReference Include="Google.OrTools" Version="7.6.*" />
</ItemGroup>
</Project>

View File

@@ -19,6 +19,6 @@
<ItemGroup>
<Compile Include="SimpleLpProgram.cs" />
<PackageReference Include="Google.OrTools" Version="7.5.*" />
<PackageReference Include="Google.OrTools" Version="7.6.*" />
</ItemGroup>
</Project>

View File

@@ -19,6 +19,6 @@
<ItemGroup>
<Compile Include="SimpleMipProgram.cs" />
<PackageReference Include="Google.OrTools" Version="7.5.*" />
<PackageReference Include="Google.OrTools" Version="7.6.*" />
</ItemGroup>
</Project>

View File

@@ -16,6 +16,7 @@
#include "ortools/linear_solver/linear_solver.h"
// [END import]
// [START program_part1]
namespace operations_research {
// [START data_model]
struct DataModel {
@@ -36,6 +37,7 @@ void IntegerProgrammingExample() {
// [START data]
DataModel data;
// [END data]
// [END program_part1]
// [START solver]
// Create the mip solver with the CBC backend.
@@ -43,6 +45,7 @@ void IntegerProgrammingExample() {
MPSolver::CBC_MIXED_INTEGER_PROGRAMMING);
// [END solver]
// [START program_part2]
// [START variables]
const double infinity = solver.infinity();
// x[j] is an array of non-negative, integer variables.
@@ -96,3 +99,5 @@ int main(int argc, char** argv) {
operations_research::IntegerProgrammingExample();
return EXIT_SUCCESS;
}
// [END program_part2]
// [END program]

View File

@@ -19,6 +19,7 @@ from ortools.linear_solver import pywraplp
# [END import]
# [START program_part1]
# [START data_model]
def create_data_model():
"""Stores the data for the problem."""
@@ -43,13 +44,14 @@ def main():
# [START data]
data = create_data_model()
# [END data]
# [END program_part1]
# [START solver]
# Create the mip solver with the CBC backend.
solver = pywraplp.Solver('simple_mip_program',
pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)
# [END solver]
# [START program_part2]
# [START variables]
infinity = solver.infinity()
x = {}
@@ -101,4 +103,5 @@ def main():
if __name__ == '__main__':
main()
# [END program_part2]
# [END program]