Skip to content

Commit

Permalink
dotnet: Remove reference to dotnet release command
Browse files Browse the repository at this point in the history
- 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 google#136 which break all CMake

Makefile: Add abseil-cpp on windows

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

CMake: Add abseil-cpp

- Force abseil-cpp SHA1 to 45221cc
  note: Just before the PR google#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
  • Loading branch information
Mizux committed Nov 30, 2018
1 parent 745906c commit b027e57
Show file tree
Hide file tree
Showing 490 changed files with 92,152 additions and 24,887 deletions.
18 changes: 1 addition & 17 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,32 @@ environment:
matrix:
# Makefile
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VS: 2017
BUILDER: make
LANGUAGE: cc

- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VS: 2017
BUILDER: make
LANGUAGE: python

- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VS: 2017
BUILDER: make
LANGUAGE: java

- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VS: 2017
BUILDER: make
LANGUAGE: dotnet

- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
VS: 2015
BUILDER: make
LANGUAGE: cc
# CMake
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VS: 2017
BUILDER: cmake
CMAKE_GENERATOR: "Visual Studio 15 2017 Win64"
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
VS: 2015
BUILDER: cmake
CMAKE_GENERATOR: "Visual Studio 14 2015 Win64"

matrix:
fast_finish: false

before_build:
- git config --global user.email "[email protected]"
- git config --global user.name "CI"
- if "%VS%"=="2017" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
- if "%VS%"=="2015" call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
- if "%VS%"=="2015" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
- call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
- tools\win\which.exe csc.exe
- tools\win\which.exe fsc.exe
- tools\win\which.exe dotnet.exe
Expand Down
18 changes: 14 additions & 4 deletions cmake/cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,26 @@ target_include_directories(${PROJECT_NAME} INTERFACE
$<INSTALL_INTERFACE:include>
)
target_link_libraries(${PROJECT_NAME} PUBLIC
ZLIB::ZLIB
absl::base
absl::container
absl::hash
absl::memory
absl::meta
absl::str_format
absl::strings
absl::synchronization
absl::types
gflags::gflags glog::glog
ZLIB::ZLIB protobuf::libprotobuf
protobuf::libprotobuf
Cbc::CbcSolver Cbc::OsiCbc Cbc::ClpSolver Cbc::OsiClp
Threads::Threads)
if(WIN32)
target_link_libraries(${PROJECT_NAME} PUBLIC psapi.lib ws2_32.lib)
target_compile_definitions(${PROJECT_NAME} PUBLIC __WIN32__)
target_link_libraries(${PROJECT_NAME} PUBLIC psapi.lib ws2_32.lib)
target_compile_definitions(${PROJECT_NAME} PUBLIC __WIN32__)
endif()
target_compile_definitions(${PROJECT_NAME}
PUBLIC USE_BOP USE_GLOP USE_CBC USE_CLP)
PUBLIC USE_BOP USE_GLOP USE_CBC USE_CLP)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

Expand Down
29 changes: 29 additions & 0 deletions cmake/external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,35 @@ if(NOT TARGET protobuf::libprotobuf OR NOT TARGET protobuf::protoc)
message(STATUS "Adding CMake Subproject: Protobuf...DONE")
endif()

##############
## ABSEIL ##
##############
if(NOT TARGET absl::base)
message(STATUS "Target absl::base not found.")
message(STATUS "Adding CMake Subproject: Abseil...")
# Download and unpack abseil at configure time
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/abseil.CMakeLists.txt
${CMAKE_BINARY_DIR}/abseil-cpp-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/abseil-cpp-download)
if(result)
message(FATAL_ERROR "CMake step for abseil failed: ${result}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/abseil-cpp-download)
if(result)
message(FATAL_ERROR "Build step for abseil failed: ${result}")
endif()

add_subdirectory(
${CMAKE_BINARY_DIR}/abseil-cpp-src
${CMAKE_BINARY_DIR}/abseil-cpp-build)
message(STATUS "Adding CMake Subproject: Abseil...DONE")
endif()

###########
## CBC ##
###########
Expand Down
22 changes: 22 additions & 0 deletions cmake/external/abseil.CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.5)

# simplify variable expansion
cmake_policy(SET CMP0053 NEW)
cmake_policy(SET CMP0010 NEW)

project(abseil-cpp-download NONE)

include(ExternalProject)
ExternalProject_Add(abseil-cpp_project
GIT_REPOSITORY https://github.com/abseil/abseil-cpp
GIT_TAG "45221cc"
SOURCE_DIR "${CMAKE_BINARY_DIR}/abseil-cpp-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/abseil-cpp-build"
UPDATE_COMMAND ""
PATCH_COMMAND git apply "${PROJECT_SOURCE_DIR}/patches/abseil-cpp-master.patch"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
LOG_DOWNLOAD ON
)
35 changes: 12 additions & 23 deletions examples/contrib/AllDifferentExcept0.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
// 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.
import java.io.*;
import java.util.*;
import java.text.*;

import com.google.ortools.constraintsolver.DecisionBuilder;
import com.google.ortools.constraintsolver.IntVar;
import com.google.ortools.constraintsolver.Solver;
import java.io.*;
import java.text.*;
import java.util.*;

