Open d-vyd opened 2 years ago
Hi @d-vyd,
Firstly, yes, the aim of this proyect is to create an API that looks like Python Clingo. Still, as I am doing it by hand, it is not complete, so for a real scenario things may be missing (in the example you gave the context is not supported yet). For updated API, you can check github page of the proyect: https://nekerafa.github.io/clingo-cs/api/ClingoSharp.html
About the second part, beause another goal was to created a mod for Cities: Skylines that combines with clingo (you can check the another repository for an example of use of this API: https://github.com/NEKERAFA/CS-IndustryLP), I have not tested the if the latest nuget packages work in a real environment. As a temporary solution I recommend that you include the project as a reference:
git submodule add https://github.com/NEKERAFA/clingo-cs.git
git submodule update --init --recursive
In the csproj:
<ItemGroup>
<ProjectReference Include="clingo-cs/src/Clingo_cs/Clingo_cs.csproj" />
</ItemGroup>
Or using command line:
dotnet add reference clingo-cs/src/Clingo_cs/Clingo_cs.csproj
Thank you. I'll give that a try!
Hi Rafael,
Thank you for all your work making clingo-cs! I'm very interested in combining C# and Clingo. When clingo-cs is added to a project, will I then be able to follow the Python API example? Something like:
using Clingo-cs; var ctl = clingo.Control() ctl.add("base", [], "p(@id(10)). q(@seq(1,2))."); ctl.ground([("base", [])], context=Context());
I've taken the following steps:
clingo-cs-main\src\Clingo_cs\bin\Debug contains: Clingo_cs.0.1.0.nupkg (11kb) net6.0 (directory)
The net6.0 directory contains: Clingo_c.dll (10kb) Clingo_c.pdb (12kb) Clingo_cs.deps.json (1kb) Clingo_cs.dll (17kb) Clingo_cs.pdb (17kb) ref (directory)
The ref directory contains: Clingo_cs.dll (10kb)
In Visual Studio, I created a package source entry for clingo-cs-main\src\Clingo_cs\bin\Debug and when I open Nuget and use this source, I see the option to install a single package:
Clingo_cs by Rafael Alcalde Azpiazu A C# bindings to the clingo library.
When I select that package, I see the following errors:
Here are the detailed results of the build:
PS D:\Documents\Programming\CSharp\clingo-cs-main> dotnet build --configuration Debug Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore... All projects are up-to-date for restore. Clingo_c -> D:\Documents\Programming\CSharp\clingo-cs-main\src\Clingo_c\bin\Debug\net6.0\Clingo_c.dll C:\Program Files\dotnet\sdk\6.0.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(221,5): error : Could not find a part of the path 'D:\Documents\Programming\CSharp\clingo-cs-main\clingo\build\linux\bin'. [D:\Documents\Programming\CSharp\clingo-cs-main\src\Clingo_c\Clingo_c.csproj] Clingo_cs -> D:\Documents\Programming\CSharp\clingo-cs-main\src\Clingo_cs\bin\Debug\net6.0\Clingo_cs.dll Clingo_cs.Tests -> D:\Documents\Programming\CSharp\clingo-cs-main\tests\bin\Debug\net6.0\Clingo_cs.Tests.dll
Build FAILED.
C:\Program Files\dotnet\sdk\6.0.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(221,5): error : Could not find a part of the path 'D:\Documents\Programming\CSharp\clingo-cs-main\clingo\build\linux\bin'. [D:\Documents\Programming\CSharp\clingo-cs-main\src\Clingo_c\Clingo_c.csproj] 0 Warning(s) 1 Error(s)