-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Comments
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... |
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. See the makefiles/Makefile.go.mk as a starting point. It currently only supports Mac
See wrapper code at /go/sat |
Hi,
very nice.
Can you change the CL such that generated go code is in ortools/gen/go/ or
ortools/gen/ortools/go
Laurent Perron | Operations Research | lperron@google.com | (33) 1 42 68 53
00
*De : *kchan628 <notifications@github.com>
*Date : *lun. 13 mai 2019 à 18:22
*À : *google/or-tools
*Cc : *Subscribed
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
<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
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#953?email_source=notifications&email_token=ACUPL3PUH2M3IPJ7ZYFXSBLPVGIT7A5CNFSM4GHKMEZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVI2UEI#issuecomment-491891217>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACUPL3NQQNYCCPTFDHVBTVDPVGIT7ANCNFSM4GHKMEZA>
.
|
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. |
Agreed. Unfortunately, I have no bandwidth to work on this. |
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 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. |
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) |
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 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:
|
Actually, is it possible to generate the files in
ortools/gen/ortools/sat/go (for the sat part) and still be able to import
as ortools.sat.go ?
This is very nice.
Laurent Perron | Operations Research | lperron@google.com | (33) 1 42 68 53
00
Le mar. 22 sept. 2020 à 21:29, keenanwl <notifications@github.com> a écrit :
… I continued on where @kchan628 <https://github.com/kchan628> left off
(thanks!):
master...keenanwl:add-go-wrapper
<master...keenanwl:add-go-wrapper>
I also converted some of the Java examples into go test files, like the sudoku
sat
<https://github.com/keenanwl/or-tools/blob/add-go-wrapper/ortools/go/sat/cp_solver_test.go#L148>
In order to keep go.mod happy, I didn't move the generated files to
ortools/gen/ortools/go as @lperron <https://github.com/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
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#953 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3MSDOEVJMLMX3Z7Y73SHD3KLANCNFSM4GHKMEZA>
.
|
Added a list at top with forks having some go stuff..., hope to work on it once release 8.0 is out |
@lperron yes, that should be possible. I'll take a look at it tomorrow and see what I come up with. |
Hopefully it is alright that I went with Otherwise I'll just keep going down the list I made of outstanding issues. |
@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. |
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! |
@Mizux Any updates on this? I am willing to put in work to add Golang support for constraint solver. |
What about this? ;-) |
Hi sorry for the delay... |
Hi. Any updates on this one ? |
None, too busy.
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le lun. 17 janv. 2022 à 13:38, piyushuber ***@***.***> a
écrit :
… Hi. Any updates on this one ?
—
Reply to this email directly, view it on GitHub
<#953 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3LUOENNZ44VFOI7CH3UWQEU3ANCNFSM4GHKMEZA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I'm hoping this is in the future as well, currently duct-taping calling python from Go, yuck. |
Hey, do you need any help with that? |
yes!!!
I pushed the CP-SAT go code and samples:
- code in ortools/sat/go with 2 cgo files and some go files
- samples in ortools/sat/samples/*go
It does not contain any build instruction. In particular, I do not know how
to package a go library that contains a significant C++ code.
Here is our badly exported BUILD file for reference in ortools/sat/go. Many
of the deps are wrong and should be fixed.
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 ?
],
)
If you are familiar with cmake, you can use cmake.
Thanks
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le jeu. 4 janv. 2024 à 12:13, Oleg Kovalov ***@***.***> a
écrit :
… Hey, do you need any help with that?
—
Reply to this email directly, view it on GitHub
<#953 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3MLL4TWJXRZIH7K32DYM2FG7AVCNFSM4GHKMEZKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBXGY4TEMRSHA4A>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
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 ?
],
) |
Has there been any it interest to support the or tools API in Go ?
EDIT:
Current implementation:
ToDo List:
The text was updated successfully, but these errors were encountered: