Commit Graph

53 Commits

Author SHA1 Message Date
Laurent Perron
ce36b4bb6d fix 2022-01-23 21:46:13 +01:00
bollhals
8e742dca52 allow unsafe code and use it to avoid copying to temp array 2022-01-23 20:47:07 +01:00
Laurent Perron
8644ffa1ea reformat 2022-01-21 12:00:35 +01:00
Laurent Perron
58659bd77e [CP-SAT] fix memory leak in C# 2022-01-20 13:30:34 +01:00
bollhals
ca050c0c50 simplify reading from returned buffer
use arraypool for copy to buffer
avoid calling CalculateSize twice
2022-01-19 01:23:27 +01:00
bollhals
e2054b3cb5 - only use domain object if really needed
- upgrade to C# 9
- replace some null checks with "is (not) null"
2022-01-12 21:54:53 +01:00
Corentin Le Molgat
354e350004 Sync C# indent 2022-01-03 09:49:47 +01:00
Corentin Le Molgat
5f567735d7 cmake: Fix dotnet.cmake and path 2021-12-03 14:20:19 +01:00
Mizux Seiha
72ebd8b748 cmake: rework .Net support 2021-12-03 14:20:19 +01:00
Laurent Perron
6c6e9d3979 remove .NET warning 2021-10-03 11:52:13 +02:00
Mizux Seiha
89d8d77c2a Fix build 2021-04-12 09:21:20 +02:00
Mizux Seiha
8bb54b04ef Bump Copyright to 2021
FYI:
find ortools \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i 's/\(Copyright 2010\)-2018/\1-2021/g'
2021-04-01 21:00:53 +02:00
Corentin Le Molgat
a40143cdd2 cpp: Migrate int64 to int64_t 2021-04-01 20:20:43 +02:00
Mizux Seiha
d874be2562 dotnet: Add support for vector<vector<CType>> 2021-02-19 16:02:51 +01:00
Corentin Le Molgat
a9385fc3d2 Format all .Net using Microsoft style 2020-11-03 10:15:53 +01:00
Corentin Le Molgat
b5e70663c7 Format using clang-format 11 2020-10-29 14:26:41 +01:00
Mizux Seiha
335cf3df3d format all C# files 2020-10-26 18:41:49 +01:00
Mizux Seiha
a4a5f64801 cmake: Add dotnet samples 2020-09-22 19:09:22 +02:00
Corentin Le Molgat
22356ff523 Sync g3 -> gh part_2 2020-03-09 18:34:21 +01:00
Corentin Le Molgat
8fee57d205 CMake: dotnet rework
.Net: update runtime csproj.in
2020-03-05 15:18:21 +01:00
Corentin Le Molgat
5b6079a6e5 CMake:dotnet: Fix -FPIC management 2020-03-05 15:18:20 +01:00
Corentin Le Molgat
c59444b07e CMake:dotnet Add definition for swig 2020-03-05 15:18:20 +01:00
Corentin Le Molgat
20c8ee05b8 CMake: fix dotnet_<targets> 2020-03-04 14:34:33 +01:00
Laurent Perron
2abc2b6786 remove warning in .NET 2020-03-02 15:15:50 +01:00
Corentin Le Molgat
d67a1af2ea .Net: Fix SWIG compile option in CMake 2020-03-02 09:25:05 +01:00
Corentin Le Molgat
349f6b7681 CMake: Update .Net support
* Add define SWIGWORDSIZE64 on Linux
* Add -doxygen option
2020-02-28 08:21:27 +01:00
Corentin Le Molgat
ed9136bb48 .Net swig refactor 2020-02-17 10:51:57 +01:00
Laurent Perron
8572f97c28 reindent cp_model.py; fix Domain swig; rename test 2019-05-17 10:27:41 +02:00
Laurent Perron
078b809010 export more methods on the Domain class in non C++ languages; add test for python; use unittest in python tests; add deprecation tag for some C# CP-SAT methods 2019-05-16 23:37:43 +02:00
Laurent Perron
1d9463f9cb remove duplicate typedef 2019-05-13 15:29:25 +02:00
Laurent Perron
f111661e92 remove comment 2019-05-08 16:28:34 +02:00
Laurent Perron
0c7968388b split sorted_interval_list.i out of sat.i in C# CP-SAT swig wrapper 2019-05-08 13:40:42 +02:00
Corentin Le Molgat
d8ca1d48d3 .Net: Fix IntTupleSet.cs 2019-05-07 11:30:43 +02:00
Laurent Perron
a70ed70563 remove the need for IntArrayHelper.cs; support conversion from type[][] and type[,] to std::vector<std::vector<type>> in C# 2019-05-06 12:55:30 +02:00
Corentin Le Molgat
2f0680127d Backport from g3 to github 2019-03-13 13:51:31 +01:00
Corentin Le Molgat
582805f12b .Net: fix leak in vector.i wrapping
Test.cs:
using System;
using Xunit;
using Google.OrTools.ConstraintSolver;
using static Google.OrTools.ConstraintSolver.operations_research_constraint_solver;

