Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ortools in Golang #953

Open
9 tasks
supriya-clutter opened this issue Nov 29, 2018 · 23 comments
Open
9 tasks

Support for ortools in Golang #953

supriya-clutter opened this issue Nov 29, 2018 · 23 comments
Assignees
Labels
Feature Request Missing Feature/Wrapper Lang: Golang Golang wrapper issue
Milestone

Comments

@supriya-clutter
Copy link

supriya-clutter commented Nov 29, 2018

Has there been any it interest to support the or tools API in Go ?

EDIT:
Current implementation:

ToDo List:

  • SWIG go wrapper
    • Linear solver go swig
    • Constraint Solver go swig
    • Sat go swig
    • Graph go swig
  • Makefile support
  • CMake support
  • [optional] Bazel support
  • Archive integration
@Mizux Mizux added the Feature Request Missing Feature/Wrapper label Nov 30, 2018
@Mizux
Copy link
Collaborator

Mizux commented Nov 30, 2018

It is currently not planned for he foreseeable future but since SWIG seems to support GO feel free to send us a PR for the support...

ref: http://www.swig.org/Doc3.0/SWIGDocumentation.html#Go

@kchan628
Copy link

Hi, for anyone trying to go down this route. I started implementing a port of the java cp sat wrapper for go here. But we have decided to go java instead. For anyone that wants to complete the task you might want to pickup the work I started. I had branched from v7.0 tag.

v7.0...kchan628:go-wrapper

See the makefiles/Makefile.go.mk as a starting point. It currently only supports Mac

make third_party
make go
make test_go

See wrapper code at /go/sat

@lperron
Copy link
Collaborator

lperron commented May 13, 2019 via email

@kchan628
Copy link

hi @lperron I'm not planning to do any more dev work on the go wrapper at the moment. But that seems like a small change to make if somebody wants to continue it.

@lperron
Copy link
Collaborator

lperron commented Aug 6, 2019

Agreed. Unfortunately, I have no bandwidth to work on this.

@gonzojive
Copy link
Contributor

gonzojive commented May 26, 2020

Would the OR tools authors like to include Go bindings in the official repo? I created a small project with SWIG bindings and a handwritten layer on top of the SWIG bindings here: https://github.com/gonzojive/or-tools-go. The bindings are quite limited now - only the linear solver.

The repo builds with Bazel, which was easier than dealing with make and friends for me. I don't have the bandwidth to add support for other build systems.

I would prefer to merge the project into the official repo so it can be tested continuously and not subject to as much bitrot, but of course it's up to the authors. Any suggestions about how to organize the code for a pull request would be appreciated.

@Mizux Mizux added this to the v7.8 milestone Jun 16, 2020
@CosminNechifor
Copy link

Out of curiosity: I see that this was added on the v7.8 milestone. Can you please leave a comment with a small update regarding the go wrapper or if it in your future plans? Thank you. (Decided not to open a feat request since it would be clearly a duplicate of this)

@keenanwl
Copy link

I continued on where @kchan628 left off (thanks!):

master...keenanwl:add-go-wrapper

I also converted some of the Java examples into go test files, like the sudoku sat

In order to keep go.mod happy, I didn't move the generated files to ortools/gen/ortools/go as @lperron requested, but there may still be an idiomatic go way to get that done.

There is still some work needed to clean up a bit, fix the comments and add support for the knapsack solver, and any others I missed.

Otherwise:

make third_party
make go
make test_go

@Mizux Mizux modified the milestones: v7.8, Backlog Sep 22, 2020
@lperron
Copy link
Collaborator

lperron commented Sep 22, 2020 via email

@Mizux Mizux self-assigned this Sep 22, 2020
@Mizux Mizux added this to To do in Feature Requests via automation Sep 22, 2020
@Mizux
Copy link
Collaborator

Mizux commented Sep 22, 2020

Added a list at top with forks having some go stuff..., hope to work on it once release 8.0 is out

@keenanwl
Copy link

@lperron yes, that should be possible. I'll take a look at it tomorrow and see what I come up with.

@Mizux Mizux modified the milestones: Backlog, v8.1 Sep 22, 2020
@Mizux Mizux moved this from To do to In progress in Feature Requests Sep 22, 2020
@Mizux Mizux reopened this Sep 22, 2020
@keenanwl
Copy link

