The projcs file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OPTANO.Modeling.GLPK" Version="4.65.2" />
</ItemGroup>
<ItemGroup>
<Reference Include="libglpk-cli">
<HintPath>libglpk-cli.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Update="glpk_4_65.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="libglpk_cli_native.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
The program.cs file
// See https://aka.ms/new-console-template for more information
using Microsoft.Z3;
using OPTANO.Modeling.GLPK;
using OPTANO.Modeling.Optimization;
internal class Program
{
private static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
var model = new OPTANO.Modeling.Optimization.Model();
var varX = new Variable("x");
model.AddObjective(new OPTANO.Modeling.Optimization.Objective(varX*2,"obj1"));
var solver = new GLPKSolver();
solver.Solve(model);
Console.WriteLine(solver.ToString());
}
}