Skip to content
GitLab
Explore
Sign in
Show whitespace changes
Inline
Side-by-side
Some changes are not shown.
For a faster browsing experience, only
20 of 534+
files are shown.
libs/or-tools-src-ubuntu/examples/dotnet/traffic_lights.csproj
View file @
a9bd42a2
...
...
@@ -19,6 +19,6 @@
<ItemGroup>
<Compile Include="traffic_lights.cs" />
<PackageReference Include="Google.OrTools" Version="7.
7
.*" />
<PackageReference Include="Google.OrTools" Version="7.
8
.*" />
</ItemGroup>
</Project>
libs/or-tools-src-ubuntu/examples/dotnet/volsay.csproj
View file @
a9bd42a2
...
...
@@ -19,6 +19,6 @@
<ItemGroup>
<Compile Include="volsay.cs" />
<PackageReference Include="Google.OrTools" Version="7.
7
.*" />
<PackageReference Include="Google.OrTools" Version="7.
8
.*" />
</ItemGroup>
</Project>
libs/or-tools-src-ubuntu/examples/dotnet/volsay2.csproj
View file @
a9bd42a2
...
...
@@ -19,6 +19,6 @@
<ItemGroup>
<Compile Include="volsay2.cs" />
<PackageReference Include="Google.OrTools" Version="7.
7
.*" />
<PackageReference Include="Google.OrTools" Version="7.
8
.*" />
</ItemGroup>
</Project>
libs/or-tools-src-ubuntu/examples/dotnet/volsay3.csproj
View file @
a9bd42a2
...
...
@@ -19,6 +19,6 @@
<ItemGroup>
<Compile Include="volsay3.cs" />
<PackageReference Include="Google.OrTools" Version="7.
7
.*" />
<PackageReference Include="Google.OrTools" Version="7.
8
.*" />
</ItemGroup>
</Project>
libs/or-tools-src-ubuntu/examples/dotnet/wedding_optimal_chart.csproj
View file @
a9bd42a2
...
...
@@ -19,6 +19,6 @@
<ItemGroup>
<Compile Include="wedding_optimal_chart.cs" />
<PackageReference Include="Google.OrTools" Version="7.
7
.*" />
<PackageReference Include="Google.OrTools" Version="7.
8
.*" />
</ItemGroup>
</Project>
libs/or-tools-src-ubuntu/examples/dotnet/who_killed_agatha.csproj
View file @
a9bd42a2
...
...
@@ -19,6 +19,6 @@
<ItemGroup>
<Compile Include="who_killed_agatha.cs" />
<PackageReference Include="Google.OrTools" Version="7.
7
.*" />
<PackageReference Include="Google.OrTools" Version="7.
8
.*" />
</ItemGroup>
</Project>
libs/or-tools-src-ubuntu/examples/dotnet/word_square.csproj
View file @
a9bd42a2
...
...
@@ -19,6 +19,6 @@
<ItemGroup>
<Compile Include="word_square.cs" />
<PackageReference Include="Google.OrTools" Version="7.
7
.*" />
<PackageReference Include="Google.OrTools" Version="7.
8
.*" />
</ItemGroup>
</Project>
libs/or-tools-src-ubuntu/examples/dotnet/xkcd.csproj
View file @
a9bd42a2
...
...
@@ -19,6 +19,6 @@
<ItemGroup>
<Compile Include="xkcd.cs" />
<PackageReference Include="Google.OrTools" Version="7.
7
.*" />
<PackageReference Include="Google.OrTools" Version="7.
8
.*" />
</ItemGroup>
</Project>
libs/or-tools-src-ubuntu/examples/dotnet/young_tableaux.csproj
View file @
a9bd42a2
...
...
@@ -19,6 +19,6 @@
<ItemGroup>
<Compile Include="young_tableaux.cs" />
<PackageReference Include="Google.OrTools" Version="7.
7
.*" />
<PackageReference Include="Google.OrTools" Version="7.
8
.*" />
</ItemGroup>
</Project>
libs/or-tools-src-ubuntu/examples/dotnet/zebra.csproj
View file @
a9bd42a2
...
...
@@ -19,6 +19,6 @@
<ItemGroup>
<Compile Include="zebra.cs" />
<PackageReference Include="Google.OrTools" Version="7.
7
.*" />
<PackageReference Include="Google.OrTools" Version="7.
8
.*" />
</ItemGroup>
</Project>
libs/or-tools-src-ubuntu/examples/java/AssignmentMip.java
View file @
a9bd42a2
...
...
@@ -43,8 +43,7 @@ public class AssignmentMip {
// Solver
// [START solver]
// Create the linear solver with the CBC backend.
MPSolver
solver
=
new
MPSolver
(
"AssignmentMip"
,
MPSolver
.
OptimizationProblemType
.
CBC_MIXED_INTEGER_PROGRAMMING
);
MPSolver
solver
=
MPSolver
.
createSolver
(
"AssignmentMip"
,
"CBC"
);
// [END solver]
// Variables
...
...
libs/or-tools-src-ubuntu/examples/java/BinPackingMip.java
View file @
a9bd42a2
...
...
@@ -45,8 +45,7 @@ public class BinPackingMip {
// [START solver]
// Create the linear solver with the CBC backend.
MPSolver
solver
=
new
MPSolver
(
"BinPackingMip"
,
MPSolver
.
OptimizationProblemType
.
CBC_MIXED_INTEGER_PROGRAMMING
);
MPSolver
solver
=
MPSolver
.
createSolver
(
"BinPackingMip"
,
"CBC"
);
// [END solver]
// [START program_part2]
...
...
libs/or-tools-src-ubuntu/examples/java/CoinsGridMIP.java
View file @
a9bd42a2
...
...
@@ -50,12 +50,11 @@ public class CoinsGridMIP {
System
.
loadLibrary
(
"jniortools"
);
}
private
static
MPSolver
createSolver
(
String
solverType
)
{
return
new
MPSolver
(
"MIPDiet"
,
MPSolver
.
OptimizationProblemType
.
valueOf
(
solverType
));
}
private
static
void
solve
(
String
solverType
)
{
MPSolver
solver
=
createSolver
(
solverType
);
System
.
out
.
println
(
"---- CoinsGridMIP with "
+
solverType
);
MPSolver
solver
=
MPSolver
.
createSolver
(
"CoinsGridMIP"
,
solverType
);
if
(
solver
==
null
)
return
;
/** invariants */
int
n
=
31
;
...
...
@@ -85,6 +84,8 @@ public class CoinsGridMIP {
solver
.
solve
();
System
.
out
.
println
(
"Problem solved in "
+
solver
.
wallTime
()
+
"ms"
);
for
(
int
i
=
0
;
i
<
n
;
i
++)
{
for
(
int
j
=
0
;
j
<
n
;
j
++)
{
System
.
out
.
print
((
int
)
x
[
i
][
j
].
solutionValue
()
+
" "
);
...
...
@@ -94,23 +95,9 @@ public class CoinsGridMIP {
}
public
static
void
main
(
String
[]
args
)
{
try
{
System
.
out
.
println
(
"---- Integer programming example with SCIP (recommended) ----"
);
solve
(
"SCIP_MIXED_INTEGER_PROGRAMMING"
);
}
catch
(
java
.
lang
.
IllegalArgumentException
e
)
{
System
.
err
.
println
(
"Bad solver type: "
+
e
);
}
try
{
System
.
out
.
println
(
"---- Integer programming example with CBC ----"
);
solve
(
"CBC_MIXED_INTEGER_PROGRAMMING"
);
}
catch
(
java
.
lang
.
IllegalArgumentException
e
)
{
System
.
err
.
println
(
"Bad solver type: "
+
e
);
}
try
{
System
.
out
.
println
(
"---- Integer programming example with GLPK ----"
);
solve
(
"GLPK_MIXED_INTEGER_PROGRAMMING"
);
}
catch
(
java
.
lang
.
IllegalArgumentException
e
)
{
System
.
err
.
println
(
"Bad solver type: "
+
e
);
}
solve
(
"SCIP"
);
solve
(
"CBC"
);
solve
(
"GLPK"
);
solve
(
"SAT"
);
}
}
libs/or-tools-src-ubuntu/examples/java/ColoringMIP.java
View file @
a9bd42a2
...
...
@@ -39,12 +39,12 @@ public class ColoringMIP {
System
.
loadLibrary
(
"jniortools"
);
}
private
static
MPSolver
createSolver
(
String
solverType
)
{
return
new
MPSolver
(
"MIPDiet"
,
MPSolver
.
OptimizationProblemType
.
valueOf
(
solverType
));
}
private
static
void
solve
(
String
solverType
)
{
MPSolver
solver
=
createSolver
(
solverType
);
System
.
out
.
println
(
"---- CoinsGridMIP with "
+
solverType
);
MPSolver
solver
=
MPSolver
.
createSolver
(
"CoinsGridMIP"
,
solverType
);
if
(
solver
==
null
)
return
;
double
infinity
=
MPSolver
.
infinity
();
/** invariants */
...
...
@@ -115,6 +115,8 @@ public class ColoringMIP {
System
.
err
.
println
(
"The problem does not have an optimal solution!"
);
return
;
}
else
{
System
.
out
.
println
(
"Problem solved in "
+
solver
.
wallTime
()
+
"ms"
);
System
.
out
.
print
(
"Colors used: "
);
for
(
MPVariable
var
:
colUsed
)
{
System
.
out
.
print
((
int
)
var
.
solutionValue
()
+
" "
);
...
...
@@ -133,23 +135,9 @@ public class ColoringMIP {
}
public
static
void
main
(
String
[]
args
)
{
try
{
System
.
out
.
println
(
"---- Integer programming example with SCIP (recommended) ----"
);
solve
(
"SCIP_MIXED_INTEGER_PROGRAMMING"
);
}
catch
(
java
.
lang
.
IllegalArgumentException
e
)
{
System
.
err
.
println
(
"Bad solver type: "
+
e
);
}
try
{
System
.
out
.
println
(
"---- Integer programming example with CBC ----"
);
solve
(
"CBC_MIXED_INTEGER_PROGRAMMING"
);
}
catch
(
java
.
lang
.
IllegalArgumentException
e
)
{
System
.
err
.
println
(
"Bad solver type: "
+
e
);
}
try
{
System
.
out
.
println
(
"---- Integer programming example with GLPK ----"
);
solve
(
"GLPK_MIXED_INTEGER_PROGRAMMING"
);
}
catch
(
java
.
lang
.
IllegalArgumentException
e
)
{
System
.
err
.
println
(
"Bad solver type: "
+
e
);
}
solve
(
"SCIP"
);
solve
(
"CBC"
);
solve
(
"GLPK"
);
solve
(
"SAT"
);
}
}
libs/or-tools-src-ubuntu/examples/java/IntegerProgramming.java
View file @
a9bd42a2
...
...
@@ -10,6 +10,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package
com.google.ortools.examples
;
import
com.google.ortools.linearsolver.MPConstraint
;
...
...
@@ -27,17 +28,8 @@ public class IntegerProgramming {
System
.
loadLibrary
(
"jniortools"
);
}
private
static
MPSolver
createSolver
(
String
solverType
)
{
try
{
return
new
MPSolver
(
"IntegerProgrammingExample"
,
MPSolver
.
OptimizationProblemType
.
valueOf
(
solverType
));
}
catch
(
java
.
lang
.
IllegalArgumentException
e
)
{
return
null
;
}
}
private
static
void
runIntegerProgrammingExample
(
String
solverType
)
{
MPSolver
solver
=
createSolver
(
solverType
);
MPSolver
solver
=
MPSolver
.
createSolver
(
"IntegerProgramming"
,
solverType
);
if
(
solver
==
null
)
{
System
.
out
.
println
(
"Could not create solver "
+
solverType
);
return
;
...
...
@@ -88,10 +80,10 @@ public class IntegerProgramming {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
System
.
out
.
println
(
"---- Integer programming example with SCIP (recommended) ----"
);
runIntegerProgrammingExample
(
"SCIP
_MIXED_INTEGER_PROGRAMMING
"
);
runIntegerProgrammingExample
(
"SCIP"
);
System
.
out
.
println
(
"---- Integer programming example with CBC ----"
);
runIntegerProgrammingExample
(
"CBC
_MIXED_INTEGER_PROGRAMMING
"
);
System
.
out
.
println
(
"---- Integer programming example with
GLPK
----"
);
runIntegerProgrammingExample
(
"
GLPK_MIXED_INTEGER_PROGRAMMING
"
);
runIntegerProgrammingExample
(
"CBC"
);
System
.
out
.
println
(
"---- Integer programming example with
CP-SAT
----"
);
runIntegerProgrammingExample
(
"
SAT
"
);
}
}
libs/or-tools-src-ubuntu/examples/java/LinearProgramming.java
View file @
a9bd42a2
...
...
@@ -10,6 +10,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package
com.google.ortools.examples
;
import
com.google.ortools.linearsolver.MPConstraint
;
...
...
@@ -27,17 +28,8 @@ public class LinearProgramming {
System
.
loadLibrary
(
"jniortools"
);
}
private
static
MPSolver
createSolver
(
String
solverType
)
{
try
{
return
new
MPSolver
(
"LinearProgrammingExample"
,
MPSolver
.
OptimizationProblemType
.
valueOf
(
solverType
));
}
catch
(
java
.
lang
.
IllegalArgumentException
e
)
{
return
null
;
}
}
private
static
void
runLinearProgrammingExample
(
String
solverType
,
boolean
printModel
)
{
MPSolver
solver
=
createSolver
(
solverType
);
MPSolver
solver
=
MPSolver
.
createSolver
(
"IntegerProgramming"
,
solverType
);
if
(
solver
==
null
)
{
System
.
out
.
println
(
"Could not create solver "
+
solverType
);
return
;
...
...
@@ -124,10 +116,8 @@ public class LinearProgramming {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
System
.
out
.
println
(
"---- Linear programming example with GLOP (recommended) ----"
);
runLinearProgrammingExample
(
"GLOP
_LINEAR_PROGRAMMING
"
,
true
);
runLinearProgrammingExample
(
"GLOP"
,
true
);
System
.
out
.
println
(
"---- Linear programming example with CLP ----"
);
runLinearProgrammingExample
(
"CLP_LINEAR_PROGRAMMING"
,
false
);
System
.
out
.
println
(
"---- Linear programming example with GLPK ----"
);
runLinearProgrammingExample
(
"GLPK_LINEAR_PROGRAMMING"
,
false
);
runLinearProgrammingExample
(
"CLP"
,
false
);
}
}
libs/or-tools-src-ubuntu/examples/java/LinearProgrammingExample.java
View file @
a9bd42a2
...
...
@@ -27,8 +27,7 @@ public class LinearProgrammingExample {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// [START solver]
MPSolver
solver
=
new
MPSolver
(
"LinearProgrammingExample"
,
MPSolver
.
OptimizationProblemType
.
GLOP_LINEAR_PROGRAMMING
);
MPSolver
solver
=
MPSolver
.
createSolver
(
"LinearProgrammingExample"
,
"GLOP"
);
// [END solver]
// [START variables]
...
...
libs/or-tools-src-ubuntu/examples/java/MipVarArray.java
View file @
a9bd42a2
...
...
@@ -50,8 +50,7 @@ public class MipVarArray {
// [START solver]
// Create the linear solver with the CBC backend.
MPSolver
solver
=
new
MPSolver
(
"SimpleMipProgram"
,
MPSolver
.
OptimizationProblemType
.
CBC_MIXED_INTEGER_PROGRAMMING
);
MPSolver
solver
=
MPSolver
.
createSolver
(
"MipVarArray"
,
"CBC"
);
// [END solver]
// [START program_part2]
...
...
libs/or-tools-src-ubuntu/examples/java/MultipleKnapsackMip.java
View file @
a9bd42a2
...
...
@@ -46,8 +46,7 @@ public class MultipleKnapsackMip {
// [START solver]
// Create the linear solver with the CBC backend.
MPSolver
solver
=
new
MPSolver
(
"MultipleKnapsackMip"
,
MPSolver
.
OptimizationProblemType
.
CBC_MIXED_INTEGER_PROGRAMMING
);
MPSolver
solver
=
MPSolver
.
createSolver
(
"MultipleKnapsackMip"
,
"CBC"
);
// [END solver]
// [START program_part2]
...
...
libs/or-tools-src-ubuntu/examples/java/SimpleLpProgram.java
View file @
a9bd42a2
...
...
@@ -30,8 +30,7 @@ public class SimpleLpProgram {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// [START solver]
// Create the linear solver with the GLOP backend.
MPSolver
solver
=
new
MPSolver
(
"SimpleLpProgram"
,
MPSolver
.
OptimizationProblemType
.
GLOP_LINEAR_PROGRAMMING
);
MPSolver
solver
=
MPSolver
.
createSolver
(
"SimpleLpProgram"
,
"GLOP"
);
// [END solver]
// [START variables]
...
...
Prev
1
…
7
8
9
10
11
12
13
14
15
…
27
Next