public class AllDifferentExcept0 {

Expand All @@ -34,25 +33,19 @@ public class AllDifferentExcept0 {
public static void alldifferent_except_0(Solver solver, IntVar[] a) {

int n = a.length;
for(int i = 0; i < n; i++) {
for(int j = 0; j < i; j++) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
IntVar bi = solver.makeIsDifferentCstVar(a[i], 0);
IntVar bj = solver.makeIsDifferentCstVar(a[j], 0);
IntVar bij = solver.makeIsDifferentCstVar(a[i], a[j]);
solver.addConstraint(
solver.makeLessOrEqual(
solver.makeProd(bi, bj).var(), bij));
solver.addConstraint(solver.makeLessOrEqual(solver.makeProd(bi, bj).var(), bij));
}
}
}


/**
*
* Implements a (decomposition) of global constraint
* alldifferent_except_0.
* See http://www.hakank.org/google_or_tools/circuit.py
*
* Implements a (decomposition) of global constraint alldifferent_except_0. See
* http://www.hakank.org/google_or_tools/circuit.py
*/
private static void solve() {

Expand All @@ -75,9 +68,8 @@ private static void solve() {

// we also require at least 2 0's
IntVar[] z_tmp = solver.makeBoolVarArray(n, "z_tmp");
for(int i = 0; i < n; i++) {
solver.addConstraint(
solver.makeIsEqualCstCt(x[i], 0, z_tmp[i]));
for (int i = 0; i < n; i++) {
solver.addConstraint(solver.makeIsEqualCstCt(x[i], 0, z_tmp[i]));
}

IntVar z = solver.makeSum(z_tmp).var();
Expand All @@ -86,17 +78,15 @@ private static void solve() {
//
// search
//
DecisionBuilder db = solver.makePhase(x,
solver.INT_VAR_DEFAULT,
solver.INT_VALUE_DEFAULT);
DecisionBuilder db = solver.makePhase(x, solver.INT_VAR_DEFAULT, solver.INT_VALUE_DEFAULT);
solver.newSearch(db);

//
// output
//
while (solver.nextSolution()) {
System.out.print("x: ");
for(int i = 0; i < n; i++) {
for (int i = 0; i < n; i++) {
System.out.print(x[i].value() + " ");
}
System.out.println(" z: " + z.value());
Expand All @@ -109,7 +99,6 @@ private static void solve() {
System.out.println("Failures: " + solver.failures());
System.out.println("Branches: " + solver.branches());
System.out.println("Wall time: " + solver.wallTime() + "ms");

}

public static void main(String[] args) throws Exception {
Expand Down
32 changes: 10 additions & 22 deletions examples/contrib/AllInterval.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,26 @@
// 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.
import java.io.*;
import java.util.*;
import java.text.*;

import com.google.ortools.constraintsolver.DecisionBuilder;
import com.google.ortools.constraintsolver.IntVar;
import com.google.ortools.constraintsolver.Solver;
import java.io.*;
import java.text.*;
import java.util.*;

public class AllInterval {

static {
System.loadLibrary("jniortools");
}


/**
*
* Implements the all interval problem.
* See http://www.hakank.org/google_or_tools/all_interval.py
*
* Implements the all interval problem. See http://www.hakank.org/google_or_tools/all_interval.py
*/
private static void solve(int n) {

Solver solver = new Solver("AllInterval");


//
// variables
//
Expand All @@ -48,24 +42,20 @@ private static void solve(int n) {
solver.addConstraint(solver.makeAllDifferent(x));
solver.addConstraint(solver.makeAllDifferent(diffs));

for(int k = 0; k < n - 1; k++) {
for (int k = 0; k < n - 1; k++) {
solver.addConstraint(
solver.makeEquality(diffs[k],
solver.makeAbs(solver.makeDifference(x[k + 1], x[k])).var()));
solver.makeEquality(
diffs[k], solver.makeAbs(solver.makeDifference(x[k + 1], x[k])).var()));
}


// symmetry breaking
solver.addConstraint(solver.makeLess(x[0], x[n - 1]));
solver.addConstraint(solver.makeLess(diffs[0], diffs[1]));


//
// search
//
DecisionBuilder db = solver.makePhase(x,
solver.CHOOSE_FIRST_UNBOUND,
solver.ASSIGN_MIN_VALUE);
DecisionBuilder db = solver.makePhase(x, solver.CHOOSE_FIRST_UNBOUND, solver.ASSIGN_MIN_VALUE);

solver.newSearch(db);

Expand All @@ -74,16 +64,15 @@ private static void solve(int n) {
//
while (solver.nextSolution()) {
System.out.print("x : ");
for(int i = 0; i < n; i++) {
for (int i = 0; i < n; i++) {
System.out.print(x[i].value() + " ");
}
System.out.print("\ndiffs: ");

for(int i = 0; i < n-1; i++) {
for (int i = 0; i < n - 1; i++) {
System.out.print(diffs[i].value() + " ");
}
System.out.println("\n");

}
solver.endSearch();

Expand All @@ -93,7 +82,6 @@ private static void solve(int n) {
System.out.println("Failures: " + solver.failures());
System.out.println("Branches: " + solver.branches());
System.out.println("Wall time: " + solver.wallTime() + "ms");

}

public static void main(String[] args) throws Exception {
Expand Down
Loading

0 comments on commit b027e57

Please sign in to comment.