namespace Google.OrTools.Tests {
  public class Tmp {
    [Theory][InlineData(false)][InlineData(true)]
      public void IntVectorToInt64Vector(bool callGC) {
        Console.WriteLine("GC enabled: {0}", callGC);

        Console.WriteLine("initialization...");
        int[] input = new int[100000];
        for(int i=0; i < input.Length; ++i) {
          input[i] = 2*i;
        }
        Console.WriteLine("initialization...DONE");

        for(int i=0; i < 1000000; ++i) {
          long[] output = ToInt64Vector(input);
          Assert.Equal(input.Length, output.Length);
          Assert.Equal(0, output[0]);
          Assert.Equal(2, output[1]);
          Assert.Equal(2*(input.Length-1), output[input.Length-1]);
          if (callGC) {
            GC.Collect();
            GC.WaitForPendingFinalizers();
          }
        }
      }

    [Theory][InlineData(false)][InlineData(true)]
      public void Sequence(bool callGC) {
        Console.WriteLine("GC enabled: {0}", callGC);

        Console.WriteLine("initialization...");
        Solver solver = new Solver("Solver");
        Assignment ass = solver.MakeAssignment();
        IntervalVar[] intervals =
          solver.MakeFixedDurationIntervalVarArray(10, 0, 10, 5, false, "task");
        DisjunctiveConstraint disjunctive = intervals.Disjunctive("Sequence");
        SequenceVar var = disjunctive.SequenceVar();
        ass.Add(var);
        Console.WriteLine("initialization...DONE");

        for(int i=0; i < 1000000; ++i) {
          ass.SetForwardSequence(var, new int[] { 1, 3, 5 });
          int[] seq = ass.ForwardSequence(var);
          Assert.Equal(3, seq.Length);
          Assert.Equal(1, seq[0]);
          Assert.Equal(3, seq[1]);
          Assert.Equal(5, seq[2]);
          if (callGC) {
            GC.Collect();
            GC.WaitForPendingFinalizers();
          }
        }
        GC.KeepAlive(solver);
      }

  }
}  // namespace Google.OrTools.Tests

then
```
make run_test SOURCE=tmp.cs &
htop
```
2019-03-08 14:42:39 +01:00
Corentin Le Molgat
76b5d34382 .Net: Fix tuple_set.i
- missing vector.i include
- ignore RawData()
2019-03-07 17:44:09 +01:00
Corentin Le Molgat
ee8c0a05f6 .Net: Cleanup MATRIX_AS_CSHARP_ARRAY 2019-03-07 17:44:09 +01:00
Corentin Le Molgat
dfa2f640df .Net: Add OUTPUT support in VECTOR_AS_CSHARP_ARRAY 2019-03-07 17:44:09 +01:00
Corentin Le Molgat
22a4a1ea55 .Net: Cleanup VECTOR_AS_CSHARP_ARRAY 2019-03-07 11:10:29 +01:00
Corentin Le Molgat
310ce27f27 .Net: remove uneeded typedef from vector.i
- already in base.i
2019-03-07 11:01:32 +01:00
Laurent Perron
087868bcc2 maintenance on swig files; merge presolve context and expand context; minor fixes in the code 2019-02-05 15:06:47 +01:00
Corentin Le Molgat
ec4a7d6e0d Rework C# Callback to use delegates 2019-01-30 14:29:50 +01:00
Corentin Le Molgat
532645d774 csharp: fix RoutingNodeIndex typenames 2019-01-17 13:14:55 +01:00
Laurent Perron
fedf3d4ff4 revamp and simplify swig support, force typed enums for C# and Java for all except the constraint_solver/routing module; port examples; Fix SAT on very large problems 2018-12-11 17:03:03 +01:00
Corentin Le Molgat
b027e57e95 dotnet: Remove reference to dotnet release command
- Currently not implemented...