keenanwl commented Sep 23, 2020

Hopefully it is alright that I went with ortools/gen/ortools/go/sat (08a7ffa), there were some go specific build issues with ortools/gen/ortools/sat and ortools/gen/ortools/sat/go. But I am happy to look at it again if that still doesn't work for you @lperron .

Otherwise I'll just keep going down the list I made of outstanding issues.

@Mizux Mizux modified the milestones: v8.1, v8.2 Nov 20, 2020
@Mizux Mizux modified the milestones: v8.2, v8.3 Jan 27, 2021
@Mizux Mizux modified the milestones: v9.0, v9.1 Mar 22, 2021
@Mizux Mizux added the Lang: Golang Golang wrapper issue label Jun 5, 2021
@Mizux Mizux modified the milestones: v9.1, v9.2 Jun 29, 2021
@amirmm11
Copy link

@Mizux Would it be easier to wrap the OR-Tools C++ code in a gRPC server (since protocol buffer files exist) and put it in a docker? Then everyone can pull the docker image and write a gRPC client.

@irfansharif
Copy link

irfansharif commented Jul 31, 2021

Here's an adaptor for CP-SAT solver in Go: https://github.com/irfansharif/solver. Built on top of @gonzojive's and @brettgoing's earlier work -- thanks!

@prasad-marne
Copy link

@Mizux Any updates on this? I am willing to put in work to add Golang support for constraint solver.
Will it be alright to create a PR for that?

@solanu
Copy link

solanu commented Sep 23, 2021

What about this? ;-)

@Mizux
Copy link
Collaborator

Mizux commented Sep 30, 2021

Hi sorry for the delay...
Hope to release v9.1 tomorrow then let's have a serious look at Golang support and how to move forward on this subject.

@Mizux Mizux modified the milestones: v9.2, v9.3 Oct 6, 2021
@piyushuber
Copy link

Hi. Any updates on this one ?

@lperron
Copy link
Collaborator

lperron commented Jan 17, 2022 via email

@ca-123321
Copy link

I'm hoping this is in the future as well, currently duct-taping calling python from Go, yuck.

@Mizux Mizux modified the milestones: v9.3, v10.0 Feb 11, 2022
@Mizux Mizux moved this from In progress to To do in Feature Requests Feb 17, 2022
@Mizux Mizux moved this from To do to stall in Feature Requests Jun 10, 2022
@Mizux Mizux moved this from stall to To do in Feature Requests Oct 20, 2022
@cristaloleg
Copy link

Hey, do you need any help with that?

@lperron
Copy link
Collaborator

lperron commented Jan 8, 2024 via email

@Mizux
Copy link
Collaborator

Mizux commented Jan 8, 2024

With color syntax:

go_library(
name = "cpmodel",
srcs = [
"cp_model.go",
"cp_solver.go",
"domain.go",
],
cgo = 1,
deps = [
":cp_solver_c", # keep
"//base/go:log", # not present in OSS
"//third_party/golang/protobuf/v2/proto", # Wrong path
"//ortools/sat:cp_model_go_proto",
"//ortools/sat:sat_parameters_go_proto",
],
)

go_test(
name = "cpmodel_test",
srcs = [
"cp_model_test.go",
"cp_solver_test.go",
"domain_test.go",
],
cgo = 1,
library = ":cpmodel",
deps = [
"//base/go:log",
"//third_party/golang/cmp",
"//third_party/golang/protobuf/v2/proto", # Wrong path
"//third_party/golang/protobuf/v2/testing/protocmp", # Wrong path
"//ortools/sat:cp_model_go_proto",
"//ortools:sat_parameters_go_proto",
],
)

cc_library(
name = "cp_solver_c",
srcs = ["cp_solver_c.cc"],
hdrs = ["cp_solver_c.h"],
deps = [
"//strings",
"//third_party/absl/log",
"//ortools/sat:cp_model_cc_proto",
"//ortools/sat:cp_model_solver",
"//ortools/sat:sat_parameters_cc_proto",
"//ortools/util:time_limit",
"//util/task:status", # Should use absl status
"//util/task:status_cc_proto", # Does it exists in OSS ?
],
)

@Mizux Mizux modified the milestones: v10.0, Backlog Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Missing Feature/Wrapper Lang: Golang Golang wrapper issue
Projects
Development

No branches or pull requests