Update FSharp examples so all use .NetCoreApp2.1
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Dotnet Core examples
|
||||
# .NetCoreApp examples
|
||||
The following examples showcase how to use OrTools.
|
||||
The project solution has examples for both C# and F#.
|
||||
|
||||
@@ -10,8 +10,31 @@ Wherever you have or-tools installed, be sure to `PackageReference` the `Google.
|
||||
from the project file.
|
||||
|
||||
## Execution
|
||||
Running the examples will involve compiling them, then running them. You can run the following command:
|
||||
```bash
|
||||
dotnet run --project examples/dotnet/<example>.csproj
|
||||
Running the examples will involve building them, then running them.
|
||||
You can run the following command:
|
||||
```shell
|
||||
dotnet build examples/dotnet/<example>.csproj
|
||||
dotnet run --no-build --project examples/dotnet/<example>.csproj
|
||||
```
|
||||
|
||||
# Note on Google.OrTools.FSharp
|
||||
This part describes how to use Google.OrTools.FSharp nuget package in F#.
|
||||
|
||||
## SolverOptions and lpSolve
|
||||
This function and parameter object are a wrapper around the standard Google.OrTools functions.
|
||||
It is designed to enter the Linear/Integer program as *matrices* and *vectors*.
|
||||
|
||||
Two input formats are allowed:
|
||||
* Canonical Form;
|
||||
* Standard Form.
|
||||
|
||||
**ALL Matrices & Vectors are entered as columns**
|
||||
|
||||
## Execution
|
||||
Running the examples will involve building them, then running them.
|
||||
You can run the following command:
|
||||
```shell
|
||||
dotnet build examples/dotnet/<example>.fsproj
|
||||
dotnet run --no-build --project examples/dotnet/<example>.fsproj
|
||||
```
|
||||
|
||||
|
||||
19
examples/dotnet/csintegerprogramming.fsproj
Normal file
19
examples/dotnet/csintegerprogramming.fsproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<RestoreSources>../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<GenerateTailCalls>true</GenerateTailCalls>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="csintegerprogramming.fs" />
|
||||
<PackageReference Include="Google.OrTools.FSharp" Version="6.8.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
19
examples/dotnet/cslinearprogramming.fsproj
Normal file
19
examples/dotnet/cslinearprogramming.fsproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<RestoreSources>../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<GenerateTailCalls>true</GenerateTailCalls>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="cslinearprogramming.fs" />
|
||||
<PackageReference Include="Google.OrTools.FSharp" Version="6.8.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
19
examples/dotnet/diet.fsproj
Normal file
19
examples/dotnet/diet.fsproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<RestoreSources>../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<GenerateTailCalls>true</GenerateTailCalls>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="diet.fs" />
|
||||
<PackageReference Include="Google.OrTools.FSharp" Version="6.8.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
19
examples/dotnet/equality-inequality.fsproj
Normal file
19
examples/dotnet/equality-inequality.fsproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<RestoreSources>../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<GenerateTailCalls>true</GenerateTailCalls>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="equality-inequality.fs" />
|
||||
<PackageReference Include="Google.OrTools.FSharp" Version="6.8.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
19
examples/dotnet/equality.fsproj
Normal file
19
examples/dotnet/equality.fsproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<RestoreSources>../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<GenerateTailCalls>true</GenerateTailCalls>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="equality.fs" />
|
||||
<PackageReference Include="Google.OrTools.FSharp" Version="6.8.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,18 +0,0 @@
|
||||
# Examples of using or-tools in FSharp
|
||||
|
||||
This file describes how to use the or-tools .NET binary archive in F#
|
||||
|
||||
## SolverOptions and lpSolve
|
||||
This function and parameter object are a wrapper around the standard or-tools functions. It is designed
|
||||
to enter the Linear/Integer program as matrices & vectors. Two input formats are allowed: Canonical Form; Standard Form.
|
||||
|
||||
*__ALL Matrices & Vectors are entered as columns__*
|
||||
|
||||
## Execution
|
||||
Be sure to compile the or-tools (native & managed F# library) before executing following
|
||||
```shell
|
||||
fsharpc --target:exe --out:bin/<example_file>.exe --platform:anycpu --lib:bin examples/fsharp/<example_file>.fsx
|
||||
|
||||
DYLD_FALLBACK_LIBRARY_PATH=lib mono bin/<example_file>.exe
|
||||
|
||||
```
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NETStandard.Library" version="2.0.2" />
|
||||
</packages>
|
||||
19
examples/dotnet/integer-linear-program.fsproj
Normal file
19
examples/dotnet/integer-linear-program.fsproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<RestoreSources>../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<GenerateTailCalls>true</GenerateTailCalls>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="integer-linear-program.fs" />
|
||||
<PackageReference Include="Google.OrTools.FSharp" Version="6.8.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
19
examples/dotnet/knapsack.fsproj
Normal file
19
examples/dotnet/knapsack.fsproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<RestoreSources>../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<GenerateTailCalls>true</GenerateTailCalls>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="knapsack.fs" />
|
||||
<PackageReference Include="Google.OrTools.FSharp" Version="6.8.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
19
examples/dotnet/network-max-flow-lpSolve.fsproj
Normal file
19
examples/dotnet/network-max-flow-lpSolve.fsproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<RestoreSources>../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<GenerateTailCalls>true</GenerateTailCalls>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="network-max-flow-lpSolve.fs" />
|
||||
<PackageReference Include="Google.OrTools.FSharp" Version="6.8.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
19
examples/dotnet/network-max-flow.fsproj
Normal file
19
examples/dotnet/network-max-flow.fsproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<RestoreSources>../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<GenerateTailCalls>true</GenerateTailCalls>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="network-max-flow.fs" />
|
||||
<PackageReference Include="Google.OrTools.FSharp" Version="6.8.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
19
examples/dotnet/network-min-cost-flow.fsproj
Normal file
19
examples/dotnet/network-min-cost-flow.fsproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<RestoreSources>../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<GenerateTailCalls>true</GenerateTailCalls>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="network-min-cost-flow.fs" />
|
||||
<PackageReference Include="Google.OrTools.FSharp" Version="6.8.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
19
examples/dotnet/rabbit-pheasant.fsproj
Normal file
19
examples/dotnet/rabbit-pheasant.fsproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<RestoreSources>../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<GenerateTailCalls>true</GenerateTailCalls>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="rabbit-pheasant.fs" />
|
||||
<PackageReference Include="Google.OrTools.FSharp" Version="6.8.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
19
examples/dotnet/volsay.fsproj
Normal file
19
examples/dotnet/volsay.fsproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<RestoreSources>../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<GenerateTailCalls>true</GenerateTailCalls>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="volsay.fs" />
|
||||
<PackageReference Include="Google.OrTools.FSharp" Version="6.8.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
19
examples/dotnet/volsay3-lpSolve.fsproj
Normal file
19
examples/dotnet/volsay3-lpSolve.fsproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<RestoreSources>../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<GenerateTailCalls>true</GenerateTailCalls>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="volsay3-lpSolve.fs" />
|
||||
<PackageReference Include="Google.OrTools.FSharp" Version="6.8.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
19
examples/dotnet/volsay3.fsproj
Normal file
19
examples/dotnet/volsay3.fsproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<RestoreSources>../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<GenerateTailCalls>true</GenerateTailCalls>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="volsay3.fs" />
|
||||
<PackageReference Include="Google.OrTools.FSharp" Version="6.8.*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user