Add abseil patch

- Add patches/absl-config.cmake

Makefile: Add abseil-cpp on unix

- Force abseil-cpp SHA1 to 45221cc
  note: Just before the PR #136 which break all CMake

Makefile: Add abseil-cpp on windows

- Force abseil-cpp SHA1 to 45221cc
  note: Just before the PR #136 which break all CMake

CMake: Add abseil-cpp

- Force abseil-cpp SHA1 to 45221cc
  note: Just before the PR #136 which break all CMake

port to absl: C++ Part

- Fix warning with the use of ABSL_MUST_USE_RESULT
  > The macro must appear as the very first part of a function
    declaration or definition:
    ...
    Note: past advice was to place the macro after the argument list.
  src: dependencies/sources/abseil-cpp-master/absl/base/attributes.h:418
- Rename enum after windows clash
- Remove non compact table constraints
- Change index type from int64 to int in routing library
- Fix file_nonport compilation on windows
- Fix another naming conflict with windows (NO_ERROR is a macro)
- Cleanup hash containers; work on sat internals
- Add optional_boolean sub-proto

Sync cpp examples with internal code
- reenable issue173 after reducing number of loops

port to absl: Python Part

- Add back cp_model.INT32_MIN|MAX for examples

Update Python examples

- Add random_tsp.py
- Run words_square example
- Run magic_square in python tests

port to absl: Java Part

- Fix compilation of the new routing parameters in java
- Protect some code from SWIG parsing

Update Java Examples

port to absl: .Net Part

Update .Net examples

work on sat internals; Add C++ CP-SAT CpModelBuilder API; update sample code and recipes to use the new API; sync with internal code

Remove VS 2015 in Appveyor-CI

- abseil-cpp does not support VS 2015...

improve tables

upgrade C++ sat examples to use the new API; work on sat internals

update license dates

rewrite jobshop_ft06_distance.py to use the CP-SAT solver

rename last example

revert last commit

more work on SAT internals

fix
2018-11-30 14:48:55 +01:00
Laurent Perron
87b9d55b21 update license headers 2018-11-10 18:00:53 +01:00
Corentin Le Molgat
62cbe9a228 dotnet: Full Rework
- Create native project runtime.{rid}.Google.OrTools
  - follow the microsoft convention e.g.:
  https://www.nuget.org/packages/Microsoft.NETCore.App/
  https://www.nuget.org/packages/runtime.linux-x64.Microsoft.NETCore.App/
- Target `make_dotnet` targets local nupkg instead of dll.
- Use 4096 RSA key for or-tools.snk
- Clean nuget cache in `clean_dotnet` recipe

Refactor:
- Move cs files to ortools/*/csharp
- Move dotnet project to ortools/dotnet/Google.OrTools
- Move example generation to temp_dotnet
  - Avoid to mess the `BIN_DIR`
- Rework Google.OrTools.FSharp

Cleanup:
- Remove deps to netfx.props since we only support:
  netstandard2.0 TFM and netcoreapp2.1 Runtime TFM
- Remove OrTools.nuspec.in
  -> use newly added properties to .csproj format
- Remove of ortools/dotnet/OrTools project
  - replaced by ortools/dotnet/Google.OrTools
- Remove provided protobuf.dll.
  - Automatically retrieved from nuget.org

Misc:
- Add **/*.csproj to gitignore
- Add **/runtime.json to gitignore

- dotnet: Makefile windows fix
  - make.exe doesn't support `else ifeq`
2018-08-30 11:58:47 +02:00
Corentin Le Molgat
b43055c128 dotnet: Fix unused variable warnings 2018-08-29 16:56:25 +02:00
Dhanar Adi Dewandaru
2b17893d7b Fix wrong marshall copy size for CppProtoType in C# wrapper 2018-04-20 07:10:22 +07:00