├── .bazelrc ├── .github └── workflows │ └── bazel-linux-workflow.yaml ├── .gitignore ├── BUILD.bazel ├── DEVELOPMENT.md ├── LICENSE ├── README.md ├── WORKSPACE ├── go.mod ├── go.sum ├── ortools.go ├── ortools_test.go ├── ortoolsswig ├── BUILD.bazel ├── linear_solver.i ├── linear_solver_go_wrap.cc ├── ortoolsswig.go ├── ortoolsswig_doc.go └── ortoolsswig_test.go └── third_party ├── BUILD.bazel ├── bazel-swig.sh ├── pcre.BUILD ├── scip.BUILD └── swig.BUILD /.bazelrc: -------------------------------------------------------------------------------- 1 | # For Abseil. 2 | # See https://chromium.googlesource.com/external/github.com/abseil/abseil-cpp/+/930fbec75b452af8bb8c796f5bb754e953e29cf5/FAQ.md#how-to-i-set-the-c_dialect-used-to-build-abseil 3 | build --cxxopt=-std=c++17 4 | -------------------------------------------------------------------------------- /.github/workflows/bazel-linux-workflow.yaml: -------------------------------------------------------------------------------- 1 | name: Bazel Build Linux 2 | on: [push, pull_request] 3 | jobs: 4 | "Build-and-test": 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v3 8 | - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." 9 | - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" 10 | - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." 11 | - name: Check out repository code 12 | uses: actions/checkout@v3 13 | - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." 14 | - run: echo "🖥️ The workflow is now ready to test your code on the runner." 15 | - name: Mount bazel cache # Optional 16 | uses: actions/cache@v3 17 | with: 18 | path: "~/.cache/bazel" 19 | key: bazel 20 | - name: "Bazel build" 21 | run: bazel build //... 22 | - name: "Bazel test" 23 | run: bazel test //... 24 | - run: echo "🍏 This job's status is ${{ job.status }}." 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # From https://github.com/orrsella/bazel-example/blob/master/.gitignore 2 | bazel-bazel-test 3 | bazel-bin 4 | bazel-genfiles 5 | bazel-out 6 | bazel-ortoolsgo 7 | bazel-or-tools-go 8 | bazel-testlogs -------------------------------------------------------------------------------- /BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 2 | load("@bazel_gazelle//:def.bzl", "gazelle") 3 | 4 | # gazelle:prefix github.com/gonzojive/or-tools-go/ortools 5 | # gazelle:exclude node_modules 6 | # gazelle:exclude bazel-out 7 | gazelle(name = "gazelle") 8 | 9 | go_library( 10 | name = "go_default_library", 11 | srcs = ["ortools.go"], 12 | importpath = "github.com/gonzojive/or-tools-go/ortools", 13 | visibility = ["//visibility:public"], 14 | deps = ["//ortoolsswig:go_default_library"], 15 | ) 16 | 17 | go_test( 18 | name = "go_default_test", 19 | srcs = ["ortools_test.go"], 20 | embed = [":go_default_library"], 21 | deps = [ 22 | "@com_github_google_go_cmp//cmp:go_default_library", 23 | "@com_github_google_go_cmp//cmp/cmpopts:go_default_library", 24 | ], 25 | ) 26 | -------------------------------------------------------------------------------- /DEVELOPMENT.md: -------------------------------------------------------------------------------- 1 | ## Internal development notes 2 | 3 | Useful commands: 4 | 5 | Run a local godoc server 6 | 7 | ```shell 8 | godoc -http=":6061" 9 | `` 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright 2010 Google LLC 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## OR tools for golang 2 | 3 | This project contains a cgo-based API for using Google's Operations Research 4 | tools. Code is generated in the `ortoolsswig` folder, but the generated code is 5 | ugly, so most people will want to use the `ortoolsgo` package, which is written 6 | on top of the swig bindings. 7 | 8 | The library compiles with bazel. For example, the tests can be run with this 9 | command: 10 | 11 | ```shell 12 | ibazel test //ortoolsswig:go_default_test 13 | ``` 14 | 15 | ### Regenerating the SWIG bindings 16 | 17 | For now, some generated files are checked in. They can be regenerated using this 18 | command if or-tools and abseil-cpp are checked out: 19 | 20 | ```shell 21 | bazel run //third_party:bazel-swig -- \ 22 | -v -go -cgo -c++ -intgosize 64 \ 23 | -I/home/red/git/or-tools \ 24 | -I/home/red/git/abseil-cpp \ 25 | -o /home/red/git/or-tools-go/ortoolsswig/linear_solver_go_wrap.cc \ 26 | -module ortoolsswig \ 27 | /home/red/git/or-tools-go/ortoolsswig/linear_solver.i 28 | ``` 29 | 30 | It will be necessary to clone absl and or-tools: 31 | 32 | https://github.com/abseil/abseil-cpp.git 33 | 34 | https://github.com/google/or-tools.git 35 | -------------------------------------------------------------------------------- /WORKSPACE: -------------------------------------------------------------------------------- 1 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 2 | load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository") 3 | 4 | # local_repository( 5 | # name = "ortools", 6 | # path = "/home/red/git/or-tools-fork", 7 | # ) 8 | 9 | git_repository( 10 | name = "ortools", 11 | commit = "49b6301e1e1e231d654d79b6032e79809868a70e", 12 | remote = "https://github.com/google/or-tools.git", 13 | ) 14 | 15 | # Eigen has no Bazel build. 16 | new_git_repository( 17 | name = "eigen", 18 | tag = "3.4.0", 19 | remote = "https://gitlab.com/libeigen/eigen.git", 20 | build_file_content = 21 | """ 22 | cc_library( 23 | name = 'eigen3', 24 | srcs = [], 25 | includes = ['.'], 26 | hdrs = glob(['Eigen/**']), 27 | visibility = ['//visibility:public'], 28 | ) 29 | """ 30 | ) 31 | 32 | # TODO(reddaly): Migrate to rules_cc: https://github.com/bazelbuild/rules_cc 33 | 34 | 35 | git_repository( 36 | name = "com_github_gflags_gflags", 37 | commit = "e171aa2", # release v2.2.2 38 | remote = "https://github.com/gflags/gflags.git", 39 | ) 40 | 41 | git_repository( 42 | name = "com_github_glog_glog", 43 | commit = "96a2f23", # release v0.4.0 44 | remote = "https://github.com/google/glog.git", 45 | ) 46 | 47 | http_archive( 48 | name = "bazel_skylib", 49 | urls = [ 50 | "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz", 51 | "https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz", 52 | ], 53 | sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728", 54 | ) 55 | 56 | git_repository( 57 | name = "com_google_protobuf", 58 | commit = "e73ed1630fdec85d7fb513c166629ed49cd4eb18", # release v21 59 | remote = "https://github.com/protocolbuffers/protobuf.git", 60 | ) 61 | 62 | git_repository( 63 | name = "com_google_protobuf_cc", 64 | commit = "e73ed1630fdec85d7fb513c166629ed49cd4eb18", # release v3.14.0 65 | remote = "https://github.com/protocolbuffers/protobuf.git", 66 | ) 67 | 68 | git_repository( 69 | name = "com_google_absl", 70 | commit = "215105818dfde3174fe799600bb0f3cae233d0bf", # release 20211102.0 71 | remote = "https://github.com/abseil/abseil-cpp.git", 72 | ) 73 | 74 | git_repository( 75 | name = "rules_cc", 76 | remote = "https://github.com/bazelbuild/rules_cc.git", 77 | commit = "8bb0eb5c5ccd96b91753bb112096bb6993d16d13", 78 | shallow_since = "1652890817 -0700", 79 | ) 80 | 81 | 82 | load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") 83 | bazel_skylib_workspace() 84 | 85 | load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains") 86 | 87 | rules_cc_dependencies() 88 | 89 | rules_cc_toolchains() 90 | 91 | load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") 92 | 93 | # Load common dependencies. 94 | protobuf_deps() 95 | 96 | http_archive( 97 | name = "gtest", 98 | build_file = "//bazel:gtest.BUILD", 99 | strip_prefix = "googletest-release-1.8.0/googletest", 100 | url = "https://github.com/google/googletest/archive/release-1.8.0.zip", 101 | ) 102 | 103 | 104 | http_archive( 105 | name = "glpk", 106 | build_file = "@ortools//bazel:glpk.BUILD", 107 | sha256 = "9a5dab356268b4f177c33e00ddf8164496dc2434e83bd1114147024df983a3bb", 108 | url = "http://ftp.gnu.org/gnu/glpk/glpk-4.52.tar.gz", 109 | ) 110 | 111 | new_git_repository( 112 | name = "scip", 113 | build_file = "//third_party:scip.BUILD", 114 | patches = ["@ortools//bazel:scip.patch"], 115 | patch_args = ["-p1"], 116 | tag = "v800", 117 | remote = "https://github.com/scipopt/scip.git", 118 | ) 119 | 120 | http_archive( 121 | name = "bliss", 122 | build_file = "@ortools//bazel:bliss.BUILD", 123 | patches = ["@ortools//bazel:bliss-0.73.patch"], 124 | sha256 = "f57bf32804140cad58b1240b804e0dbd68f7e6bf67eba8e0c0fa3a62fd7f0f84", 125 | url = "http://www.tcs.hut.fi/Software/bliss/bliss-0.73.zip", 126 | ) 127 | 128 | http_archive( 129 | name = "zlib", 130 | build_file = "@com_google_protobuf//:third_party/zlib.BUILD", 131 | sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1", 132 | strip_prefix = "zlib-1.2.11", 133 | urls = [ 134 | "https://mirror.bazel.build/zlib.net/zlib-1.2.11.tar.gz", 135 | "https://zlib.net/zlib-1.2.11.tar.gz", 136 | ], 137 | ) 138 | 139 | # Go stuff 140 | http_archive( 141 | name = "io_bazel_rules_go", 142 | sha256 = "ab21448cef298740765f33a7f5acee0607203e4ea321219f2a4c85a6e0fb0a27", 143 | urls = [ 144 | "https://github.com/bazelbuild/rules_go/releases/download/v0.32.0/rules_go-v0.32.0.zip", 145 | # "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.32.0/rules_go-v0.32.0.zip", 146 | ], 147 | ) 148 | 149 | http_archive( 150 | name = "bazel_gazelle", 151 | sha256 = "5982e5463f171da99e3bdaeff8c0f48283a7a5f396ec5282910b9e8a49c0dd7e", 152 | urls = [ 153 | "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz", 154 | "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz", 155 | ], 156 | ) 157 | 158 | load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") 159 | load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") 160 | 161 | go_rules_dependencies() 162 | 163 | go_register_toolchains(version = "1.18.2") 164 | 165 | gazelle_dependencies() 166 | 167 | # git_repository( 168 | # name = "com_github_swig_swig", 169 | # commit = "8b572399d72f3d812165e0975498c930ae822a4f", 170 | # remote = "https://github.com/swig/swig.git", 171 | # ) 172 | 173 | http_archive( 174 | name = "swig", 175 | build_file = "//third_party:swig.BUILD", 176 | sha256 = "58a475dbbd4a4d7075e5fe86d4e54c9edde39847cdb96a3053d87cb64a23a453", 177 | strip_prefix = "swig-3.0.8", 178 | urls = [ 179 | "https://storage.googleapis.com/mirror.tensorflow.org/ufpr.dl.sourceforge.net/project/swig/swig/swig-3.0.8/swig-3.0.8.tar.gz", 180 | "https://ufpr.dl.sourceforge.net/project/swig/swig/swig-3.0.8/swig-3.0.8.tar.gz", 181 | "https://pilotfiber.dl.sourceforge.net/project/swig/swig/swig-3.0.8/swig-3.0.8.tar.gz", 182 | ], 183 | ) 184 | 185 | #new_git_repository( 186 | # name = "swig", 187 | # remote = "https://github.com/swig/swig.git", 188 | # commit = "1d6f4b4eaeb71a7f1cfadf6358436fbb55cb47cb", 189 | # build_file = "//third_party:swig.BUILD", 190 | #) 191 | 192 | http_archive( 193 | name = "pcre", 194 | build_file = "//third_party:pcre.BUILD", 195 | sha256 = "69acbc2fbdefb955d42a4c606dfde800c2885711d2979e356c0636efde9ec3b5", 196 | strip_prefix = "pcre-8.42", 197 | urls = [ 198 | "https://storage.googleapis.com/mirror.tensorflow.org/ftp.exim.org/pub/pcre/pcre-8.42.tar.gz", 199 | "https://ftp.exim.org/pub/pcre/pcre-8.42.tar.gz", 200 | ], 201 | ) 202 | 203 | go_repository( 204 | name = "com_github_google_go_cmp", 205 | importpath = "github.com/google/go-cmp", 206 | sum = "h1:/exdXoGamhu5ONeUJH0deniYLWYvQwW66yvlfiiKTu0=", 207 | version = "v0.4.1", 208 | ) 209 | 210 | go_repository( 211 | name = "org_golang_x_xerrors", 212 | importpath = "golang.org/x/xerrors", 213 | sum = "h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=", 214 | version = "v0.0.0-20191204190536-9bdfabe68543", 215 | ) 216 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/gonzojive/or-tools-go/ortools 2 | 3 | go 1.14 4 | 5 | require github.com/google/go-cmp v0.4.1 6 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/google/go-cmp v0.4.1 h1:/exdXoGamhu5ONeUJH0deniYLWYvQwW66yvlfiiKTu0= 2 | github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 3 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= 4 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 5 | -------------------------------------------------------------------------------- /ortools.go: -------------------------------------------------------------------------------- 1 | // Package ortools is a go library for Google's Operations Research tools. 2 | // 3 | // Currently bindings are only provided for the linear solver. 4 | package ortools 5 | 6 | import ( 7 | "fmt" 8 | 9 | "github.com/gonzojive/or-tools-go/ortools/ortoolsswig" 10 | ) 11 | 12 | // ProblemType is a type of OptimizationProblemType supported by the OR Tools library. 13 | type ProblemType string 14 | 15 | // swigEnum returns the SWIG version of the enum. 16 | func (pt ProblemType) swigEnum() ortoolsswig.Operations_researchMPSolverOptimizationProblemType { 17 | switch pt { 18 | case LinearProgramming: 19 | return ortoolsswig.SolverGLOP_LINEAR_PROGRAMMING 20 | default: 21 | return 0 22 | } 23 | } 24 | 25 | // ProblemType definitions 26 | const ( 27 | LinearProgramming ProblemType = "LinearProgrammingProblemType" 28 | ) 29 | 30 | // Solver is the main type though which users build and solve problems. 31 | // 32 | // This is based on 33 | // https://developers.google.com/optimization/reference/linear_solver/linear_solver/MPSolver. 34 | type Solver struct { 35 | s ortoolsswig.Solver 36 | } 37 | 38 | // NewSolver returns a new solver. 39 | func NewSolver(name string, problemType ProblemType) *Solver { 40 | return &Solver{ 41 | ortoolsswig.NewSolver(name, problemType.swigEnum()), 42 | } 43 | } 44 | 45 | // Close closes the solver. This must be called after NewSolver(). 46 | func (s *Solver) Close() error { 47 | ortoolsswig.DeleteSolver(s.s) 48 | return nil 49 | } 50 | 51 | // Objective returns the objective object. Note that the objective is owned by 52 | // the solver, and is initialized to its default value (see the MPObjective 53 | // class) at construction. 54 | func (s *Solver) Objective() *Objective { 55 | return &Objective{s.s.Objective()} 56 | } 57 | 58 | // NewVar creates a variable with the given bounds, integrality requirement and 59 | // name. Bounds can be finite or +/- MPSolver::infinity(). The MPSolver owns the 60 | // variable (i.e. the returned pointer is borrowed). Variable names are 61 | // optional. If you give an empty name, name() will auto-generate one for you 62 | // upon request. 63 | func (s *Solver) NewVar(lowBound, upBound float64, integer bool, name string) *Variable { 64 | return &Variable{s.s.Var(lowBound, upBound, integer, name)} 65 | } 66 | 67 | // NewConstraintBounded returns a linear constraint with given bounds. 68 | // 69 | // Bounds can be finite or +/- MPSolver::infinity(). The MPSolver class assumes 70 | // ownership of the constraint. 71 | func (s *Solver) NewConstraintBounded(lowBound, upBound float64, name string) *Constraint { 72 | return &Constraint{s.s.Constraint(lowBound, upBound, name)} 73 | } 74 | 75 | // NumVariables returns the number of variable being optimized by the solver. 76 | func (s *Solver) NumVariables() int { 77 | return s.s.NumVariables() 78 | } 79 | 80 | // NumConstraints returns the number of constraints. 81 | func (s *Solver) NumConstraints() int { 82 | return s.s.NumConstraints() 83 | } 84 | 85 | // Solve solves the problem using the default parameter values. 86 | func (s *Solver) Solve() error { 87 | code := s.s.Solve() 88 | switch code { 89 | case ortoolsswig.SolverStatusOptimal: 90 | return nil 91 | case ortoolsswig.SolverStatusAbnormal: 92 | return fmt.Errorf("solver returned abnormal status code; this could be a numerical problem in the formulation or some other problem") 93 | case ortoolsswig.SolverStatusFeasible: 94 | case ortoolsswig.SolverStatusInfeasible: 95 | case ortoolsswig.SolverStatusNotSolved: 96 | case ortoolsswig.SolverStatusUnbounded: 97 | default: 98 | } 99 | return fmt.Errorf("unhandled status code %v", code) 100 | } 101 | 102 | // Variable is a variable to be optimized by the solver. 103 | type Variable struct { 104 | v ortoolsswig.Variable 105 | } 106 | 107 | // SolutionValue returns the value of the variable in the current solution. 108 | // 109 | // If the variable is integer, then the value will always be an integer (the 110 | // underlying solver handles floating-point values only, but this function 111 | // automatically rounds it to the nearest integer; see: man 3 round). 112 | func (v *Variable) SolutionValue() float64 { 113 | return v.v.SolutionValue() 114 | } 115 | 116 | // Objective is the objective function to be optmized. 117 | type Objective struct { 118 | o ortoolsswig.Objective 119 | } 120 | 121 | // SetMaximization sets the optimization direction to maximize. 122 | func (o *Objective) SetMaximization() { 123 | o.o.SetMaximization() 124 | } 125 | 126 | // SetMinimization sets the optimization direction to minimize. 127 | func (o *Objective) SetMinimization() { 128 | o.o.SetMinimization() 129 | } 130 | 131 | // SetCoefficient sets the coefficient of the variable in the objective. If the 132 | // variable does not belong to the solver, the function just returns, or crashes 133 | // in non-opt mode. 134 | func (o *Objective) SetCoefficient(v *Variable, coeff float64) { 135 | o.o.SetCoefficient(v.v, coeff) 136 | } 137 | 138 | // Value returns the objective value of the best solution found so far. It is 139 | // the optimal objective value if the problem has been solved to optimality. 140 | // Note: the objective value may be slightly different than what you could 141 | // compute yourself using \c MPVariable::solution_value(); please use the 142 | // --verify_solution flag to gain confidence about the numerical stability of 143 | // your solution. 144 | func (o *Objective) Value() float64 { 145 | return o.o.Value() 146 | } 147 | 148 | // Constraint is used for setting linear programming bounds. 149 | type Constraint struct { 150 | c ortoolsswig.Constraint 151 | } 152 | 153 | // SetCoefficient sets the coefficient of the variable on the constraint. 154 | // 155 | // If the variable does not belong to the solver, the function just returns, or 156 | // crashes in non-opt mode. 157 | func (c *Constraint) SetCoefficient(v *Variable, coeff float64) { 158 | c.c.SetCoefficient(v.v, coeff) 159 | } 160 | -------------------------------------------------------------------------------- /ortools_test.go: -------------------------------------------------------------------------------- 1 | package ortools 2 | 3 | import ( 4 | "math" 5 | "testing" 6 | 7 | "github.com/google/go-cmp/cmp" 8 | "github.com/google/go-cmp/cmp/cmpopts" 9 | ) 10 | 11 | var ( 12 | cmpOpts = []cmp.Option{ 13 | cmpopts.EquateApprox(1e-4, 1e-4), 14 | } 15 | ) 16 | 17 | func TestNewSolver(t *testing.T) { 18 | tests := []struct { 19 | name string 20 | got, want interface{} 21 | }{ 22 | {"test 1", "a", "a"}, 23 | } 24 | for _, tt := range tests { 25 | t.Run(tt.name, func(t *testing.T) { 26 | if diff := cmp.Diff(tt.want, tt.got); diff != "" { 27 | t.Errorf("unexpected diff (-want, +got):\n%s", diff) 28 | } 29 | }) 30 | } 31 | } 32 | 33 | // TestSolver is based on https://developers.google.com/optimization/lp/glop. 34 | func TestSolver(t *testing.T) { 35 | solver := NewSolver("LinearProgrammingExample", LinearProgramming) 36 | defer solver.Close() 37 | x := solver.NewVar(0, math.Inf(1), false, "x") 38 | y := solver.NewVar(0, math.Inf(1), false, "y") 39 | 40 | // Constraint 0: x + 2y <= 14. 41 | constraint0 := solver.NewConstraintBounded(math.Inf(-1), float64(14), "c0") 42 | //constraint0 := solver.NewConstraintBounded() 43 | constraint0.SetCoefficient(x, 1) 44 | constraint0.SetCoefficient(y, 2) 45 | 46 | // Constraint 1: 3x - y >= 0. 47 | constraint1 := solver.NewConstraintBounded(0.0, math.Inf(1), "c1") 48 | constraint1.SetCoefficient(x, 3) 49 | constraint1.SetCoefficient(y, -1) 50 | 51 | // Constraint 2: x - y <= 2. 52 | constraint2 := solver.NewConstraintBounded(math.Inf(-1), 2.0, "c2") 53 | constraint2.SetCoefficient(x, 1) 54 | constraint2.SetCoefficient(y, -1) 55 | 56 | // Objective function: 3x + 4y. 57 | objective := solver.Objective() 58 | objective.SetCoefficient(x, 3) 59 | objective.SetCoefficient(y, 4) 60 | objective.SetMaximization() 61 | 62 | status := solver.Solve() 63 | t.Logf("solver status: %v", status) 64 | 65 | opt := 3*x.SolutionValue() + 4*y.SolutionValue() 66 | t.Logf("optimizal solution: 3 * %v + 4 * %v = %v", x.SolutionValue(), y.SolutionValue(), opt) 67 | 68 | if got, want := solver.NumVariables(), 2; got != want { 69 | t.Errorf("got %d variables, want %d", got, want) 70 | } 71 | if got, want := solver.NumConstraints(), 3; got != want { 72 | t.Errorf("got %d variables, want %d", got, want) 73 | } 74 | if got, want := x.SolutionValue(), 6.0; !cmp.Equal(got, want, cmpOpts...) { 75 | t.Errorf("got x_opt = %v, want %v", got, want) 76 | } 77 | if got, want := y.SolutionValue(), 4.0; !cmp.Equal(got, want, cmpOpts...) { 78 | t.Errorf("got y_opt = %v, want %v", got, want) 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /ortoolsswig/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 2 | 3 | go_library( 4 | name = "go_default_library", 5 | srcs = [ 6 | "linear_solver_go_wrap.cc", 7 | "ortoolsswig.go", 8 | "ortoolsswig_doc.go", 9 | ], 10 | cdeps = [ 11 | ":ortools_dependencies", 12 | ], 13 | cgo = True, 14 | cxxopts = [], 15 | importpath = "github.com/gonzojive/or-tools-go/ortools/ortoolsswig", 16 | visibility = ["//visibility:public"], 17 | ) 18 | 19 | cc_library( 20 | name = "ortools_dependencies", 21 | srcs = [], 22 | deps = [ 23 | "@com_google_absl//absl/status", 24 | "@com_google_absl//absl/strings", 25 | "@com_google_absl//absl/synchronization", 26 | "@com_google_absl//absl/types:optional", 27 | "@ortools//ortools/base", 28 | "@ortools//ortools/linear_solver", 29 | "@ortools//ortools/linear_solver:linear_solver_cc_proto", 30 | ], 31 | hdrs = [ 32 | "@ortools//ortools/linear_solver:model_exporter_swig_helper.h", 33 | ], 34 | copts = [], 35 | ) 36 | 37 | go_test( 38 | name = "go_default_test", 39 | srcs = ["ortoolsswig_test.go"], 40 | embed = [":go_default_library"], 41 | deps = [ 42 | "@com_github_google_go_cmp//cmp:go_default_library", 43 | "@com_github_google_go_cmp//cmp/cmpopts:go_default_library", 44 | ], 45 | ) 46 | -------------------------------------------------------------------------------- /ortoolsswig/linear_solver.i: -------------------------------------------------------------------------------- 1 | // Copyright 2010-2018 Google LLC 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | // This .i file exposes the linear programming and integer programming 15 | // 16 | // The python API is enriched by custom code defined here, making it 17 | // extremely intuitive, like: 18 | // solver = pywraplp.Solver( 19 | // 'Example Solver', pywraplp.Solver.GLOP_LINEAR_PROGRAMMING) 20 | // x1 = solver.NumVar(0.0, 1.0, 'x1') 21 | // x2 = solver.NumVar(-3.0, 2.0, 'x2') 22 | // c1 = solver.Add(2 * x1 - 3.2 * x2 + 1 <= 2.5) 23 | // solver.Maximize(10 * x1 + 6 * x2) 24 | // 25 | // USAGE EXAMPLES: 26 | // - examples/python/linear_programming.py 27 | // - ./pywraplp_test.py 28 | // 29 | // TODO(user): test all the APIs that are currently marked as 'untested'. 30 | 31 | // This file originally linear_solver/python/linear_solver.i 32 | 33 | %include "ortools/base/base.i" 34 | 35 | %include "std_string.i" 36 | %include "stdint.i" 37 | 38 | //%include "absl/base/options.h" 39 | //%include "absl/base/config.h" 40 | %include "absl/base/attributes.h" 41 | //include "absl/container/inlined_vector.h" 42 | //%include "absl/status/internal/status_internal.h" 43 | //%include "absl/strings/cord.h" 44 | //%include "absl/types/optional.h" 45 | //%include "absl/status/status.h" 46 | 47 | //%include "ortools/util/python/proto.i" 48 | 49 | //%import "ortools/util/python/vector.i" 50 | 51 | // We need to forward-declare the proto here, so that the PROTO_* macros 52 | // involving them work correctly. The order matters very much: this declaration 53 | // needs to be before the %{ #include ".../linear_solver.h" %}. 54 | namespace operations_research { 55 | class MPModelProto; 56 | class MPModelRequest; 57 | class MPSolutionResponse; 58 | } // namespace operations_research 59 | 60 | %{ 61 | #include "absl/status/status.h" 62 | //#include "ortools/glop/status.h" 63 | #include "ortools/linear_solver/linear_solver.h" 64 | #include "ortools/linear_solver/model_exporter.h" 65 | #include "ortools/linear_solver/model_exporter_swig_helper.h" 66 | #include "ortools/linear_solver/model_validator.h" 67 | 68 | typedef ::absl::Status Status; 69 | typedef int64_t int64; 70 | %} 71 | 72 | // %pythoncode %{ 73 | // import numbers 74 | // from ortools.linear_solver.linear_solver_natural_api import OFFSET_KEY 75 | // from ortools.linear_solver.linear_solver_natural_api import inf 76 | // from ortools.linear_solver.linear_solver_natural_api import LinearExpr 77 | // from ortools.linear_solver.linear_solver_natural_api import ProductCst 78 | // from ortools.linear_solver.linear_solver_natural_api import Sum 79 | // from ortools.linear_solver.linear_solver_natural_api import SumArray 80 | // from ortools.linear_solver.linear_solver_natural_api import SumCst 81 | // from ortools.linear_solver.linear_solver_natural_api import LinearConstraint 82 | // from ortools.linear_solver.linear_solver_natural_api import VariableExpr 83 | 84 | // # Remove the documentation of some functions. 85 | // # See https://pdoc3.github.io/pdoc/doc/pdoc/#overriding-docstrings-with- 86 | // __pdoc__ = {} 87 | // __pdoc__['Solver_infinity'] = False 88 | // __pdoc__['Solver_Infinity'] = False 89 | // __pdoc__['Solver_SolveWithProto'] = False 90 | // __pdoc__['Solver_SupportsProblemType'] = False 91 | // __pdoc__['setup_variable_operator'] = False 92 | // __pdoc__['Constraint.thisown'] = False 93 | // __pdoc__['Constraint.thisown'] = False 94 | // __pdoc__['MPSolverParameters.thisown'] = False 95 | // __pdoc__['ModelExportOptions.thisown'] = False 96 | // __pdoc__['Objective.thisown'] = False 97 | // __pdoc__['Solver.thisown'] = False 98 | // __pdoc__['Variable.thisown'] = False 99 | // %} // %pythoncode 100 | 101 | %extend operations_research::MPVariable { 102 | std::string __str__() { 103 | return $self->name(); 104 | } 105 | std::string __repr__() { 106 | return $self->name(); 107 | } 108 | 109 | // %pythoncode { 110 | // def __getattr__(self, name): 111 | // return getattr(VariableExpr(self), name) 112 | // } // %pythoncode 113 | } 114 | 115 | %extend operations_research::MPSolver { 116 | // Change the API of LoadModelFromProto() to simply return the error message: 117 | // it will always be empty iff the model was valid. 118 | std::string LoadModelFromProto(const operations_research::MPModelProto& input_model) { 119 | std::string error_message; 120 | $self->LoadModelFromProto(input_model, &error_message); 121 | return error_message; 122 | } 123 | 124 | std::string ExportModelAsLpFormat(bool obfuscated) { 125 | operations_research::MPModelExportOptions options; 126 | options.obfuscate = obfuscated; 127 | operations_research::MPModelProto model; 128 | $self->ExportModelToProto(&model); 129 | return ExportModelAsLpFormat(model, options).value_or(""); 130 | } 131 | 132 | std::string ExportModelAsMpsFormat(bool fixed_format, bool obfuscated) { 133 | operations_research::MPModelExportOptions options; 134 | options.obfuscate = obfuscated; 135 | operations_research::MPModelProto model; 136 | $self->ExportModelToProto(&model); 137 | return ExportModelAsMpsFormat(model, options).value_or(""); 138 | } 139 | 140 | /// Set a hint for solution. 141 | /// 142 | /// If a feasible or almost-feasible solution to the problem is already known, 143 | /// it may be helpful to pass it to the solver so that it can be used. A 144 | /// solver that supports this feature will try to use this information to 145 | /// create its initial feasible solution. 146 | /// 147 | /// Note that it may not always be faster to give a hint like this to the 148 | /// solver. There is also no guarantee that the solver will use this hint or 149 | /// try to return a solution "close" to this assignment in case of multiple 150 | /// optimal solutions. 151 | void SetHint(const std::vector& variables, 152 | const std::vector& values) { 153 | if (variables.size() != values.size()) { 154 | LOG(FATAL) << "Different number of variables and values when setting " 155 | << "hint."; 156 | } 157 | std::vector > 158 | hint(variables.size()); 159 | for (int i = 0; i < variables.size(); ++i) { 160 | hint[i] = std::make_pair(variables[i], values[i]); 161 | } 162 | $self->SetHint(hint); 163 | } 164 | 165 | /// Sets the number of threads to be used by the solver. 166 | bool SetNumThreads(int num_theads) { 167 | return $self->SetNumThreads(num_theads).ok(); 168 | } 169 | 170 | // %pythoncode { 171 | // def Add(self, constraint, name=''): 172 | // if isinstance(constraint, bool): 173 | // if constraint: 174 | // return self.RowConstraint(0, 0, name) 175 | // else: 176 | // return self.RowConstraint(1, 1, name) 177 | // else: 178 | // return constraint.Extract(self, name) 179 | 180 | // def Sum(self, expr_array): 181 | // result = SumArray(expr_array) 182 | // return result 183 | 184 | // def RowConstraint(self, *args): 185 | // return self.Constraint(*args) 186 | 187 | // def Minimize(self, expr): 188 | // objective = self.Objective() 189 | // objective.Clear() 190 | // objective.SetMinimization() 191 | // if isinstance(expr, numbers.Number): 192 | // objective.SetOffset(expr) 193 | // else: 194 | // coeffs = expr.GetCoeffs() 195 | // objective.SetOffset(coeffs.pop(OFFSET_KEY, 0.0)) 196 | // for v, c, in list(coeffs.items()): 197 | // objective.SetCoefficient(v, float(c)) 198 | 199 | // def Maximize(self, expr): 200 | // objective = self.Objective() 201 | // objective.Clear() 202 | // objective.SetMaximization() 203 | // if isinstance(expr, numbers.Number): 204 | // objective.SetOffset(expr) 205 | // else: 206 | // coeffs = expr.GetCoeffs() 207 | // objective.SetOffset(coeffs.pop(OFFSET_KEY, 0.0)) 208 | // for v, c, in list(coeffs.items()): 209 | // objective.SetCoefficient(v, float(c)) 210 | // } // %pythoncode 211 | 212 | // Catch runtime exceptions in class methods 213 | %exception operations_research::MPSolver { 214 | try { 215 | $action 216 | } catch ( std::runtime_error& e ) { 217 | SWIG_exception(SWIG_RuntimeError, e.what()); 218 | } 219 | } 220 | 221 | 222 | static double Infinity() { return operations_research::MPSolver::infinity(); } 223 | void SetTimeLimit(int64 x) { $self->set_time_limit(x); } 224 | int64 WallTime() const { return $self->wall_time(); } 225 | int64 Iterations() const { return $self->iterations(); } 226 | } // extend operations_research::MPSolver 227 | 228 | %extend operations_research::MPVariable { 229 | double SolutionValue() const { return $self->solution_value(); } 230 | bool Integer() const { return $self->integer(); } 231 | double Lb() const { return $self->lb(); } 232 | double Ub() const { return $self->ub(); } 233 | void SetLb(double x) { $self->SetLB(x); } 234 | void SetUb(double x) { $self->SetUB(x); } 235 | double ReducedCost() const { return $self->reduced_cost(); } 236 | } // extend operations_research::MPVariable 237 | 238 | %extend operations_research::MPConstraint { 239 | double Lb() const { return $self->lb(); } 240 | double Ub() const { return $self->ub(); } 241 | void SetLb(double x) { $self->SetLB(x); } 242 | void SetUb(double x) { $self->SetUB(x); } 243 | double DualValue() const { return $self->dual_value(); } 244 | } // extend operations_research::MPConstraint 245 | 246 | %extend operations_research::MPObjective { 247 | double Offset() const { return $self->offset();} 248 | } // extend operations_research::MPObjective 249 | 250 | // PY_PROTO_TYPEMAP(ortools.linear_solver.linear_solver_pb2, 251 | // MPModelProto, 252 | // operations_research::MPModelProto); 253 | 254 | // PY_PROTO_TYPEMAP(ortools.linear_solver.linear_solver_pb2, 255 | // MPSolutionResponse, 256 | // operations_research::MPSolutionResponse); 257 | 258 | // // Actual conversions. This also includes the conversion to std::vector. 259 | // PY_CONVERT_HELPER_PTR(MPConstraint); 260 | // PY_CONVERT(MPConstraint); 261 | 262 | // PY_CONVERT_HELPER_PTR(MPVariable); 263 | // PY_CONVERT(MPVariable); 264 | 265 | %ignoreall 266 | 267 | %unignore operations_research; 268 | 269 | // Strip the "MP" prefix from the exposed classes. 270 | %rename (Solver) operations_research::MPSolver; 271 | %rename (Solver) operations_research::MPSolver::MPSolver; 272 | %rename (Constraint) operations_research::MPConstraint; 273 | %rename (Variable) operations_research::MPVariable; 274 | %rename (Objective) operations_research::MPObjective; 275 | 276 | // Expose the MPSolver::OptimizationProblemType enum. 277 | %unignore operations_research::MPSolver::OptimizationProblemType; 278 | %unignore operations_research::MPSolver::GLOP_LINEAR_PROGRAMMING; 279 | %unignore operations_research::MPSolver::CLP_LINEAR_PROGRAMMING; 280 | %unignore operations_research::MPSolver::GLPK_LINEAR_PROGRAMMING; 281 | %unignore operations_research::MPSolver::SCIP_MIXED_INTEGER_PROGRAMMING; 282 | %unignore operations_research::MPSolver::CBC_MIXED_INTEGER_PROGRAMMING; 283 | %unignore operations_research::MPSolver::GLPK_MIXED_INTEGER_PROGRAMMING; 284 | %unignore operations_research::MPSolver::BOP_INTEGER_PROGRAMMING; 285 | %unignore operations_research::MPSolver::SAT_INTEGER_PROGRAMMING; 286 | // These aren't unit tested, as they only run on machines with a Gurobi license. 287 | %unignore operations_research::MPSolver::GUROBI_LINEAR_PROGRAMMING; 288 | %unignore operations_research::MPSolver::GUROBI_MIXED_INTEGER_PROGRAMMING; 289 | %unignore operations_research::MPSolver::CPLEX_LINEAR_PROGRAMMING; 290 | %unignore operations_research::MPSolver::CPLEX_MIXED_INTEGER_PROGRAMMING; 291 | %unignore operations_research::MPSolver::XPRESS_LINEAR_PROGRAMMING; 292 | %unignore operations_research::MPSolver::XPRESS_MIXED_INTEGER_PROGRAMMING; 293 | 294 | 295 | // Expose the MPSolver::ResultStatus enum. 296 | %unignore operations_research::MPSolver::ResultStatus; 297 | %unignore operations_research::MPSolver::OPTIMAL; 298 | %unignore operations_research::MPSolver::FEASIBLE; // No unit test 299 | %unignore operations_research::MPSolver::INFEASIBLE; 300 | %unignore operations_research::MPSolver::UNBOUNDED; // No unit test 301 | %unignore operations_research::MPSolver::ABNORMAL; 302 | %unignore operations_research::MPSolver::NOT_SOLVED; // No unit test 303 | %rename (SolverStatus) operations_research::MPSolver::ResultStatus; 304 | %rename (StatusOptimal) operations_research::MPSolver::OPTIMAL; 305 | %rename (StatusFeasible) operations_research::MPSolver::FEASIBLE; // No unit test 306 | %rename (StatusInfeasible) operations_research::MPSolver::INFEASIBLE; 307 | %rename (StatusUnbounded) operations_research::MPSolver::UNBOUNDED; // No unit test 308 | %rename (StatusAbnormal) operations_research::MPSolver::ABNORMAL; 309 | %rename (StatusNotSolved) operations_research::MPSolver::NOT_SOLVED; // No unit test 310 | 311 | // Expose the MPSolver's basic API, with some renames. 312 | %rename (Objective) operations_research::MPSolver::MutableObjective; 313 | %rename (BoolVar) operations_research::MPSolver::MakeBoolVar; // No unit test 314 | %rename (IntVar) operations_research::MPSolver::MakeIntVar; 315 | %rename (NumVar) operations_research::MPSolver::MakeNumVar; 316 | %rename (Var) operations_research::MPSolver::MakeVar; 317 | // We intentionally don't expose MakeRowConstraint(LinearExpr), because this 318 | // "natural language" API is specific to C++: other languages may add their own 319 | // syntactic sugar on top of MPSolver instead of this. 320 | %rename (Constraint) operations_research::MPSolver::MakeRowConstraint(double, double); 321 | %rename (Constraint) operations_research::MPSolver::MakeRowConstraint(); 322 | %rename (Constraint) operations_research::MPSolver::MakeRowConstraint(double, double, const std::string&); 323 | %rename (Constraint) operations_research::MPSolver::MakeRowConstraint(const std::string&); 324 | %unignore operations_research::MPSolver::~MPSolver; 325 | %unignore operations_research::MPSolver::Solve; 326 | %unignore operations_research::MPSolver::VerifySolution; 327 | %unignore operations_research::MPSolver::infinity; 328 | %unignore operations_research::MPSolver::set_time_limit; // No unit test 329 | 330 | // Proto-based API of the MPSolver. Use is encouraged. 331 | %unignore operations_research::MPSolver::SolveWithProto; 332 | %unignore operations_research::MPSolver::ExportModelToProto; 333 | %unignore operations_research::MPSolver::FillSolutionResponseProto; 334 | // LoadModelFromProto() is also visible: it's overridden by an %extend, above. 335 | %unignore operations_research::MPSolver::LoadSolutionFromProto; // No test 336 | 337 | // Expose some of the more advanced MPSolver API. 338 | %unignore operations_research::MPSolver::InterruptSolve; 339 | %unignore operations_research::MPSolver::SupportsProblemType; // No unit test 340 | %unignore operations_research::MPSolver::wall_time; // No unit test 341 | %unignore operations_research::MPSolver::Clear; // No unit test 342 | %unignore operations_research::MPSolver::constraints; 343 | %unignore operations_research::MPSolver::variables; 344 | %unignore operations_research::MPSolver::NumConstraints; 345 | %unignore operations_research::MPSolver::NumVariables; 346 | %unignore operations_research::MPSolver::EnableOutput; // No unit test 347 | %unignore operations_research::MPSolver::SuppressOutput; // No unit test 348 | %rename (LookupConstraint) 349 | operations_research::MPSolver::LookupConstraintOrNull; 350 | %rename (LookupVariable) operations_research::MPSolver::LookupVariableOrNull; 351 | %unignore operations_research::MPSolver::SetSolverSpecificParametersAsString; 352 | %unignore operations_research::MPSolver::NextSolution; 353 | // %unignore operations_research::MPSolver::ExportModelAsLpFormat; 354 | // %unignore operations_research::MPSolver::ExportModelAsMpsFormat; 355 | 356 | // Expose very advanced parts of the MPSolver API. For expert users only. 357 | %unignore operations_research::MPSolver::ComputeConstraintActivities; 358 | %unignore operations_research::MPSolver::ComputeExactConditionNumber; 359 | %unignore operations_research::MPSolver::nodes; 360 | %unignore operations_research::MPSolver::iterations; // No unit test 361 | %unignore operations_research::MPSolver::BasisStatus; 362 | %unignore operations_research::MPSolver::FREE; // No unit test 363 | %unignore operations_research::MPSolver::AT_LOWER_BOUND; 364 | %unignore operations_research::MPSolver::AT_UPPER_BOUND; 365 | %unignore operations_research::MPSolver::FIXED_VALUE; // No unit test 366 | %unignore operations_research::MPSolver::BASIC; 367 | 368 | // MPVariable: writer API. 369 | %unignore operations_research::MPVariable::SetLb; 370 | %unignore operations_research::MPVariable::SetUb; 371 | %unignore operations_research::MPVariable::SetBounds; 372 | %unignore operations_research::MPVariable::SetInteger; 373 | 374 | // MPVariable: reader API. 375 | %unignore operations_research::MPVariable::solution_value; 376 | %unignore operations_research::MPVariable::lb; 377 | %unignore operations_research::MPVariable::ub; 378 | %unignore operations_research::MPVariable::integer; // No unit test 379 | %unignore operations_research::MPVariable::name; // No unit test 380 | %unignore operations_research::MPVariable::index; // No unit test 381 | %unignore operations_research::MPVariable::basis_status; 382 | %unignore operations_research::MPVariable::reduced_cost; // For experts only. 383 | 384 | // MPConstraint: writer API. 385 | %unignore operations_research::MPConstraint::SetCoefficient; 386 | %unignore operations_research::MPConstraint::SetLb; 387 | %unignore operations_research::MPConstraint::SetUb; 388 | %unignore operations_research::MPConstraint::SetBounds; 389 | %unignore operations_research::MPConstraint::set_is_lazy; 390 | %unignore operations_research::MPConstraint::Clear; // No unit test 391 | 392 | // MPConstraint: reader API. 393 | %unignore operations_research::MPConstraint::GetCoefficient; 394 | %unignore operations_research::MPConstraint::lb; 395 | %unignore operations_research::MPConstraint::ub; 396 | %unignore operations_research::MPConstraint::name; 397 | %unignore operations_research::MPConstraint::index; 398 | %unignore operations_research::MPConstraint::basis_status; 399 | %unignore operations_research::MPConstraint::dual_value; // For experts only. 400 | 401 | // MPObjective: writer API. 402 | %unignore operations_research::MPObjective::SetCoefficient; 403 | %unignore operations_research::MPObjective::SetMinimization; 404 | %unignore operations_research::MPObjective::SetMaximization; 405 | %unignore operations_research::MPObjective::SetOptimizationDirection; 406 | %unignore operations_research::MPObjective::Clear; // No unit test 407 | %unignore operations_research::MPObjective::SetOffset; 408 | %unignore operations_research::MPObjective::AddOffset; // No unit test 409 | 410 | // MPObjective: reader API. 411 | %unignore operations_research::MPObjective::Value; 412 | %unignore operations_research::MPObjective::GetCoefficient; 413 | %unignore operations_research::MPObjective::minimization; 414 | %unignore operations_research::MPObjective::maximization; 415 | %unignore operations_research::MPObjective::offset; 416 | %unignore operations_research::MPObjective::Offset; 417 | %unignore operations_research::MPObjective::BestBound; 418 | 419 | // MPSolverParameters API. For expert users only. 420 | // TODO(user): also strip "MP" from the class name. 421 | %unignore operations_research::MPSolverParameters; 422 | %unignore operations_research::MPSolverParameters::MPSolverParameters; 423 | 424 | // Expose the MPSolverParameters::DoubleParam enum. 425 | %unignore operations_research::MPSolverParameters::DoubleParam; 426 | %unignore operations_research::MPSolverParameters::RELATIVE_MIP_GAP; 427 | %unignore operations_research::MPSolverParameters::PRIMAL_TOLERANCE; 428 | %unignore operations_research::MPSolverParameters::DUAL_TOLERANCE; 429 | %unignore operations_research::MPSolverParameters::GetDoubleParam; 430 | %unignore operations_research::MPSolverParameters::SetDoubleParam; 431 | %unignore operations_research::MPSolverParameters::kDefaultRelativeMipGap; 432 | %unignore operations_research::MPSolverParameters::kDefaultPrimalTolerance; 433 | %unignore operations_research::MPSolverParameters::kDefaultDualTolerance; 434 | // TODO(user): unit test kDefaultPrimalTolerance. 435 | 436 | // Expose the MPSolverParameters::IntegerParam enum. 437 | %unignore operations_research::MPSolverParameters::IntegerParam; 438 | %unignore operations_research::MPSolverParameters::PRESOLVE; 439 | %unignore operations_research::MPSolverParameters::LP_ALGORITHM; 440 | %unignore operations_research::MPSolverParameters::INCREMENTALITY; 441 | %unignore operations_research::MPSolverParameters::SCALING; 442 | %unignore operations_research::MPSolverParameters::GetIntegerParam; 443 | %unignore operations_research::MPSolverParameters::SetIntegerParam; 444 | %unignore operations_research::MPSolverParameters::RELATIVE_MIP_GAP; 445 | %unignore operations_research::MPSolverParameters::kDefaultPrimalTolerance; 446 | // TODO(user): unit test kDefaultPrimalTolerance. 447 | 448 | // Expose the MPSolverParameters::PresolveValues enum. 449 | %unignore operations_research::MPSolverParameters::PresolveValues; 450 | %unignore operations_research::MPSolverParameters::PRESOLVE_OFF; 451 | %unignore operations_research::MPSolverParameters::PRESOLVE_ON; 452 | %unignore operations_research::MPSolverParameters::kDefaultPresolve; 453 | 454 | // Expose the MPSolverParameters::LpAlgorithmValues enum. 455 | %unignore operations_research::MPSolverParameters::LpAlgorithmValues; 456 | %unignore operations_research::MPSolverParameters::DUAL; 457 | %unignore operations_research::MPSolverParameters::PRIMAL; 458 | %unignore operations_research::MPSolverParameters::BARRIER; 459 | 460 | // Expose the MPSolverParameters::IncrementalityValues enum. 461 | %unignore operations_research::MPSolverParameters::IncrementalityValues; 462 | %unignore operations_research::MPSolverParameters::INCREMENTALITY_OFF; 463 | %unignore operations_research::MPSolverParameters::INCREMENTALITY_ON; 464 | %unignore operations_research::MPSolverParameters::kDefaultIncrementality; 465 | 466 | // Expose the MPSolverParameters::ScalingValues enum. 467 | %unignore operations_research::MPSolverParameters::ScalingValues; 468 | %unignore operations_research::MPSolverParameters::SCALING_OFF; 469 | %unignore operations_research::MPSolverParameters::SCALING_ON; 470 | 471 | // Expose the model exporters. 472 | %rename (ModelExportOptions) operations_research::MPModelExportOptions; 473 | %rename (ModelExportOptions) operations_research::MPModelExportOptions::MPModelExportOptions; 474 | %rename (ExportModelAsLpFormat) operations_research::ExportModelAsLpFormatReturnString; 475 | %rename (ExportModelAsMpsFormat) operations_research::ExportModelAsMpsFormatReturnString; 476 | 477 | // Expose the model validator. 478 | %rename (FindErrorInModelProto) operations_research::FindErrorInMPModelProto; 479 | 480 | %include "ortools/linear_solver/linear_solver.h" 481 | %include "ortools/linear_solver/model_exporter.h" 482 | %include "ortools/linear_solver/model_exporter_swig_helper.h" 483 | 484 | namespace operations_research { 485 | std::string FindErrorInMPModelProto( 486 | const operations_research::MPModelProto& input_model); 487 | } // namespace operations_research 488 | 489 | %unignoreall 490 | -------------------------------------------------------------------------------- /ortoolsswig/ortoolsswig.go: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * This file was automatically generated by SWIG (http://www.swig.org). 3 | * Version 3.0.8 4 | * 5 | * This file is not intended to be easily readable and contains a number of 6 | * coding conventions designed to improve portability and efficiency. Do not make 7 | * changes to this file unless you know what you are doing--modify the SWIG 8 | * interface file instead. 9 | * ----------------------------------------------------------------------------- */ 10 | 11 | // source: /home/red/git/or-tools-go/ortoolsswig/linear_solver.i 12 | 13 | package ortoolsswig 14 | 15 | /* 16 | #define intgo swig_intgo 17 | typedef void *swig_voidp; 18 | 19 | #include 20 | 21 | 22 | typedef long long intgo; 23 | typedef unsigned long long uintgo; 24 | 25 | 26 | 27 | typedef struct { char *p; intgo n; } _gostring_; 28 | typedef struct { void* array; intgo len; intgo cap; } _goslice_; 29 | 30 | 31 | typedef _gostring_ swig_type_1; 32 | typedef _gostring_ swig_type_2; 33 | typedef _gostring_ swig_type_3; 34 | typedef _gostring_ swig_type_4; 35 | typedef _gostring_ swig_type_5; 36 | typedef _gostring_ swig_type_6; 37 | typedef _gostring_ swig_type_7; 38 | typedef _gostring_ swig_type_8; 39 | typedef _gostring_ swig_type_9; 40 | typedef _gostring_ swig_type_10; 41 | typedef long long swig_type_11; 42 | typedef long long swig_type_12; 43 | typedef long long swig_type_13; 44 | typedef long long swig_type_14; 45 | typedef _gostring_ swig_type_15; 46 | typedef _gostring_ swig_type_16; 47 | typedef _gostring_ swig_type_17; 48 | typedef _gostring_ swig_type_18; 49 | typedef _gostring_ swig_type_19; 50 | typedef _gostring_ swig_type_20; 51 | typedef _gostring_ swig_type_21; 52 | typedef _gostring_ swig_type_22; 53 | typedef _gostring_ swig_type_23; 54 | typedef _gostring_ swig_type_24; 55 | typedef _gostring_ swig_type_25; 56 | typedef _gostring_ swig_type_26; 57 | extern void _wrap_Swig_free_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 58 | extern swig_intgo _wrap_ABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE_ortoolsswig_fe88f1954daf0526(void); 59 | extern swig_intgo _wrap_CLP_LINEAR_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526(void); 60 | extern swig_intgo _wrap_GLPK_LINEAR_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526(void); 61 | extern swig_intgo _wrap_GLOP_LINEAR_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526(void); 62 | extern swig_intgo _wrap_SCIP_MIXED_INTEGER_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526(void); 63 | extern swig_intgo _wrap_GLPK_MIXED_INTEGER_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526(void); 64 | extern swig_intgo _wrap_CBC_MIXED_INTEGER_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526(void); 65 | extern swig_intgo _wrap_GUROBI_LINEAR_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526(void); 66 | extern swig_intgo _wrap_GUROBI_MIXED_INTEGER_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526(void); 67 | extern swig_intgo _wrap_CPLEX_LINEAR_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526(void); 68 | extern swig_intgo _wrap_CPLEX_MIXED_INTEGER_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526(void); 69 | extern swig_intgo _wrap_XPRESS_LINEAR_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526(void); 70 | extern swig_intgo _wrap_XPRESS_MIXED_INTEGER_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526(void); 71 | extern swig_intgo _wrap_BOP_INTEGER_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526(void); 72 | extern swig_intgo _wrap_SAT_INTEGER_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526(void); 73 | extern uintptr_t _wrap_new_Solver_ortoolsswig_fe88f1954daf0526(swig_type_1 arg1, swig_intgo arg2); 74 | extern void _wrap_delete_Solver_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 75 | extern _Bool _wrap_Solver_SupportsProblemType_ortoolsswig_fe88f1954daf0526(swig_intgo arg1); 76 | extern void _wrap_Solver_Clear_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 77 | extern swig_intgo _wrap_Solver_NumVariables_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 78 | extern uintptr_t _wrap_Solver_variables_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 79 | extern uintptr_t _wrap_Solver_LookupVariable_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, swig_type_2 arg2); 80 | extern uintptr_t _wrap_Solver_Var_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, double arg2, double arg3, _Bool arg4, swig_type_3 arg5); 81 | extern uintptr_t _wrap_Solver_NumVar_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, double arg2, double arg3, swig_type_4 arg4); 82 | extern uintptr_t _wrap_Solver_IntVar_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, double arg2, double arg3, swig_type_5 arg4); 83 | extern uintptr_t _wrap_Solver_BoolVar_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, swig_type_6 arg2); 84 | extern swig_intgo _wrap_Solver_NumConstraints_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 85 | extern uintptr_t _wrap_Solver_constraints_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 86 | extern uintptr_t _wrap_Solver_LookupConstraint_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, swig_type_7 arg2); 87 | extern uintptr_t _wrap_Solver_Constraint__SWIG_0_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, double arg2, double arg3); 88 | extern uintptr_t _wrap_Solver_Constraint__SWIG_1_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 89 | extern uintptr_t _wrap_Solver_Constraint__SWIG_2_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, double arg2, double arg3, swig_type_8 arg4); 90 | extern uintptr_t _wrap_Solver_Constraint__SWIG_3_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, swig_type_9 arg2); 91 | extern uintptr_t _wrap_Solver_Objective_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 92 | extern swig_intgo _wrap_StatusOptimal_Solver_ortoolsswig_fe88f1954daf0526(void); 93 | extern swig_intgo _wrap_StatusFeasible_Solver_ortoolsswig_fe88f1954daf0526(void); 94 | extern swig_intgo _wrap_StatusInfeasible_Solver_ortoolsswig_fe88f1954daf0526(void); 95 | extern swig_intgo _wrap_StatusUnbounded_Solver_ortoolsswig_fe88f1954daf0526(void); 96 | extern swig_intgo _wrap_StatusAbnormal_Solver_ortoolsswig_fe88f1954daf0526(void); 97 | extern swig_intgo _wrap_StatusNotSolved_Solver_ortoolsswig_fe88f1954daf0526(void); 98 | extern swig_intgo _wrap_Solver_Solve__SWIG_0_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 99 | extern swig_intgo _wrap_Solver_Solve__SWIG_1_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, uintptr_t arg2); 100 | extern uintptr_t _wrap_Solver_ComputeConstraintActivities_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 101 | extern _Bool _wrap_Solver_VerifySolution_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, double arg2, _Bool arg3); 102 | extern _Bool _wrap_Solver_InterruptSolve_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 103 | extern void _wrap_Solver_FillSolutionResponseProto_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, uintptr_t arg2); 104 | extern void _wrap_Solver_SolveWithProto__SWIG_0_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, uintptr_t arg2, uintptr_t arg3); 105 | extern void _wrap_Solver_SolveWithProto__SWIG_1_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, uintptr_t arg2); 106 | extern void _wrap_Solver_ExportModelToProto_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, uintptr_t arg2); 107 | extern uintptr_t _wrap_Solver_LoadSolutionFromProto__SWIG_0_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, uintptr_t arg2, double arg3); 108 | extern uintptr_t _wrap_Solver_LoadSolutionFromProto__SWIG_1_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, uintptr_t arg2); 109 | extern _Bool _wrap_Solver_SetSolverSpecificParametersAsString_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, swig_type_10 arg2); 110 | extern swig_intgo _wrap_FREE_Solver_ortoolsswig_fe88f1954daf0526(void); 111 | extern swig_intgo _wrap_AT_LOWER_BOUND_Solver_ortoolsswig_fe88f1954daf0526(void); 112 | extern swig_intgo _wrap_AT_UPPER_BOUND_Solver_ortoolsswig_fe88f1954daf0526(void); 113 | extern swig_intgo _wrap_FIXED_VALUE_Solver_ortoolsswig_fe88f1954daf0526(void); 114 | extern swig_intgo _wrap_BASIC_Solver_ortoolsswig_fe88f1954daf0526(void); 115 | extern double _wrap_Solver_infinity_ortoolsswig_fe88f1954daf0526(void); 116 | extern void _wrap_Solver_EnableOutput_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 117 | extern void _wrap_Solver_SuppressOutput_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 118 | extern swig_type_11 _wrap_Solver_iterations_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 119 | extern swig_type_12 _wrap_Solver_nodes_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 120 | extern double _wrap_Solver_ComputeExactConditionNumber_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 121 | extern _Bool _wrap_Solver_NextSolution_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 122 | extern void _wrap_Solver_set_time_limit_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, swig_type_13 arg2); 123 | extern swig_type_14 _wrap_Solver_wall_time_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 124 | extern swig_type_15 _wrap_Solver_LoadModelFromProto_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, uintptr_t arg2); 125 | extern swig_type_16 _wrap_Solver_ExportModelAsLpFormat_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, _Bool arg2); 126 | extern swig_type_17 _wrap_Solver_ExportModelAsMpsFormat_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, _Bool arg2, _Bool arg3); 127 | extern void _wrap_Solver_SetHint_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, uintptr_t arg2, uintptr_t arg3); 128 | extern _Bool _wrap_Solver_SetNumThreads_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, swig_intgo arg2); 129 | extern void _wrap_Solver_SetTimeLimit_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, uintptr_t arg2); 130 | extern uintptr_t _wrap_Solver_WallTime_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 131 | extern void _wrap_Objective_Clear_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 132 | extern void _wrap_Objective_SetCoefficient_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, uintptr_t arg2, double arg3); 133 | extern double _wrap_Objective_GetCoefficient_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, uintptr_t arg2); 134 | extern void _wrap_Objective_SetOffset_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, double arg2); 135 | extern double _wrap_Objective_offset_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 136 | extern void _wrap_Objective_SetOptimizationDirection_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, _Bool arg2); 137 | extern void _wrap_Objective_SetMinimization_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 138 | extern void _wrap_Objective_SetMaximization_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 139 | extern _Bool _wrap_Objective_maximization_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 140 | extern _Bool _wrap_Objective_minimization_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 141 | extern double _wrap_Objective_Value_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 142 | extern double _wrap_Objective_BestBound_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 143 | extern void _wrap_delete_Objective_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 144 | extern swig_type_18 _wrap_Variable_name_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 145 | extern void _wrap_Variable_SetInteger_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, _Bool arg2); 146 | extern _Bool _wrap_Variable_integer_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 147 | extern double _wrap_Variable_solution_value_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 148 | extern swig_intgo _wrap_Variable_index_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 149 | extern double _wrap_Variable_lb_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 150 | extern double _wrap_Variable_ub_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 151 | extern void _wrap_Variable_SetBounds_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, double arg2, double arg3); 152 | extern double _wrap_Variable_reduced_cost_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 153 | extern swig_intgo _wrap_Variable_basis_status_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 154 | extern swig_type_19 _wrap_Variable___str___ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 155 | extern swig_type_20 _wrap_Variable___repr___ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 156 | extern double _wrap_Variable_SolutionValue_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 157 | extern void _wrap_Variable_SetLb_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, double arg2); 158 | extern void _wrap_Variable_SetUb_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, double arg2); 159 | extern double _wrap_Variable_ReducedCost_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 160 | extern void _wrap_delete_Variable_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 161 | extern swig_type_21 _wrap_Constraint_name_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 162 | extern void _wrap_Constraint_Clear_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 163 | extern void _wrap_Constraint_SetCoefficient_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, uintptr_t arg2, double arg3); 164 | extern double _wrap_Constraint_GetCoefficient_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, uintptr_t arg2); 165 | extern double _wrap_Constraint_lb_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 166 | extern double _wrap_Constraint_ub_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 167 | extern void _wrap_Constraint_SetBounds_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, double arg2, double arg3); 168 | extern void _wrap_Constraint_set_is_lazy_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, _Bool arg2); 169 | extern swig_intgo _wrap_Constraint_index_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 170 | extern double _wrap_Constraint_dual_value_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 171 | extern swig_intgo _wrap_Constraint_basis_status_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 172 | extern void _wrap_Constraint_SetLb_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, double arg2); 173 | extern void _wrap_Constraint_SetUb_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, double arg2); 174 | extern double _wrap_Constraint_DualValue_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 175 | extern void _wrap_delete_Constraint_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 176 | extern swig_intgo _wrap_RELATIVE_MIP_GAP_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 177 | extern swig_intgo _wrap_PRIMAL_TOLERANCE_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 178 | extern swig_intgo _wrap_DUAL_TOLERANCE_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 179 | extern swig_intgo _wrap_PRESOLVE_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 180 | extern swig_intgo _wrap_LP_ALGORITHM_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 181 | extern swig_intgo _wrap_INCREMENTALITY_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 182 | extern swig_intgo _wrap_SCALING_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 183 | extern swig_intgo _wrap_PRESOLVE_OFF_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 184 | extern swig_intgo _wrap_PRESOLVE_ON_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 185 | extern swig_intgo _wrap_DUAL_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 186 | extern swig_intgo _wrap_PRIMAL_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 187 | extern swig_intgo _wrap_BARRIER_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 188 | extern swig_intgo _wrap_INCREMENTALITY_OFF_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 189 | extern swig_intgo _wrap_INCREMENTALITY_ON_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 190 | extern swig_intgo _wrap_SCALING_OFF_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 191 | extern swig_intgo _wrap_SCALING_ON_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 192 | extern double _wrap_MPSolverParameters_kDefaultRelativeMipGap_get_ortoolsswig_fe88f1954daf0526(void); 193 | extern double _wrap_MPSolverParameters_kDefaultPrimalTolerance_get_ortoolsswig_fe88f1954daf0526(void); 194 | extern double _wrap_MPSolverParameters_kDefaultDualTolerance_get_ortoolsswig_fe88f1954daf0526(void); 195 | extern swig_intgo _wrap_MPSolverParameters_kDefaultPresolve_get_ortoolsswig_fe88f1954daf0526(void); 196 | extern swig_intgo _wrap_MPSolverParameters_kDefaultIncrementality_get_ortoolsswig_fe88f1954daf0526(void); 197 | extern uintptr_t _wrap_new_MPSolverParameters_ortoolsswig_fe88f1954daf0526(void); 198 | extern void _wrap_MPSolverParameters_SetDoubleParam_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, swig_intgo arg2, double arg3); 199 | extern void _wrap_MPSolverParameters_SetIntegerParam_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, swig_intgo arg2, swig_intgo arg3); 200 | extern double _wrap_MPSolverParameters_GetDoubleParam_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, swig_intgo arg2); 201 | extern swig_intgo _wrap_MPSolverParameters_GetIntegerParam_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, swig_intgo arg2); 202 | extern void _wrap_delete_MPSolverParameters_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 203 | extern uintptr_t _wrap_new_ModelExportOptions_ortoolsswig_fe88f1954daf0526(void); 204 | extern void _wrap_delete_ModelExportOptions_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 205 | extern swig_type_22 _wrap_ExportModelAsLpFormat__SWIG_0_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, uintptr_t arg2); 206 | extern swig_type_23 _wrap_ExportModelAsLpFormat__SWIG_1_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 207 | extern swig_type_24 _wrap_ExportModelAsMpsFormat__SWIG_0_ortoolsswig_fe88f1954daf0526(uintptr_t arg1, uintptr_t arg2); 208 | extern swig_type_25 _wrap_ExportModelAsMpsFormat__SWIG_1_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 209 | extern swig_type_26 _wrap_FindErrorInModelProto_ortoolsswig_fe88f1954daf0526(uintptr_t arg1); 210 | #undef intgo 211 | */ 212 | import "C" 213 | 214 | import "unsafe" 215 | import _ "runtime/cgo" 216 | import "sync" 217 | 218 | 219 | type _ unsafe.Pointer 220 | 221 | 222 | 223 | var Swig_escape_always_false bool 224 | var Swig_escape_val interface{} 225 | 226 | 227 | type _swig_fnptr *byte 228 | type _swig_memberptr *byte 229 | 230 | 231 | type _ sync.Mutex 232 | 233 | 234 | type swig_gostring struct { p uintptr; n int } 235 | func swigCopyString(s string) string { 236 | p := *(*swig_gostring)(unsafe.Pointer(&s)) 237 | r := string((*[0x7fffffff]byte)(unsafe.Pointer(p.p))[:p.n]) 238 | Swig_free(p.p) 239 | return r 240 | } 241 | 242 | func Swig_free(arg1 uintptr) { 243 | _swig_i_0 := arg1 244 | C._wrap_Swig_free_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 245 | } 246 | 247 | const ABSL_HAVE_ATTRIBUTE_NO_TAIL_CALL int = 0 248 | const ABSL_HAVE_ATTRIBUTE_WEAK int = 0 249 | const ABSL_HAVE_ATTRIBUTE_SECTION int = 0 250 | func _swig_getABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE() (_swig_ret int) { 251 | var swig_r int 252 | swig_r = (int)(C._wrap_ABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE_ortoolsswig_fe88f1954daf0526()) 253 | return swig_r 254 | } 255 | 256 | var ABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE int = _swig_getABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE() 257 | type SwigcptrSolver uintptr 258 | 259 | func (p SwigcptrSolver) Swigcptr() uintptr { 260 | return (uintptr)(p) 261 | } 262 | 263 | func (p SwigcptrSolver) SwigIsSolver() { 264 | } 265 | 266 | type Operations_researchMPSolverOptimizationProblemType int 267 | func _swig_getSolver_CLP_LINEAR_PROGRAMMING_Solver() (_swig_ret Operations_researchMPSolverOptimizationProblemType) { 268 | var swig_r Operations_researchMPSolverOptimizationProblemType 269 | swig_r = (Operations_researchMPSolverOptimizationProblemType)(C._wrap_CLP_LINEAR_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526()) 270 | return swig_r 271 | } 272 | 273 | var SolverCLP_LINEAR_PROGRAMMING Operations_researchMPSolverOptimizationProblemType = _swig_getSolver_CLP_LINEAR_PROGRAMMING_Solver() 274 | func _swig_getSolver_GLPK_LINEAR_PROGRAMMING_Solver() (_swig_ret Operations_researchMPSolverOptimizationProblemType) { 275 | var swig_r Operations_researchMPSolverOptimizationProblemType 276 | swig_r = (Operations_researchMPSolverOptimizationProblemType)(C._wrap_GLPK_LINEAR_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526()) 277 | return swig_r 278 | } 279 | 280 | var SolverGLPK_LINEAR_PROGRAMMING Operations_researchMPSolverOptimizationProblemType = _swig_getSolver_GLPK_LINEAR_PROGRAMMING_Solver() 281 | func _swig_getSolver_GLOP_LINEAR_PROGRAMMING_Solver() (_swig_ret Operations_researchMPSolverOptimizationProblemType) { 282 | var swig_r Operations_researchMPSolverOptimizationProblemType 283 | swig_r = (Operations_researchMPSolverOptimizationProblemType)(C._wrap_GLOP_LINEAR_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526()) 284 | return swig_r 285 | } 286 | 287 | var SolverGLOP_LINEAR_PROGRAMMING Operations_researchMPSolverOptimizationProblemType = _swig_getSolver_GLOP_LINEAR_PROGRAMMING_Solver() 288 | func _swig_getSolver_SCIP_MIXED_INTEGER_PROGRAMMING_Solver() (_swig_ret Operations_researchMPSolverOptimizationProblemType) { 289 | var swig_r Operations_researchMPSolverOptimizationProblemType 290 | swig_r = (Operations_researchMPSolverOptimizationProblemType)(C._wrap_SCIP_MIXED_INTEGER_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526()) 291 | return swig_r 292 | } 293 | 294 | var SolverSCIP_MIXED_INTEGER_PROGRAMMING Operations_researchMPSolverOptimizationProblemType = _swig_getSolver_SCIP_MIXED_INTEGER_PROGRAMMING_Solver() 295 | func _swig_getSolver_GLPK_MIXED_INTEGER_PROGRAMMING_Solver() (_swig_ret Operations_researchMPSolverOptimizationProblemType) { 296 | var swig_r Operations_researchMPSolverOptimizationProblemType 297 | swig_r = (Operations_researchMPSolverOptimizationProblemType)(C._wrap_GLPK_MIXED_INTEGER_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526()) 298 | return swig_r 299 | } 300 | 301 | var SolverGLPK_MIXED_INTEGER_PROGRAMMING Operations_researchMPSolverOptimizationProblemType = _swig_getSolver_GLPK_MIXED_INTEGER_PROGRAMMING_Solver() 302 | func _swig_getSolver_CBC_MIXED_INTEGER_PROGRAMMING_Solver() (_swig_ret Operations_researchMPSolverOptimizationProblemType) { 303 | var swig_r Operations_researchMPSolverOptimizationProblemType 304 | swig_r = (Operations_researchMPSolverOptimizationProblemType)(C._wrap_CBC_MIXED_INTEGER_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526()) 305 | return swig_r 306 | } 307 | 308 | var SolverCBC_MIXED_INTEGER_PROGRAMMING Operations_researchMPSolverOptimizationProblemType = _swig_getSolver_CBC_MIXED_INTEGER_PROGRAMMING_Solver() 309 | func _swig_getSolver_GUROBI_LINEAR_PROGRAMMING_Solver() (_swig_ret Operations_researchMPSolverOptimizationProblemType) { 310 | var swig_r Operations_researchMPSolverOptimizationProblemType 311 | swig_r = (Operations_researchMPSolverOptimizationProblemType)(C._wrap_GUROBI_LINEAR_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526()) 312 | return swig_r 313 | } 314 | 315 | var SolverGUROBI_LINEAR_PROGRAMMING Operations_researchMPSolverOptimizationProblemType = _swig_getSolver_GUROBI_LINEAR_PROGRAMMING_Solver() 316 | func _swig_getSolver_GUROBI_MIXED_INTEGER_PROGRAMMING_Solver() (_swig_ret Operations_researchMPSolverOptimizationProblemType) { 317 | var swig_r Operations_researchMPSolverOptimizationProblemType 318 | swig_r = (Operations_researchMPSolverOptimizationProblemType)(C._wrap_GUROBI_MIXED_INTEGER_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526()) 319 | return swig_r 320 | } 321 | 322 | var SolverGUROBI_MIXED_INTEGER_PROGRAMMING Operations_researchMPSolverOptimizationProblemType = _swig_getSolver_GUROBI_MIXED_INTEGER_PROGRAMMING_Solver() 323 | func _swig_getSolver_CPLEX_LINEAR_PROGRAMMING_Solver() (_swig_ret Operations_researchMPSolverOptimizationProblemType) { 324 | var swig_r Operations_researchMPSolverOptimizationProblemType 325 | swig_r = (Operations_researchMPSolverOptimizationProblemType)(C._wrap_CPLEX_LINEAR_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526()) 326 | return swig_r 327 | } 328 | 329 | var SolverCPLEX_LINEAR_PROGRAMMING Operations_researchMPSolverOptimizationProblemType = _swig_getSolver_CPLEX_LINEAR_PROGRAMMING_Solver() 330 | func _swig_getSolver_CPLEX_MIXED_INTEGER_PROGRAMMING_Solver() (_swig_ret Operations_researchMPSolverOptimizationProblemType) { 331 | var swig_r Operations_researchMPSolverOptimizationProblemType 332 | swig_r = (Operations_researchMPSolverOptimizationProblemType)(C._wrap_CPLEX_MIXED_INTEGER_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526()) 333 | return swig_r 334 | } 335 | 336 | var SolverCPLEX_MIXED_INTEGER_PROGRAMMING Operations_researchMPSolverOptimizationProblemType = _swig_getSolver_CPLEX_MIXED_INTEGER_PROGRAMMING_Solver() 337 | func _swig_getSolver_XPRESS_LINEAR_PROGRAMMING_Solver() (_swig_ret Operations_researchMPSolverOptimizationProblemType) { 338 | var swig_r Operations_researchMPSolverOptimizationProblemType 339 | swig_r = (Operations_researchMPSolverOptimizationProblemType)(C._wrap_XPRESS_LINEAR_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526()) 340 | return swig_r 341 | } 342 | 343 | var SolverXPRESS_LINEAR_PROGRAMMING Operations_researchMPSolverOptimizationProblemType = _swig_getSolver_XPRESS_LINEAR_PROGRAMMING_Solver() 344 | func _swig_getSolver_XPRESS_MIXED_INTEGER_PROGRAMMING_Solver() (_swig_ret Operations_researchMPSolverOptimizationProblemType) { 345 | var swig_r Operations_researchMPSolverOptimizationProblemType 346 | swig_r = (Operations_researchMPSolverOptimizationProblemType)(C._wrap_XPRESS_MIXED_INTEGER_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526()) 347 | return swig_r 348 | } 349 | 350 | var SolverXPRESS_MIXED_INTEGER_PROGRAMMING Operations_researchMPSolverOptimizationProblemType = _swig_getSolver_XPRESS_MIXED_INTEGER_PROGRAMMING_Solver() 351 | func _swig_getSolver_BOP_INTEGER_PROGRAMMING_Solver() (_swig_ret Operations_researchMPSolverOptimizationProblemType) { 352 | var swig_r Operations_researchMPSolverOptimizationProblemType 353 | swig_r = (Operations_researchMPSolverOptimizationProblemType)(C._wrap_BOP_INTEGER_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526()) 354 | return swig_r 355 | } 356 | 357 | var SolverBOP_INTEGER_PROGRAMMING Operations_researchMPSolverOptimizationProblemType = _swig_getSolver_BOP_INTEGER_PROGRAMMING_Solver() 358 | func _swig_getSolver_SAT_INTEGER_PROGRAMMING_Solver() (_swig_ret Operations_researchMPSolverOptimizationProblemType) { 359 | var swig_r Operations_researchMPSolverOptimizationProblemType 360 | swig_r = (Operations_researchMPSolverOptimizationProblemType)(C._wrap_SAT_INTEGER_PROGRAMMING_Solver_ortoolsswig_fe88f1954daf0526()) 361 | return swig_r 362 | } 363 | 364 | var SolverSAT_INTEGER_PROGRAMMING Operations_researchMPSolverOptimizationProblemType = _swig_getSolver_SAT_INTEGER_PROGRAMMING_Solver() 365 | func NewSolver(arg1 string, arg2 Operations_researchMPSolverOptimizationProblemType) (_swig_ret Solver) { 366 | var swig_r Solver 367 | _swig_i_0 := arg1 368 | _swig_i_1 := arg2 369 | swig_r = (Solver)(SwigcptrSolver(C._wrap_new_Solver_ortoolsswig_fe88f1954daf0526(*(*C.swig_type_1)(unsafe.Pointer(&_swig_i_0)), C.swig_intgo(_swig_i_1)))) 370 | if Swig_escape_always_false { 371 | Swig_escape_val = arg1 372 | } 373 | return swig_r 374 | } 375 | 376 | func DeleteSolver(arg1 Solver) { 377 | _swig_i_0 := arg1.Swigcptr() 378 | C._wrap_delete_Solver_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 379 | } 380 | 381 | func SolverSupportsProblemType(arg1 Operations_researchMPSolverOptimizationProblemType) (_swig_ret bool) { 382 | var swig_r bool 383 | _swig_i_0 := arg1 384 | swig_r = (bool)(C._wrap_Solver_SupportsProblemType_ortoolsswig_fe88f1954daf0526(C.swig_intgo(_swig_i_0))) 385 | return swig_r 386 | } 387 | 388 | func (arg1 SwigcptrSolver) Clear() { 389 | _swig_i_0 := arg1 390 | C._wrap_Solver_Clear_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 391 | } 392 | 393 | func (arg1 SwigcptrSolver) NumVariables() (_swig_ret int) { 394 | var swig_r int 395 | _swig_i_0 := arg1 396 | swig_r = (int)(C._wrap_Solver_NumVariables_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 397 | return swig_r 398 | } 399 | 400 | func (arg1 SwigcptrSolver) Variables() (_swig_ret Std_vector_Sl_operations_research_MPVariable_Sm__Sg_) { 401 | var swig_r Std_vector_Sl_operations_research_MPVariable_Sm__Sg_ 402 | _swig_i_0 := arg1 403 | swig_r = (Std_vector_Sl_operations_research_MPVariable_Sm__Sg_)(SwigcptrStd_vector_Sl_operations_research_MPVariable_Sm__Sg_(C._wrap_Solver_variables_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)))) 404 | return swig_r 405 | } 406 | 407 | func (arg1 SwigcptrSolver) LookupVariable(arg2 string) (_swig_ret Variable) { 408 | var swig_r Variable 409 | _swig_i_0 := arg1 410 | _swig_i_1 := arg2 411 | swig_r = (Variable)(SwigcptrVariable(C._wrap_Solver_LookupVariable_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), *(*C.swig_type_2)(unsafe.Pointer(&_swig_i_1))))) 412 | if Swig_escape_always_false { 413 | Swig_escape_val = arg2 414 | } 415 | return swig_r 416 | } 417 | 418 | func (arg1 SwigcptrSolver) Var(arg2 float64, arg3 float64, arg4 bool, arg5 string) (_swig_ret Variable) { 419 | var swig_r Variable 420 | _swig_i_0 := arg1 421 | _swig_i_1 := arg2 422 | _swig_i_2 := arg3 423 | _swig_i_3 := arg4 424 | _swig_i_4 := arg5 425 | swig_r = (Variable)(SwigcptrVariable(C._wrap_Solver_Var_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.double(_swig_i_1), C.double(_swig_i_2), C._Bool(_swig_i_3), *(*C.swig_type_3)(unsafe.Pointer(&_swig_i_4))))) 426 | if Swig_escape_always_false { 427 | Swig_escape_val = arg5 428 | } 429 | return swig_r 430 | } 431 | 432 | func (arg1 SwigcptrSolver) NumVar(arg2 float64, arg3 float64, arg4 string) (_swig_ret Variable) { 433 | var swig_r Variable 434 | _swig_i_0 := arg1 435 | _swig_i_1 := arg2 436 | _swig_i_2 := arg3 437 | _swig_i_3 := arg4 438 | swig_r = (Variable)(SwigcptrVariable(C._wrap_Solver_NumVar_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.double(_swig_i_1), C.double(_swig_i_2), *(*C.swig_type_4)(unsafe.Pointer(&_swig_i_3))))) 439 | if Swig_escape_always_false { 440 | Swig_escape_val = arg4 441 | } 442 | return swig_r 443 | } 444 | 445 | func (arg1 SwigcptrSolver) IntVar(arg2 float64, arg3 float64, arg4 string) (_swig_ret Variable) { 446 | var swig_r Variable 447 | _swig_i_0 := arg1 448 | _swig_i_1 := arg2 449 | _swig_i_2 := arg3 450 | _swig_i_3 := arg4 451 | swig_r = (Variable)(SwigcptrVariable(C._wrap_Solver_IntVar_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.double(_swig_i_1), C.double(_swig_i_2), *(*C.swig_type_5)(unsafe.Pointer(&_swig_i_3))))) 452 | if Swig_escape_always_false { 453 | Swig_escape_val = arg4 454 | } 455 | return swig_r 456 | } 457 | 458 | func (arg1 SwigcptrSolver) BoolVar(arg2 string) (_swig_ret Variable) { 459 | var swig_r Variable 460 | _swig_i_0 := arg1 461 | _swig_i_1 := arg2 462 | swig_r = (Variable)(SwigcptrVariable(C._wrap_Solver_BoolVar_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), *(*C.swig_type_6)(unsafe.Pointer(&_swig_i_1))))) 463 | if Swig_escape_always_false { 464 | Swig_escape_val = arg2 465 | } 466 | return swig_r 467 | } 468 | 469 | func (arg1 SwigcptrSolver) NumConstraints() (_swig_ret int) { 470 | var swig_r int 471 | _swig_i_0 := arg1 472 | swig_r = (int)(C._wrap_Solver_NumConstraints_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 473 | return swig_r 474 | } 475 | 476 | func (arg1 SwigcptrSolver) Constraints() (_swig_ret Std_vector_Sl_operations_research_MPConstraint_Sm__Sg_) { 477 | var swig_r Std_vector_Sl_operations_research_MPConstraint_Sm__Sg_ 478 | _swig_i_0 := arg1 479 | swig_r = (Std_vector_Sl_operations_research_MPConstraint_Sm__Sg_)(SwigcptrStd_vector_Sl_operations_research_MPConstraint_Sm__Sg_(C._wrap_Solver_constraints_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)))) 480 | return swig_r 481 | } 482 | 483 | func (arg1 SwigcptrSolver) LookupConstraint(arg2 string) (_swig_ret Constraint) { 484 | var swig_r Constraint 485 | _swig_i_0 := arg1 486 | _swig_i_1 := arg2 487 | swig_r = (Constraint)(SwigcptrConstraint(C._wrap_Solver_LookupConstraint_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), *(*C.swig_type_7)(unsafe.Pointer(&_swig_i_1))))) 488 | if Swig_escape_always_false { 489 | Swig_escape_val = arg2 490 | } 491 | return swig_r 492 | } 493 | 494 | func (arg1 SwigcptrSolver) Constraint__SWIG_0(arg2 float64, arg3 float64) (_swig_ret Constraint) { 495 | var swig_r Constraint 496 | _swig_i_0 := arg1 497 | _swig_i_1 := arg2 498 | _swig_i_2 := arg3 499 | swig_r = (Constraint)(SwigcptrConstraint(C._wrap_Solver_Constraint__SWIG_0_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.double(_swig_i_1), C.double(_swig_i_2)))) 500 | return swig_r 501 | } 502 | 503 | func (arg1 SwigcptrSolver) Constraint__SWIG_1() (_swig_ret Constraint) { 504 | var swig_r Constraint 505 | _swig_i_0 := arg1 506 | swig_r = (Constraint)(SwigcptrConstraint(C._wrap_Solver_Constraint__SWIG_1_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)))) 507 | return swig_r 508 | } 509 | 510 | func (arg1 SwigcptrSolver) Constraint__SWIG_2(arg2 float64, arg3 float64, arg4 string) (_swig_ret Constraint) { 511 | var swig_r Constraint 512 | _swig_i_0 := arg1 513 | _swig_i_1 := arg2 514 | _swig_i_2 := arg3 515 | _swig_i_3 := arg4 516 | swig_r = (Constraint)(SwigcptrConstraint(C._wrap_Solver_Constraint__SWIG_2_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.double(_swig_i_1), C.double(_swig_i_2), *(*C.swig_type_8)(unsafe.Pointer(&_swig_i_3))))) 517 | if Swig_escape_always_false { 518 | Swig_escape_val = arg4 519 | } 520 | return swig_r 521 | } 522 | 523 | func (arg1 SwigcptrSolver) Constraint__SWIG_3(arg2 string) (_swig_ret Constraint) { 524 | var swig_r Constraint 525 | _swig_i_0 := arg1 526 | _swig_i_1 := arg2 527 | swig_r = (Constraint)(SwigcptrConstraint(C._wrap_Solver_Constraint__SWIG_3_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), *(*C.swig_type_9)(unsafe.Pointer(&_swig_i_1))))) 528 | if Swig_escape_always_false { 529 | Swig_escape_val = arg2 530 | } 531 | return swig_r 532 | } 533 | 534 | func (p SwigcptrSolver) Constraint(a ...interface{}) Constraint { 535 | argc := len(a) 536 | if argc == 0 { 537 | return p.Constraint__SWIG_1() 538 | } 539 | if argc == 1 { 540 | return p.Constraint__SWIG_3(a[0].(string)) 541 | } 542 | if argc == 2 { 543 | return p.Constraint__SWIG_0(a[0].(float64), a[1].(float64)) 544 | } 545 | if argc == 3 { 546 | return p.Constraint__SWIG_2(a[0].(float64), a[1].(float64), a[2].(string)) 547 | } 548 | panic("No match for overloaded function call") 549 | } 550 | 551 | func (arg1 SwigcptrSolver) Objective() (_swig_ret Objective) { 552 | var swig_r Objective 553 | _swig_i_0 := arg1 554 | swig_r = (Objective)(SwigcptrObjective(C._wrap_Solver_Objective_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)))) 555 | return swig_r 556 | } 557 | 558 | type Operations_researchMPSolverResultStatus int 559 | func _swig_getSolver_StatusOptimal_Solver() (_swig_ret Operations_researchMPSolverResultStatus) { 560 | var swig_r Operations_researchMPSolverResultStatus 561 | swig_r = (Operations_researchMPSolverResultStatus)(C._wrap_StatusOptimal_Solver_ortoolsswig_fe88f1954daf0526()) 562 | return swig_r 563 | } 564 | 565 | var SolverStatusOptimal Operations_researchMPSolverResultStatus = _swig_getSolver_StatusOptimal_Solver() 566 | func _swig_getSolver_StatusFeasible_Solver() (_swig_ret Operations_researchMPSolverResultStatus) { 567 | var swig_r Operations_researchMPSolverResultStatus 568 | swig_r = (Operations_researchMPSolverResultStatus)(C._wrap_StatusFeasible_Solver_ortoolsswig_fe88f1954daf0526()) 569 | return swig_r 570 | } 571 | 572 | var SolverStatusFeasible Operations_researchMPSolverResultStatus = _swig_getSolver_StatusFeasible_Solver() 573 | func _swig_getSolver_StatusInfeasible_Solver() (_swig_ret Operations_researchMPSolverResultStatus) { 574 | var swig_r Operations_researchMPSolverResultStatus 575 | swig_r = (Operations_researchMPSolverResultStatus)(C._wrap_StatusInfeasible_Solver_ortoolsswig_fe88f1954daf0526()) 576 | return swig_r 577 | } 578 | 579 | var SolverStatusInfeasible Operations_researchMPSolverResultStatus = _swig_getSolver_StatusInfeasible_Solver() 580 | func _swig_getSolver_StatusUnbounded_Solver() (_swig_ret Operations_researchMPSolverResultStatus) { 581 | var swig_r Operations_researchMPSolverResultStatus 582 | swig_r = (Operations_researchMPSolverResultStatus)(C._wrap_StatusUnbounded_Solver_ortoolsswig_fe88f1954daf0526()) 583 | return swig_r 584 | } 585 | 586 | var SolverStatusUnbounded Operations_researchMPSolverResultStatus = _swig_getSolver_StatusUnbounded_Solver() 587 | func _swig_getSolver_StatusAbnormal_Solver() (_swig_ret Operations_researchMPSolverResultStatus) { 588 | var swig_r Operations_researchMPSolverResultStatus 589 | swig_r = (Operations_researchMPSolverResultStatus)(C._wrap_StatusAbnormal_Solver_ortoolsswig_fe88f1954daf0526()) 590 | return swig_r 591 | } 592 | 593 | var SolverStatusAbnormal Operations_researchMPSolverResultStatus = _swig_getSolver_StatusAbnormal_Solver() 594 | func _swig_getSolver_StatusNotSolved_Solver() (_swig_ret Operations_researchMPSolverResultStatus) { 595 | var swig_r Operations_researchMPSolverResultStatus 596 | swig_r = (Operations_researchMPSolverResultStatus)(C._wrap_StatusNotSolved_Solver_ortoolsswig_fe88f1954daf0526()) 597 | return swig_r 598 | } 599 | 600 | var SolverStatusNotSolved Operations_researchMPSolverResultStatus = _swig_getSolver_StatusNotSolved_Solver() 601 | func (arg1 SwigcptrSolver) Solve__SWIG_0() (_swig_ret Operations_researchMPSolverResultStatus) { 602 | var swig_r Operations_researchMPSolverResultStatus 603 | _swig_i_0 := arg1 604 | swig_r = (Operations_researchMPSolverResultStatus)(C._wrap_Solver_Solve__SWIG_0_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 605 | return swig_r 606 | } 607 | 608 | func (arg1 SwigcptrSolver) Solve__SWIG_1(arg2 MPSolverParameters) (_swig_ret Operations_researchMPSolverResultStatus) { 609 | var swig_r Operations_researchMPSolverResultStatus 610 | _swig_i_0 := arg1 611 | _swig_i_1 := arg2.Swigcptr() 612 | swig_r = (Operations_researchMPSolverResultStatus)(C._wrap_Solver_Solve__SWIG_1_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1))) 613 | return swig_r 614 | } 615 | 616 | func (p SwigcptrSolver) Solve(a ...interface{}) Operations_researchMPSolverResultStatus { 617 | argc := len(a) 618 | if argc == 0 { 619 | return p.Solve__SWIG_0() 620 | } 621 | if argc == 1 { 622 | return p.Solve__SWIG_1(a[0].(MPSolverParameters)) 623 | } 624 | panic("No match for overloaded function call") 625 | } 626 | 627 | func (arg1 SwigcptrSolver) ComputeConstraintActivities() (_swig_ret Std_vector_Sl_double_Sg_) { 628 | var swig_r Std_vector_Sl_double_Sg_ 629 | _swig_i_0 := arg1 630 | swig_r = (Std_vector_Sl_double_Sg_)(SwigcptrStd_vector_Sl_double_Sg_(C._wrap_Solver_ComputeConstraintActivities_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)))) 631 | return swig_r 632 | } 633 | 634 | func (arg1 SwigcptrSolver) VerifySolution(arg2 float64, arg3 bool) (_swig_ret bool) { 635 | var swig_r bool 636 | _swig_i_0 := arg1 637 | _swig_i_1 := arg2 638 | _swig_i_2 := arg3 639 | swig_r = (bool)(C._wrap_Solver_VerifySolution_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.double(_swig_i_1), C._Bool(_swig_i_2))) 640 | return swig_r 641 | } 642 | 643 | func (arg1 SwigcptrSolver) InterruptSolve() (_swig_ret bool) { 644 | var swig_r bool 645 | _swig_i_0 := arg1 646 | swig_r = (bool)(C._wrap_Solver_InterruptSolve_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 647 | return swig_r 648 | } 649 | 650 | func (arg1 SwigcptrSolver) FillSolutionResponseProto(arg2 Operations_research_MPSolutionResponse) { 651 | _swig_i_0 := arg1 652 | _swig_i_1 := arg2.Swigcptr() 653 | C._wrap_Solver_FillSolutionResponseProto_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1)) 654 | } 655 | 656 | func SolverSolveWithProto__SWIG_0(arg1 Operations_research_MPModelRequest, arg2 Operations_research_MPSolutionResponse, arg3 Std_atomic_Sl_bool_Sg_) { 657 | _swig_i_0 := arg1.Swigcptr() 658 | _swig_i_1 := arg2.Swigcptr() 659 | _swig_i_2 := arg3.Swigcptr() 660 | C._wrap_Solver_SolveWithProto__SWIG_0_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1), C.uintptr_t(_swig_i_2)) 661 | } 662 | 663 | func SolverSolveWithProto__SWIG_1(arg1 Operations_research_MPModelRequest, arg2 Operations_research_MPSolutionResponse) { 664 | _swig_i_0 := arg1.Swigcptr() 665 | _swig_i_1 := arg2.Swigcptr() 666 | C._wrap_Solver_SolveWithProto__SWIG_1_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1)) 667 | } 668 | 669 | func SolverSolveWithProto(a ...interface{}) { 670 | argc := len(a) 671 | if argc == 2 { 672 | SolverSolveWithProto__SWIG_1(a[0].(Operations_research_MPModelRequest), a[1].(Operations_research_MPSolutionResponse)) 673 | return 674 | } 675 | if argc == 3 { 676 | SolverSolveWithProto__SWIG_0(a[0].(Operations_research_MPModelRequest), a[1].(Operations_research_MPSolutionResponse), a[2].(Std_atomic_Sl_bool_Sg_)) 677 | return 678 | } 679 | panic("No match for overloaded function call") 680 | } 681 | 682 | func (arg1 SwigcptrSolver) ExportModelToProto(arg2 Operations_research_MPModelProto) { 683 | _swig_i_0 := arg1 684 | _swig_i_1 := arg2.Swigcptr() 685 | C._wrap_Solver_ExportModelToProto_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1)) 686 | } 687 | 688 | func (arg1 SwigcptrSolver) LoadSolutionFromProto__SWIG_0(arg2 Operations_research_MPSolutionResponse, arg3 float64) (_swig_ret Absl_Status) { 689 | var swig_r Absl_Status 690 | _swig_i_0 := arg1 691 | _swig_i_1 := arg2.Swigcptr() 692 | _swig_i_2 := arg3 693 | swig_r = (Absl_Status)(SwigcptrAbsl_Status(C._wrap_Solver_LoadSolutionFromProto__SWIG_0_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1), C.double(_swig_i_2)))) 694 | return swig_r 695 | } 696 | 697 | func (arg1 SwigcptrSolver) LoadSolutionFromProto__SWIG_1(arg2 Operations_research_MPSolutionResponse) (_swig_ret Absl_Status) { 698 | var swig_r Absl_Status 699 | _swig_i_0 := arg1 700 | _swig_i_1 := arg2.Swigcptr() 701 | swig_r = (Absl_Status)(SwigcptrAbsl_Status(C._wrap_Solver_LoadSolutionFromProto__SWIG_1_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1)))) 702 | return swig_r 703 | } 704 | 705 | func (p SwigcptrSolver) LoadSolutionFromProto(a ...interface{}) Absl_Status { 706 | argc := len(a) 707 | if argc == 1 { 708 | return p.LoadSolutionFromProto__SWIG_1(a[0].(Operations_research_MPSolutionResponse)) 709 | } 710 | if argc == 2 { 711 | return p.LoadSolutionFromProto__SWIG_0(a[0].(Operations_research_MPSolutionResponse), a[1].(float64)) 712 | } 713 | panic("No match for overloaded function call") 714 | } 715 | 716 | func (arg1 SwigcptrSolver) SetSolverSpecificParametersAsString(arg2 string) (_swig_ret bool) { 717 | var swig_r bool 718 | _swig_i_0 := arg1 719 | _swig_i_1 := arg2 720 | swig_r = (bool)(C._wrap_Solver_SetSolverSpecificParametersAsString_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), *(*C.swig_type_10)(unsafe.Pointer(&_swig_i_1)))) 721 | if Swig_escape_always_false { 722 | Swig_escape_val = arg2 723 | } 724 | return swig_r 725 | } 726 | 727 | type Operations_researchMPSolverBasisStatus int 728 | func _swig_getSolver_FREE_Solver() (_swig_ret Operations_researchMPSolverBasisStatus) { 729 | var swig_r Operations_researchMPSolverBasisStatus 730 | swig_r = (Operations_researchMPSolverBasisStatus)(C._wrap_FREE_Solver_ortoolsswig_fe88f1954daf0526()) 731 | return swig_r 732 | } 733 | 734 | var SolverFREE Operations_researchMPSolverBasisStatus = _swig_getSolver_FREE_Solver() 735 | func _swig_getSolver_AT_LOWER_BOUND_Solver() (_swig_ret Operations_researchMPSolverBasisStatus) { 736 | var swig_r Operations_researchMPSolverBasisStatus 737 | swig_r = (Operations_researchMPSolverBasisStatus)(C._wrap_AT_LOWER_BOUND_Solver_ortoolsswig_fe88f1954daf0526()) 738 | return swig_r 739 | } 740 | 741 | var SolverAT_LOWER_BOUND Operations_researchMPSolverBasisStatus = _swig_getSolver_AT_LOWER_BOUND_Solver() 742 | func _swig_getSolver_AT_UPPER_BOUND_Solver() (_swig_ret Operations_researchMPSolverBasisStatus) { 743 | var swig_r Operations_researchMPSolverBasisStatus 744 | swig_r = (Operations_researchMPSolverBasisStatus)(C._wrap_AT_UPPER_BOUND_Solver_ortoolsswig_fe88f1954daf0526()) 745 | return swig_r 746 | } 747 | 748 | var SolverAT_UPPER_BOUND Operations_researchMPSolverBasisStatus = _swig_getSolver_AT_UPPER_BOUND_Solver() 749 | func _swig_getSolver_FIXED_VALUE_Solver() (_swig_ret Operations_researchMPSolverBasisStatus) { 750 | var swig_r Operations_researchMPSolverBasisStatus 751 | swig_r = (Operations_researchMPSolverBasisStatus)(C._wrap_FIXED_VALUE_Solver_ortoolsswig_fe88f1954daf0526()) 752 | return swig_r 753 | } 754 | 755 | var SolverFIXED_VALUE Operations_researchMPSolverBasisStatus = _swig_getSolver_FIXED_VALUE_Solver() 756 | func _swig_getSolver_BASIC_Solver() (_swig_ret Operations_researchMPSolverBasisStatus) { 757 | var swig_r Operations_researchMPSolverBasisStatus 758 | swig_r = (Operations_researchMPSolverBasisStatus)(C._wrap_BASIC_Solver_ortoolsswig_fe88f1954daf0526()) 759 | return swig_r 760 | } 761 | 762 | var SolverBASIC Operations_researchMPSolverBasisStatus = _swig_getSolver_BASIC_Solver() 763 | func SolverInfinity() (_swig_ret float64) { 764 | var swig_r float64 765 | swig_r = (float64)(C._wrap_Solver_infinity_ortoolsswig_fe88f1954daf0526()) 766 | return swig_r 767 | } 768 | 769 | func (arg1 SwigcptrSolver) EnableOutput() { 770 | _swig_i_0 := arg1 771 | C._wrap_Solver_EnableOutput_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 772 | } 773 | 774 | func (arg1 SwigcptrSolver) SuppressOutput() { 775 | _swig_i_0 := arg1 776 | C._wrap_Solver_SuppressOutput_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 777 | } 778 | 779 | func (arg1 SwigcptrSolver) Iterations() (_swig_ret int64) { 780 | var swig_r int64 781 | _swig_i_0 := arg1 782 | swig_r = (int64)(C._wrap_Solver_iterations_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 783 | return swig_r 784 | } 785 | 786 | func (arg1 SwigcptrSolver) Nodes() (_swig_ret int64) { 787 | var swig_r int64 788 | _swig_i_0 := arg1 789 | swig_r = (int64)(C._wrap_Solver_nodes_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 790 | return swig_r 791 | } 792 | 793 | func (arg1 SwigcptrSolver) ComputeExactConditionNumber() (_swig_ret float64) { 794 | var swig_r float64 795 | _swig_i_0 := arg1 796 | swig_r = (float64)(C._wrap_Solver_ComputeExactConditionNumber_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 797 | return swig_r 798 | } 799 | 800 | func (arg1 SwigcptrSolver) NextSolution() (_swig_ret bool) { 801 | var swig_r bool 802 | _swig_i_0 := arg1 803 | swig_r = (bool)(C._wrap_Solver_NextSolution_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 804 | return swig_r 805 | } 806 | 807 | func (arg1 SwigcptrSolver) Set_time_limit(arg2 int64) { 808 | _swig_i_0 := arg1 809 | _swig_i_1 := arg2 810 | C._wrap_Solver_set_time_limit_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.swig_type_13(_swig_i_1)) 811 | } 812 | 813 | func (arg1 SwigcptrSolver) Wall_time() (_swig_ret int64) { 814 | var swig_r int64 815 | _swig_i_0 := arg1 816 | swig_r = (int64)(C._wrap_Solver_wall_time_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 817 | return swig_r 818 | } 819 | 820 | func (arg1 SwigcptrSolver) LoadModelFromProto(arg2 Operations_research_MPModelProto) (_swig_ret string) { 821 | var swig_r string 822 | _swig_i_0 := arg1 823 | _swig_i_1 := arg2.Swigcptr() 824 | swig_r_p := C._wrap_Solver_LoadModelFromProto_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1)) 825 | swig_r = *(*string)(unsafe.Pointer(&swig_r_p)) 826 | var swig_r_1 string 827 | swig_r_1 = swigCopyString(swig_r) 828 | return swig_r_1 829 | } 830 | 831 | func (arg1 SwigcptrSolver) ExportModelAsLpFormat(arg2 bool) (_swig_ret string) { 832 | var swig_r string 833 | _swig_i_0 := arg1 834 | _swig_i_1 := arg2 835 | swig_r_p := C._wrap_Solver_ExportModelAsLpFormat_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C._Bool(_swig_i_1)) 836 | swig_r = *(*string)(unsafe.Pointer(&swig_r_p)) 837 | var swig_r_1 string 838 | swig_r_1 = swigCopyString(swig_r) 839 | return swig_r_1 840 | } 841 | 842 | func (arg1 SwigcptrSolver) ExportModelAsMpsFormat(arg2 bool, arg3 bool) (_swig_ret string) { 843 | var swig_r string 844 | _swig_i_0 := arg1 845 | _swig_i_1 := arg2 846 | _swig_i_2 := arg3 847 | swig_r_p := C._wrap_Solver_ExportModelAsMpsFormat_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C._Bool(_swig_i_1), C._Bool(_swig_i_2)) 848 | swig_r = *(*string)(unsafe.Pointer(&swig_r_p)) 849 | var swig_r_1 string 850 | swig_r_1 = swigCopyString(swig_r) 851 | return swig_r_1 852 | } 853 | 854 | func (arg1 SwigcptrSolver) SetHint(arg2 Std_vector_Sl_operations_research_MPVariable_Sm__Sg_, arg3 Std_vector_Sl_double_Sg_) { 855 | _swig_i_0 := arg1 856 | _swig_i_1 := arg2.Swigcptr() 857 | _swig_i_2 := arg3.Swigcptr() 858 | C._wrap_Solver_SetHint_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1), C.uintptr_t(_swig_i_2)) 859 | } 860 | 861 | func (arg1 SwigcptrSolver) SetNumThreads(arg2 int) (_swig_ret bool) { 862 | var swig_r bool 863 | _swig_i_0 := arg1 864 | _swig_i_1 := arg2 865 | swig_r = (bool)(C._wrap_Solver_SetNumThreads_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.swig_intgo(_swig_i_1))) 866 | return swig_r 867 | } 868 | 869 | func (arg1 SwigcptrSolver) SetTimeLimit(arg2 Int64) { 870 | _swig_i_0 := arg1 871 | _swig_i_1 := arg2.Swigcptr() 872 | C._wrap_Solver_SetTimeLimit_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1)) 873 | } 874 | 875 | func (arg1 SwigcptrSolver) WallTime() (_swig_ret Int64) { 876 | var swig_r Int64 877 | _swig_i_0 := arg1 878 | swig_r = (Int64)(SwigcptrInt64(C._wrap_Solver_WallTime_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)))) 879 | return swig_r 880 | } 881 | 882 | type Solver interface { 883 | Swigcptr() uintptr 884 | SwigIsSolver() 885 | Clear() 886 | NumVariables() (_swig_ret int) 887 | Variables() (_swig_ret Std_vector_Sl_operations_research_MPVariable_Sm__Sg_) 888 | LookupVariable(arg2 string) (_swig_ret Variable) 889 | Var(arg2 float64, arg3 float64, arg4 bool, arg5 string) (_swig_ret Variable) 890 | NumVar(arg2 float64, arg3 float64, arg4 string) (_swig_ret Variable) 891 | IntVar(arg2 float64, arg3 float64, arg4 string) (_swig_ret Variable) 892 | BoolVar(arg2 string) (_swig_ret Variable) 893 | NumConstraints() (_swig_ret int) 894 | Constraints() (_swig_ret Std_vector_Sl_operations_research_MPConstraint_Sm__Sg_) 895 | LookupConstraint(arg2 string) (_swig_ret Constraint) 896 | Constraint(a ...interface{}) Constraint 897 | Objective() (_swig_ret Objective) 898 | Solve(a ...interface{}) Operations_researchMPSolverResultStatus 899 | ComputeConstraintActivities() (_swig_ret Std_vector_Sl_double_Sg_) 900 | VerifySolution(arg2 float64, arg3 bool) (_swig_ret bool) 901 | InterruptSolve() (_swig_ret bool) 902 | FillSolutionResponseProto(arg2 Operations_research_MPSolutionResponse) 903 | ExportModelToProto(arg2 Operations_research_MPModelProto) 904 | LoadSolutionFromProto(a ...interface{}) Absl_Status 905 | SetSolverSpecificParametersAsString(arg2 string) (_swig_ret bool) 906 | EnableOutput() 907 | SuppressOutput() 908 | Iterations() (_swig_ret int64) 909 | Nodes() (_swig_ret int64) 910 | ComputeExactConditionNumber() (_swig_ret float64) 911 | NextSolution() (_swig_ret bool) 912 | Set_time_limit(arg2 int64) 913 | Wall_time() (_swig_ret int64) 914 | LoadModelFromProto(arg2 Operations_research_MPModelProto) (_swig_ret string) 915 | ExportModelAsLpFormat(arg2 bool) (_swig_ret string) 916 | ExportModelAsMpsFormat(arg2 bool, arg3 bool) (_swig_ret string) 917 | SetHint(arg2 Std_vector_Sl_operations_research_MPVariable_Sm__Sg_, arg3 Std_vector_Sl_double_Sg_) 918 | SetNumThreads(arg2 int) (_swig_ret bool) 919 | SetTimeLimit(arg2 Int64) 920 | WallTime() (_swig_ret Int64) 921 | } 922 | 923 | type SwigcptrObjective uintptr 924 | 925 | func (p SwigcptrObjective) Swigcptr() uintptr { 926 | return (uintptr)(p) 927 | } 928 | 929 | func (p SwigcptrObjective) SwigIsObjective() { 930 | } 931 | 932 | func (arg1 SwigcptrObjective) Clear() { 933 | _swig_i_0 := arg1 934 | C._wrap_Objective_Clear_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 935 | } 936 | 937 | func (arg1 SwigcptrObjective) SetCoefficient(arg2 Variable, arg3 float64) { 938 | _swig_i_0 := arg1 939 | _swig_i_1 := arg2.Swigcptr() 940 | _swig_i_2 := arg3 941 | C._wrap_Objective_SetCoefficient_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1), C.double(_swig_i_2)) 942 | } 943 | 944 | func (arg1 SwigcptrObjective) GetCoefficient(arg2 Variable) (_swig_ret float64) { 945 | var swig_r float64 946 | _swig_i_0 := arg1 947 | _swig_i_1 := arg2.Swigcptr() 948 | swig_r = (float64)(C._wrap_Objective_GetCoefficient_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1))) 949 | return swig_r 950 | } 951 | 952 | func (arg1 SwigcptrObjective) SetOffset(arg2 float64) { 953 | _swig_i_0 := arg1 954 | _swig_i_1 := arg2 955 | C._wrap_Objective_SetOffset_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.double(_swig_i_1)) 956 | } 957 | 958 | func (arg1 SwigcptrObjective) Offset() (_swig_ret float64) { 959 | var swig_r float64 960 | _swig_i_0 := arg1 961 | swig_r = (float64)(C._wrap_Objective_offset_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 962 | return swig_r 963 | } 964 | 965 | func (arg1 SwigcptrObjective) SetOptimizationDirection(arg2 bool) { 966 | _swig_i_0 := arg1 967 | _swig_i_1 := arg2 968 | C._wrap_Objective_SetOptimizationDirection_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C._Bool(_swig_i_1)) 969 | } 970 | 971 | func (arg1 SwigcptrObjective) SetMinimization() { 972 | _swig_i_0 := arg1 973 | C._wrap_Objective_SetMinimization_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 974 | } 975 | 976 | func (arg1 SwigcptrObjective) SetMaximization() { 977 | _swig_i_0 := arg1 978 | C._wrap_Objective_SetMaximization_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 979 | } 980 | 981 | func (arg1 SwigcptrObjective) Maximization() (_swig_ret bool) { 982 | var swig_r bool 983 | _swig_i_0 := arg1 984 | swig_r = (bool)(C._wrap_Objective_maximization_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 985 | return swig_r 986 | } 987 | 988 | func (arg1 SwigcptrObjective) Minimization() (_swig_ret bool) { 989 | var swig_r bool 990 | _swig_i_0 := arg1 991 | swig_r = (bool)(C._wrap_Objective_minimization_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 992 | return swig_r 993 | } 994 | 995 | func (arg1 SwigcptrObjective) Value() (_swig_ret float64) { 996 | var swig_r float64 997 | _swig_i_0 := arg1 998 | swig_r = (float64)(C._wrap_Objective_Value_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 999 | return swig_r 1000 | } 1001 | 1002 | func (arg1 SwigcptrObjective) BestBound() (_swig_ret float64) { 1003 | var swig_r float64 1004 | _swig_i_0 := arg1 1005 | swig_r = (float64)(C._wrap_Objective_BestBound_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 1006 | return swig_r 1007 | } 1008 | 1009 | func DeleteObjective(arg1 Objective) { 1010 | _swig_i_0 := arg1.Swigcptr() 1011 | C._wrap_delete_Objective_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 1012 | } 1013 | 1014 | type Objective interface { 1015 | Swigcptr() uintptr 1016 | SwigIsObjective() 1017 | Clear() 1018 | SetCoefficient(arg2 Variable, arg3 float64) 1019 | GetCoefficient(arg2 Variable) (_swig_ret float64) 1020 | SetOffset(arg2 float64) 1021 | Offset() (_swig_ret float64) 1022 | SetOptimizationDirection(arg2 bool) 1023 | SetMinimization() 1024 | SetMaximization() 1025 | Maximization() (_swig_ret bool) 1026 | Minimization() (_swig_ret bool) 1027 | Value() (_swig_ret float64) 1028 | BestBound() (_swig_ret float64) 1029 | } 1030 | 1031 | type SwigcptrVariable uintptr 1032 | 1033 | func (p SwigcptrVariable) Swigcptr() uintptr { 1034 | return (uintptr)(p) 1035 | } 1036 | 1037 | func (p SwigcptrVariable) SwigIsVariable() { 1038 | } 1039 | 1040 | func (arg1 SwigcptrVariable) Name() (_swig_ret string) { 1041 | var swig_r string 1042 | _swig_i_0 := arg1 1043 | swig_r_p := C._wrap_Variable_name_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 1044 | swig_r = *(*string)(unsafe.Pointer(&swig_r_p)) 1045 | var swig_r_1 string 1046 | swig_r_1 = swigCopyString(swig_r) 1047 | return swig_r_1 1048 | } 1049 | 1050 | func (arg1 SwigcptrVariable) SetInteger(arg2 bool) { 1051 | _swig_i_0 := arg1 1052 | _swig_i_1 := arg2 1053 | C._wrap_Variable_SetInteger_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C._Bool(_swig_i_1)) 1054 | } 1055 | 1056 | func (arg1 SwigcptrVariable) Integer() (_swig_ret bool) { 1057 | var swig_r bool 1058 | _swig_i_0 := arg1 1059 | swig_r = (bool)(C._wrap_Variable_integer_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 1060 | return swig_r 1061 | } 1062 | 1063 | func (arg1 SwigcptrVariable) Solution_value() (_swig_ret float64) { 1064 | var swig_r float64 1065 | _swig_i_0 := arg1 1066 | swig_r = (float64)(C._wrap_Variable_solution_value_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 1067 | return swig_r 1068 | } 1069 | 1070 | func (arg1 SwigcptrVariable) Index() (_swig_ret int) { 1071 | var swig_r int 1072 | _swig_i_0 := arg1 1073 | swig_r = (int)(C._wrap_Variable_index_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 1074 | return swig_r 1075 | } 1076 | 1077 | func (arg1 SwigcptrVariable) Lb() (_swig_ret float64) { 1078 | var swig_r float64 1079 | _swig_i_0 := arg1 1080 | swig_r = (float64)(C._wrap_Variable_lb_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 1081 | return swig_r 1082 | } 1083 | 1084 | func (arg1 SwigcptrVariable) Ub() (_swig_ret float64) { 1085 | var swig_r float64 1086 | _swig_i_0 := arg1 1087 | swig_r = (float64)(C._wrap_Variable_ub_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 1088 | return swig_r 1089 | } 1090 | 1091 | func (arg1 SwigcptrVariable) SetBounds(arg2 float64, arg3 float64) { 1092 | _swig_i_0 := arg1 1093 | _swig_i_1 := arg2 1094 | _swig_i_2 := arg3 1095 | C._wrap_Variable_SetBounds_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.double(_swig_i_1), C.double(_swig_i_2)) 1096 | } 1097 | 1098 | func (arg1 SwigcptrVariable) Reduced_cost() (_swig_ret float64) { 1099 | var swig_r float64 1100 | _swig_i_0 := arg1 1101 | swig_r = (float64)(C._wrap_Variable_reduced_cost_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 1102 | return swig_r 1103 | } 1104 | 1105 | func (arg1 SwigcptrVariable) Basis_status() (_swig_ret Operations_researchMPSolverBasisStatus) { 1106 | var swig_r Operations_researchMPSolverBasisStatus 1107 | _swig_i_0 := arg1 1108 | swig_r = (Operations_researchMPSolverBasisStatus)(C._wrap_Variable_basis_status_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 1109 | return swig_r 1110 | } 1111 | 1112 | func (arg1 SwigcptrVariable) X__str__() (_swig_ret string) { 1113 | var swig_r string 1114 | _swig_i_0 := arg1 1115 | swig_r_p := C._wrap_Variable___str___ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 1116 | swig_r = *(*string)(unsafe.Pointer(&swig_r_p)) 1117 | var swig_r_1 string 1118 | swig_r_1 = swigCopyString(swig_r) 1119 | return swig_r_1 1120 | } 1121 | 1122 | func (arg1 SwigcptrVariable) X__repr__() (_swig_ret string) { 1123 | var swig_r string 1124 | _swig_i_0 := arg1 1125 | swig_r_p := C._wrap_Variable___repr___ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 1126 | swig_r = *(*string)(unsafe.Pointer(&swig_r_p)) 1127 | var swig_r_1 string 1128 | swig_r_1 = swigCopyString(swig_r) 1129 | return swig_r_1 1130 | } 1131 | 1132 | func (arg1 SwigcptrVariable) SolutionValue() (_swig_ret float64) { 1133 | var swig_r float64 1134 | _swig_i_0 := arg1 1135 | swig_r = (float64)(C._wrap_Variable_SolutionValue_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 1136 | return swig_r 1137 | } 1138 | 1139 | func (arg1 SwigcptrVariable) SetLb(arg2 float64) { 1140 | _swig_i_0 := arg1 1141 | _swig_i_1 := arg2 1142 | C._wrap_Variable_SetLb_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.double(_swig_i_1)) 1143 | } 1144 | 1145 | func (arg1 SwigcptrVariable) SetUb(arg2 float64) { 1146 | _swig_i_0 := arg1 1147 | _swig_i_1 := arg2 1148 | C._wrap_Variable_SetUb_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.double(_swig_i_1)) 1149 | } 1150 | 1151 | func (arg1 SwigcptrVariable) ReducedCost() (_swig_ret float64) { 1152 | var swig_r float64 1153 | _swig_i_0 := arg1 1154 | swig_r = (float64)(C._wrap_Variable_ReducedCost_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 1155 | return swig_r 1156 | } 1157 | 1158 | func DeleteVariable(arg1 Variable) { 1159 | _swig_i_0 := arg1.Swigcptr() 1160 | C._wrap_delete_Variable_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 1161 | } 1162 | 1163 | type Variable interface { 1164 | Swigcptr() uintptr 1165 | SwigIsVariable() 1166 | Name() (_swig_ret string) 1167 | SetInteger(arg2 bool) 1168 | Integer() (_swig_ret bool) 1169 | Solution_value() (_swig_ret float64) 1170 | Index() (_swig_ret int) 1171 | Lb() (_swig_ret float64) 1172 | Ub() (_swig_ret float64) 1173 | SetBounds(arg2 float64, arg3 float64) 1174 | Reduced_cost() (_swig_ret float64) 1175 | Basis_status() (_swig_ret Operations_researchMPSolverBasisStatus) 1176 | X__str__() (_swig_ret string) 1177 | X__repr__() (_swig_ret string) 1178 | SolutionValue() (_swig_ret float64) 1179 | SetLb(arg2 float64) 1180 | SetUb(arg2 float64) 1181 | ReducedCost() (_swig_ret float64) 1182 | } 1183 | 1184 | type SwigcptrConstraint uintptr 1185 | 1186 | func (p SwigcptrConstraint) Swigcptr() uintptr { 1187 | return (uintptr)(p) 1188 | } 1189 | 1190 | func (p SwigcptrConstraint) SwigIsConstraint() { 1191 | } 1192 | 1193 | func (arg1 SwigcptrConstraint) Name() (_swig_ret string) { 1194 | var swig_r string 1195 | _swig_i_0 := arg1 1196 | swig_r_p := C._wrap_Constraint_name_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 1197 | swig_r = *(*string)(unsafe.Pointer(&swig_r_p)) 1198 | var swig_r_1 string 1199 | swig_r_1 = swigCopyString(swig_r) 1200 | return swig_r_1 1201 | } 1202 | 1203 | func (arg1 SwigcptrConstraint) Clear() { 1204 | _swig_i_0 := arg1 1205 | C._wrap_Constraint_Clear_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 1206 | } 1207 | 1208 | func (arg1 SwigcptrConstraint) SetCoefficient(arg2 Variable, arg3 float64) { 1209 | _swig_i_0 := arg1 1210 | _swig_i_1 := arg2.Swigcptr() 1211 | _swig_i_2 := arg3 1212 | C._wrap_Constraint_SetCoefficient_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1), C.double(_swig_i_2)) 1213 | } 1214 | 1215 | func (arg1 SwigcptrConstraint) GetCoefficient(arg2 Variable) (_swig_ret float64) { 1216 | var swig_r float64 1217 | _swig_i_0 := arg1 1218 | _swig_i_1 := arg2.Swigcptr() 1219 | swig_r = (float64)(C._wrap_Constraint_GetCoefficient_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1))) 1220 | return swig_r 1221 | } 1222 | 1223 | func (arg1 SwigcptrConstraint) Lb() (_swig_ret float64) { 1224 | var swig_r float64 1225 | _swig_i_0 := arg1 1226 | swig_r = (float64)(C._wrap_Constraint_lb_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 1227 | return swig_r 1228 | } 1229 | 1230 | func (arg1 SwigcptrConstraint) Ub() (_swig_ret float64) { 1231 | var swig_r float64 1232 | _swig_i_0 := arg1 1233 | swig_r = (float64)(C._wrap_Constraint_ub_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 1234 | return swig_r 1235 | } 1236 | 1237 | func (arg1 SwigcptrConstraint) SetBounds(arg2 float64, arg3 float64) { 1238 | _swig_i_0 := arg1 1239 | _swig_i_1 := arg2 1240 | _swig_i_2 := arg3 1241 | C._wrap_Constraint_SetBounds_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.double(_swig_i_1), C.double(_swig_i_2)) 1242 | } 1243 | 1244 | func (arg1 SwigcptrConstraint) Set_is_lazy(arg2 bool) { 1245 | _swig_i_0 := arg1 1246 | _swig_i_1 := arg2 1247 | C._wrap_Constraint_set_is_lazy_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C._Bool(_swig_i_1)) 1248 | } 1249 | 1250 | func (arg1 SwigcptrConstraint) Index() (_swig_ret int) { 1251 | var swig_r int 1252 | _swig_i_0 := arg1 1253 | swig_r = (int)(C._wrap_Constraint_index_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 1254 | return swig_r 1255 | } 1256 | 1257 | func (arg1 SwigcptrConstraint) Dual_value() (_swig_ret float64) { 1258 | var swig_r float64 1259 | _swig_i_0 := arg1 1260 | swig_r = (float64)(C._wrap_Constraint_dual_value_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 1261 | return swig_r 1262 | } 1263 | 1264 | func (arg1 SwigcptrConstraint) Basis_status() (_swig_ret Operations_researchMPSolverBasisStatus) { 1265 | var swig_r Operations_researchMPSolverBasisStatus 1266 | _swig_i_0 := arg1 1267 | swig_r = (Operations_researchMPSolverBasisStatus)(C._wrap_Constraint_basis_status_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 1268 | return swig_r 1269 | } 1270 | 1271 | func (arg1 SwigcptrConstraint) SetLb(arg2 float64) { 1272 | _swig_i_0 := arg1 1273 | _swig_i_1 := arg2 1274 | C._wrap_Constraint_SetLb_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.double(_swig_i_1)) 1275 | } 1276 | 1277 | func (arg1 SwigcptrConstraint) SetUb(arg2 float64) { 1278 | _swig_i_0 := arg1 1279 | _swig_i_1 := arg2 1280 | C._wrap_Constraint_SetUb_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.double(_swig_i_1)) 1281 | } 1282 | 1283 | func (arg1 SwigcptrConstraint) DualValue() (_swig_ret float64) { 1284 | var swig_r float64 1285 | _swig_i_0 := arg1 1286 | swig_r = (float64)(C._wrap_Constraint_DualValue_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0))) 1287 | return swig_r 1288 | } 1289 | 1290 | func DeleteConstraint(arg1 Constraint) { 1291 | _swig_i_0 := arg1.Swigcptr() 1292 | C._wrap_delete_Constraint_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 1293 | } 1294 | 1295 | type Constraint interface { 1296 | Swigcptr() uintptr 1297 | SwigIsConstraint() 1298 | Name() (_swig_ret string) 1299 | Clear() 1300 | SetCoefficient(arg2 Variable, arg3 float64) 1301 | GetCoefficient(arg2 Variable) (_swig_ret float64) 1302 | Lb() (_swig_ret float64) 1303 | Ub() (_swig_ret float64) 1304 | SetBounds(arg2 float64, arg3 float64) 1305 | Set_is_lazy(arg2 bool) 1306 | Index() (_swig_ret int) 1307 | Dual_value() (_swig_ret float64) 1308 | Basis_status() (_swig_ret Operations_researchMPSolverBasisStatus) 1309 | SetLb(arg2 float64) 1310 | SetUb(arg2 float64) 1311 | DualValue() (_swig_ret float64) 1312 | } 1313 | 1314 | type SwigcptrMPSolverParameters uintptr 1315 | 1316 | func (p SwigcptrMPSolverParameters) Swigcptr() uintptr { 1317 | return (uintptr)(p) 1318 | } 1319 | 1320 | func (p SwigcptrMPSolverParameters) SwigIsMPSolverParameters() { 1321 | } 1322 | 1323 | type Operations_researchMPSolverParametersDoubleParam int 1324 | func _swig_getMPSolverParameters_RELATIVE_MIP_GAP_MPSolverParameters() (_swig_ret Operations_researchMPSolverParametersDoubleParam) { 1325 | var swig_r Operations_researchMPSolverParametersDoubleParam 1326 | swig_r = (Operations_researchMPSolverParametersDoubleParam)(C._wrap_RELATIVE_MIP_GAP_MPSolverParameters_ortoolsswig_fe88f1954daf0526()) 1327 | return swig_r 1328 | } 1329 | 1330 | var MPSolverParametersRELATIVE_MIP_GAP Operations_researchMPSolverParametersDoubleParam = _swig_getMPSolverParameters_RELATIVE_MIP_GAP_MPSolverParameters() 1331 | func _swig_getMPSolverParameters_PRIMAL_TOLERANCE_MPSolverParameters() (_swig_ret Operations_researchMPSolverParametersDoubleParam) { 1332 | var swig_r Operations_researchMPSolverParametersDoubleParam 1333 | swig_r = (Operations_researchMPSolverParametersDoubleParam)(C._wrap_PRIMAL_TOLERANCE_MPSolverParameters_ortoolsswig_fe88f1954daf0526()) 1334 | return swig_r 1335 | } 1336 | 1337 | var MPSolverParametersPRIMAL_TOLERANCE Operations_researchMPSolverParametersDoubleParam = _swig_getMPSolverParameters_PRIMAL_TOLERANCE_MPSolverParameters() 1338 | func _swig_getMPSolverParameters_DUAL_TOLERANCE_MPSolverParameters() (_swig_ret Operations_researchMPSolverParametersDoubleParam) { 1339 | var swig_r Operations_researchMPSolverParametersDoubleParam 1340 | swig_r = (Operations_researchMPSolverParametersDoubleParam)(C._wrap_DUAL_TOLERANCE_MPSolverParameters_ortoolsswig_fe88f1954daf0526()) 1341 | return swig_r 1342 | } 1343 | 1344 | var MPSolverParametersDUAL_TOLERANCE Operations_researchMPSolverParametersDoubleParam = _swig_getMPSolverParameters_DUAL_TOLERANCE_MPSolverParameters() 1345 | type Operations_researchMPSolverParametersIntegerParam int 1346 | func _swig_getMPSolverParameters_PRESOLVE_MPSolverParameters() (_swig_ret Operations_researchMPSolverParametersIntegerParam) { 1347 | var swig_r Operations_researchMPSolverParametersIntegerParam 1348 | swig_r = (Operations_researchMPSolverParametersIntegerParam)(C._wrap_PRESOLVE_MPSolverParameters_ortoolsswig_fe88f1954daf0526()) 1349 | return swig_r 1350 | } 1351 | 1352 | var MPSolverParametersPRESOLVE Operations_researchMPSolverParametersIntegerParam = _swig_getMPSolverParameters_PRESOLVE_MPSolverParameters() 1353 | func _swig_getMPSolverParameters_LP_ALGORITHM_MPSolverParameters() (_swig_ret Operations_researchMPSolverParametersIntegerParam) { 1354 | var swig_r Operations_researchMPSolverParametersIntegerParam 1355 | swig_r = (Operations_researchMPSolverParametersIntegerParam)(C._wrap_LP_ALGORITHM_MPSolverParameters_ortoolsswig_fe88f1954daf0526()) 1356 | return swig_r 1357 | } 1358 | 1359 | var MPSolverParametersLP_ALGORITHM Operations_researchMPSolverParametersIntegerParam = _swig_getMPSolverParameters_LP_ALGORITHM_MPSolverParameters() 1360 | func _swig_getMPSolverParameters_INCREMENTALITY_MPSolverParameters() (_swig_ret Operations_researchMPSolverParametersIntegerParam) { 1361 | var swig_r Operations_researchMPSolverParametersIntegerParam 1362 | swig_r = (Operations_researchMPSolverParametersIntegerParam)(C._wrap_INCREMENTALITY_MPSolverParameters_ortoolsswig_fe88f1954daf0526()) 1363 | return swig_r 1364 | } 1365 | 1366 | var MPSolverParametersINCREMENTALITY Operations_researchMPSolverParametersIntegerParam = _swig_getMPSolverParameters_INCREMENTALITY_MPSolverParameters() 1367 | func _swig_getMPSolverParameters_SCALING_MPSolverParameters() (_swig_ret Operations_researchMPSolverParametersIntegerParam) { 1368 | var swig_r Operations_researchMPSolverParametersIntegerParam 1369 | swig_r = (Operations_researchMPSolverParametersIntegerParam)(C._wrap_SCALING_MPSolverParameters_ortoolsswig_fe88f1954daf0526()) 1370 | return swig_r 1371 | } 1372 | 1373 | var MPSolverParametersSCALING Operations_researchMPSolverParametersIntegerParam = _swig_getMPSolverParameters_SCALING_MPSolverParameters() 1374 | type Operations_researchMPSolverParametersPresolveValues int 1375 | func _swig_getMPSolverParameters_PRESOLVE_OFF_MPSolverParameters() (_swig_ret Operations_researchMPSolverParametersPresolveValues) { 1376 | var swig_r Operations_researchMPSolverParametersPresolveValues 1377 | swig_r = (Operations_researchMPSolverParametersPresolveValues)(C._wrap_PRESOLVE_OFF_MPSolverParameters_ortoolsswig_fe88f1954daf0526()) 1378 | return swig_r 1379 | } 1380 | 1381 | var MPSolverParametersPRESOLVE_OFF Operations_researchMPSolverParametersPresolveValues = _swig_getMPSolverParameters_PRESOLVE_OFF_MPSolverParameters() 1382 | func _swig_getMPSolverParameters_PRESOLVE_ON_MPSolverParameters() (_swig_ret Operations_researchMPSolverParametersPresolveValues) { 1383 | var swig_r Operations_researchMPSolverParametersPresolveValues 1384 | swig_r = (Operations_researchMPSolverParametersPresolveValues)(C._wrap_PRESOLVE_ON_MPSolverParameters_ortoolsswig_fe88f1954daf0526()) 1385 | return swig_r 1386 | } 1387 | 1388 | var MPSolverParametersPRESOLVE_ON Operations_researchMPSolverParametersPresolveValues = _swig_getMPSolverParameters_PRESOLVE_ON_MPSolverParameters() 1389 | type Operations_researchMPSolverParametersLpAlgorithmValues int 1390 | func _swig_getMPSolverParameters_DUAL_MPSolverParameters() (_swig_ret Operations_researchMPSolverParametersLpAlgorithmValues) { 1391 | var swig_r Operations_researchMPSolverParametersLpAlgorithmValues 1392 | swig_r = (Operations_researchMPSolverParametersLpAlgorithmValues)(C._wrap_DUAL_MPSolverParameters_ortoolsswig_fe88f1954daf0526()) 1393 | return swig_r 1394 | } 1395 | 1396 | var MPSolverParametersDUAL Operations_researchMPSolverParametersLpAlgorithmValues = _swig_getMPSolverParameters_DUAL_MPSolverParameters() 1397 | func _swig_getMPSolverParameters_PRIMAL_MPSolverParameters() (_swig_ret Operations_researchMPSolverParametersLpAlgorithmValues) { 1398 | var swig_r Operations_researchMPSolverParametersLpAlgorithmValues 1399 | swig_r = (Operations_researchMPSolverParametersLpAlgorithmValues)(C._wrap_PRIMAL_MPSolverParameters_ortoolsswig_fe88f1954daf0526()) 1400 | return swig_r 1401 | } 1402 | 1403 | var MPSolverParametersPRIMAL Operations_researchMPSolverParametersLpAlgorithmValues = _swig_getMPSolverParameters_PRIMAL_MPSolverParameters() 1404 | func _swig_getMPSolverParameters_BARRIER_MPSolverParameters() (_swig_ret Operations_researchMPSolverParametersLpAlgorithmValues) { 1405 | var swig_r Operations_researchMPSolverParametersLpAlgorithmValues 1406 | swig_r = (Operations_researchMPSolverParametersLpAlgorithmValues)(C._wrap_BARRIER_MPSolverParameters_ortoolsswig_fe88f1954daf0526()) 1407 | return swig_r 1408 | } 1409 | 1410 | var MPSolverParametersBARRIER Operations_researchMPSolverParametersLpAlgorithmValues = _swig_getMPSolverParameters_BARRIER_MPSolverParameters() 1411 | type Operations_researchMPSolverParametersIncrementalityValues int 1412 | func _swig_getMPSolverParameters_INCREMENTALITY_OFF_MPSolverParameters() (_swig_ret Operations_researchMPSolverParametersIncrementalityValues) { 1413 | var swig_r Operations_researchMPSolverParametersIncrementalityValues 1414 | swig_r = (Operations_researchMPSolverParametersIncrementalityValues)(C._wrap_INCREMENTALITY_OFF_MPSolverParameters_ortoolsswig_fe88f1954daf0526()) 1415 | return swig_r 1416 | } 1417 | 1418 | var MPSolverParametersINCREMENTALITY_OFF Operations_researchMPSolverParametersIncrementalityValues = _swig_getMPSolverParameters_INCREMENTALITY_OFF_MPSolverParameters() 1419 | func _swig_getMPSolverParameters_INCREMENTALITY_ON_MPSolverParameters() (_swig_ret Operations_researchMPSolverParametersIncrementalityValues) { 1420 | var swig_r Operations_researchMPSolverParametersIncrementalityValues 1421 | swig_r = (Operations_researchMPSolverParametersIncrementalityValues)(C._wrap_INCREMENTALITY_ON_MPSolverParameters_ortoolsswig_fe88f1954daf0526()) 1422 | return swig_r 1423 | } 1424 | 1425 | var MPSolverParametersINCREMENTALITY_ON Operations_researchMPSolverParametersIncrementalityValues = _swig_getMPSolverParameters_INCREMENTALITY_ON_MPSolverParameters() 1426 | type Operations_researchMPSolverParametersScalingValues int 1427 | func _swig_getMPSolverParameters_SCALING_OFF_MPSolverParameters() (_swig_ret Operations_researchMPSolverParametersScalingValues) { 1428 | var swig_r Operations_researchMPSolverParametersScalingValues 1429 | swig_r = (Operations_researchMPSolverParametersScalingValues)(C._wrap_SCALING_OFF_MPSolverParameters_ortoolsswig_fe88f1954daf0526()) 1430 | return swig_r 1431 | } 1432 | 1433 | var MPSolverParametersSCALING_OFF Operations_researchMPSolverParametersScalingValues = _swig_getMPSolverParameters_SCALING_OFF_MPSolverParameters() 1434 | func _swig_getMPSolverParameters_SCALING_ON_MPSolverParameters() (_swig_ret Operations_researchMPSolverParametersScalingValues) { 1435 | var swig_r Operations_researchMPSolverParametersScalingValues 1436 | swig_r = (Operations_researchMPSolverParametersScalingValues)(C._wrap_SCALING_ON_MPSolverParameters_ortoolsswig_fe88f1954daf0526()) 1437 | return swig_r 1438 | } 1439 | 1440 | var MPSolverParametersSCALING_ON Operations_researchMPSolverParametersScalingValues = _swig_getMPSolverParameters_SCALING_ON_MPSolverParameters() 1441 | func GetMPSolverParametersKDefaultRelativeMipGap() (_swig_ret float64) { 1442 | var swig_r float64 1443 | swig_r = (float64)(C._wrap_MPSolverParameters_kDefaultRelativeMipGap_get_ortoolsswig_fe88f1954daf0526()) 1444 | return swig_r 1445 | } 1446 | 1447 | func GetMPSolverParametersKDefaultPrimalTolerance() (_swig_ret float64) { 1448 | var swig_r float64 1449 | swig_r = (float64)(C._wrap_MPSolverParameters_kDefaultPrimalTolerance_get_ortoolsswig_fe88f1954daf0526()) 1450 | return swig_r 1451 | } 1452 | 1453 | func GetMPSolverParametersKDefaultDualTolerance() (_swig_ret float64) { 1454 | var swig_r float64 1455 | swig_r = (float64)(C._wrap_MPSolverParameters_kDefaultDualTolerance_get_ortoolsswig_fe88f1954daf0526()) 1456 | return swig_r 1457 | } 1458 | 1459 | func GetMPSolverParametersKDefaultPresolve() (_swig_ret Operations_researchMPSolverParametersPresolveValues) { 1460 | var swig_r Operations_researchMPSolverParametersPresolveValues 1461 | swig_r = (Operations_researchMPSolverParametersPresolveValues)(C._wrap_MPSolverParameters_kDefaultPresolve_get_ortoolsswig_fe88f1954daf0526()) 1462 | return swig_r 1463 | } 1464 | 1465 | func GetMPSolverParametersKDefaultIncrementality() (_swig_ret Operations_researchMPSolverParametersIncrementalityValues) { 1466 | var swig_r Operations_researchMPSolverParametersIncrementalityValues 1467 | swig_r = (Operations_researchMPSolverParametersIncrementalityValues)(C._wrap_MPSolverParameters_kDefaultIncrementality_get_ortoolsswig_fe88f1954daf0526()) 1468 | return swig_r 1469 | } 1470 | 1471 | func NewMPSolverParameters() (_swig_ret MPSolverParameters) { 1472 | var swig_r MPSolverParameters 1473 | swig_r = (MPSolverParameters)(SwigcptrMPSolverParameters(C._wrap_new_MPSolverParameters_ortoolsswig_fe88f1954daf0526())) 1474 | return swig_r 1475 | } 1476 | 1477 | func (arg1 SwigcptrMPSolverParameters) SetDoubleParam(arg2 Operations_researchMPSolverParametersDoubleParam, arg3 float64) { 1478 | _swig_i_0 := arg1 1479 | _swig_i_1 := arg2 1480 | _swig_i_2 := arg3 1481 | C._wrap_MPSolverParameters_SetDoubleParam_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.swig_intgo(_swig_i_1), C.double(_swig_i_2)) 1482 | } 1483 | 1484 | func (arg1 SwigcptrMPSolverParameters) SetIntegerParam(arg2 Operations_researchMPSolverParametersIntegerParam, arg3 int) { 1485 | _swig_i_0 := arg1 1486 | _swig_i_1 := arg2 1487 | _swig_i_2 := arg3 1488 | C._wrap_MPSolverParameters_SetIntegerParam_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.swig_intgo(_swig_i_1), C.swig_intgo(_swig_i_2)) 1489 | } 1490 | 1491 | func (arg1 SwigcptrMPSolverParameters) GetDoubleParam(arg2 Operations_researchMPSolverParametersDoubleParam) (_swig_ret float64) { 1492 | var swig_r float64 1493 | _swig_i_0 := arg1 1494 | _swig_i_1 := arg2 1495 | swig_r = (float64)(C._wrap_MPSolverParameters_GetDoubleParam_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.swig_intgo(_swig_i_1))) 1496 | return swig_r 1497 | } 1498 | 1499 | func (arg1 SwigcptrMPSolverParameters) GetIntegerParam(arg2 Operations_researchMPSolverParametersIntegerParam) (_swig_ret int) { 1500 | var swig_r int 1501 | _swig_i_0 := arg1 1502 | _swig_i_1 := arg2 1503 | swig_r = (int)(C._wrap_MPSolverParameters_GetIntegerParam_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.swig_intgo(_swig_i_1))) 1504 | return swig_r 1505 | } 1506 | 1507 | func DeleteMPSolverParameters(arg1 MPSolverParameters) { 1508 | _swig_i_0 := arg1.Swigcptr() 1509 | C._wrap_delete_MPSolverParameters_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 1510 | } 1511 | 1512 | type MPSolverParameters interface { 1513 | Swigcptr() uintptr 1514 | SwigIsMPSolverParameters() 1515 | SetDoubleParam(arg2 Operations_researchMPSolverParametersDoubleParam, arg3 float64) 1516 | SetIntegerParam(arg2 Operations_researchMPSolverParametersIntegerParam, arg3 int) 1517 | GetDoubleParam(arg2 Operations_researchMPSolverParametersDoubleParam) (_swig_ret float64) 1518 | GetIntegerParam(arg2 Operations_researchMPSolverParametersIntegerParam) (_swig_ret int) 1519 | } 1520 | 1521 | type SwigcptrModelExportOptions uintptr 1522 | 1523 | func (p SwigcptrModelExportOptions) Swigcptr() uintptr { 1524 | return (uintptr)(p) 1525 | } 1526 | 1527 | func (p SwigcptrModelExportOptions) SwigIsModelExportOptions() { 1528 | } 1529 | 1530 | func NewModelExportOptions() (_swig_ret ModelExportOptions) { 1531 | var swig_r ModelExportOptions 1532 | swig_r = (ModelExportOptions)(SwigcptrModelExportOptions(C._wrap_new_ModelExportOptions_ortoolsswig_fe88f1954daf0526())) 1533 | return swig_r 1534 | } 1535 | 1536 | func DeleteModelExportOptions(arg1 ModelExportOptions) { 1537 | _swig_i_0 := arg1.Swigcptr() 1538 | C._wrap_delete_ModelExportOptions_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 1539 | } 1540 | 1541 | type ModelExportOptions interface { 1542 | Swigcptr() uintptr 1543 | SwigIsModelExportOptions() 1544 | } 1545 | 1546 | func ExportModelAsLpFormat__SWIG_0(arg1 Operations_research_MPModelProto, arg2 ModelExportOptions) (_swig_ret string) { 1547 | var swig_r string 1548 | _swig_i_0 := arg1.Swigcptr() 1549 | _swig_i_1 := arg2.Swigcptr() 1550 | swig_r_p := C._wrap_ExportModelAsLpFormat__SWIG_0_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1)) 1551 | swig_r = *(*string)(unsafe.Pointer(&swig_r_p)) 1552 | var swig_r_1 string 1553 | swig_r_1 = swigCopyString(swig_r) 1554 | return swig_r_1 1555 | } 1556 | 1557 | func ExportModelAsLpFormat__SWIG_1(arg1 Operations_research_MPModelProto) (_swig_ret string) { 1558 | var swig_r string 1559 | _swig_i_0 := arg1.Swigcptr() 1560 | swig_r_p := C._wrap_ExportModelAsLpFormat__SWIG_1_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 1561 | swig_r = *(*string)(unsafe.Pointer(&swig_r_p)) 1562 | var swig_r_1 string 1563 | swig_r_1 = swigCopyString(swig_r) 1564 | return swig_r_1 1565 | } 1566 | 1567 | func ExportModelAsLpFormat(a ...interface{}) string { 1568 | argc := len(a) 1569 | if argc == 1 { 1570 | return ExportModelAsLpFormat__SWIG_1(a[0].(Operations_research_MPModelProto)) 1571 | } 1572 | if argc == 2 { 1573 | return ExportModelAsLpFormat__SWIG_0(a[0].(Operations_research_MPModelProto), a[1].(ModelExportOptions)) 1574 | } 1575 | panic("No match for overloaded function call") 1576 | } 1577 | 1578 | func ExportModelAsMpsFormat__SWIG_0(arg1 Operations_research_MPModelProto, arg2 ModelExportOptions) (_swig_ret string) { 1579 | var swig_r string 1580 | _swig_i_0 := arg1.Swigcptr() 1581 | _swig_i_1 := arg2.Swigcptr() 1582 | swig_r_p := C._wrap_ExportModelAsMpsFormat__SWIG_0_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1)) 1583 | swig_r = *(*string)(unsafe.Pointer(&swig_r_p)) 1584 | var swig_r_1 string 1585 | swig_r_1 = swigCopyString(swig_r) 1586 | return swig_r_1 1587 | } 1588 | 1589 | func ExportModelAsMpsFormat__SWIG_1(arg1 Operations_research_MPModelProto) (_swig_ret string) { 1590 | var swig_r string 1591 | _swig_i_0 := arg1.Swigcptr() 1592 | swig_r_p := C._wrap_ExportModelAsMpsFormat__SWIG_1_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 1593 | swig_r = *(*string)(unsafe.Pointer(&swig_r_p)) 1594 | var swig_r_1 string 1595 | swig_r_1 = swigCopyString(swig_r) 1596 | return swig_r_1 1597 | } 1598 | 1599 | func ExportModelAsMpsFormat(a ...interface{}) string { 1600 | argc := len(a) 1601 | if argc == 1 { 1602 | return ExportModelAsMpsFormat__SWIG_1(a[0].(Operations_research_MPModelProto)) 1603 | } 1604 | if argc == 2 { 1605 | return ExportModelAsMpsFormat__SWIG_0(a[0].(Operations_research_MPModelProto), a[1].(ModelExportOptions)) 1606 | } 1607 | panic("No match for overloaded function call") 1608 | } 1609 | 1610 | func FindErrorInModelProto(arg1 Operations_research_MPModelProto) (_swig_ret string) { 1611 | var swig_r string 1612 | _swig_i_0 := arg1.Swigcptr() 1613 | swig_r_p := C._wrap_FindErrorInModelProto_ortoolsswig_fe88f1954daf0526(C.uintptr_t(_swig_i_0)) 1614 | swig_r = *(*string)(unsafe.Pointer(&swig_r_p)) 1615 | var swig_r_1 string 1616 | swig_r_1 = swigCopyString(swig_r) 1617 | return swig_r_1 1618 | } 1619 | 1620 | 1621 | type SwigcptrStd_vector_Sl_operations_research_MPConstraint_Sm__Sg_ uintptr 1622 | type Std_vector_Sl_operations_research_MPConstraint_Sm__Sg_ interface { 1623 | Swigcptr() uintptr; 1624 | } 1625 | func (p SwigcptrStd_vector_Sl_operations_research_MPConstraint_Sm__Sg_) Swigcptr() uintptr { 1626 | return uintptr(p) 1627 | } 1628 | 1629 | type SwigcptrOperations_research_MPModelProto uintptr 1630 | type Operations_research_MPModelProto interface { 1631 | Swigcptr() uintptr; 1632 | } 1633 | func (p SwigcptrOperations_research_MPModelProto) Swigcptr() uintptr { 1634 | return uintptr(p) 1635 | } 1636 | 1637 | type SwigcptrInt64 uintptr 1638 | type Int64 interface { 1639 | Swigcptr() uintptr; 1640 | } 1641 | func (p SwigcptrInt64) Swigcptr() uintptr { 1642 | return uintptr(p) 1643 | } 1644 | 1645 | type SwigcptrAbsl_Status uintptr 1646 | type Absl_Status interface { 1647 | Swigcptr() uintptr; 1648 | } 1649 | func (p SwigcptrAbsl_Status) Swigcptr() uintptr { 1650 | return uintptr(p) 1651 | } 1652 | 1653 | type SwigcptrStd_vector_Sl_operations_research_MPVariable_Sm__Sg_ uintptr 1654 | type Std_vector_Sl_operations_research_MPVariable_Sm__Sg_ interface { 1655 | Swigcptr() uintptr; 1656 | } 1657 | func (p SwigcptrStd_vector_Sl_operations_research_MPVariable_Sm__Sg_) Swigcptr() uintptr { 1658 | return uintptr(p) 1659 | } 1660 | 1661 | type SwigcptrStd_vector_Sl_double_Sg_ uintptr 1662 | type Std_vector_Sl_double_Sg_ interface { 1663 | Swigcptr() uintptr; 1664 | } 1665 | func (p SwigcptrStd_vector_Sl_double_Sg_) Swigcptr() uintptr { 1666 | return uintptr(p) 1667 | } 1668 | 1669 | type SwigcptrStd_atomic_Sl_bool_Sg_ uintptr 1670 | type Std_atomic_Sl_bool_Sg_ interface { 1671 | Swigcptr() uintptr; 1672 | } 1673 | func (p SwigcptrStd_atomic_Sl_bool_Sg_) Swigcptr() uintptr { 1674 | return uintptr(p) 1675 | } 1676 | 1677 | type SwigcptrOperations_research_MPSolutionResponse uintptr 1678 | type Operations_research_MPSolutionResponse interface { 1679 | Swigcptr() uintptr; 1680 | } 1681 | func (p SwigcptrOperations_research_MPSolutionResponse) Swigcptr() uintptr { 1682 | return uintptr(p) 1683 | } 1684 | 1685 | type SwigcptrOperations_research_MPModelRequest uintptr 1686 | type Operations_research_MPModelRequest interface { 1687 | Swigcptr() uintptr; 1688 | } 1689 | func (p SwigcptrOperations_research_MPModelRequest) Swigcptr() uintptr { 1690 | return uintptr(p) 1691 | } 1692 | 1693 | -------------------------------------------------------------------------------- /ortoolsswig/ortoolsswig_doc.go: -------------------------------------------------------------------------------- 1 | // Package ortoolsswig is where the raw SWIG bindings to the OR Tools library live. 2 | // 3 | // Rather than work with these bindings directly, consider adding functionality 4 | // to github.com/gonzojive/or-tools-go/ortools. 5 | package ortoolsswig 6 | -------------------------------------------------------------------------------- /ortoolsswig/ortoolsswig_test.go: -------------------------------------------------------------------------------- 1 | package ortoolsswig 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/google/go-cmp/cmp" 7 | "github.com/google/go-cmp/cmp/cmpopts" 8 | ) 9 | 10 | var ( 11 | cmpOpts = []cmp.Option{ 12 | cmpopts.EquateApprox(1e-4, 1e-4), 13 | } 14 | ) 15 | 16 | func TestNewSolver(t *testing.T) { 17 | tests := []struct { 18 | name string 19 | got, want interface{} 20 | }{ 21 | {"test 1", "a", "a"}, 22 | } 23 | for _, tt := range tests { 24 | t.Run(tt.name, func(t *testing.T) { 25 | if diff := cmp.Diff(tt.want, tt.got); diff != "" { 26 | t.Errorf("unexpected diff (-want, +got):\n%s", diff) 27 | } 28 | }) 29 | } 30 | } 31 | 32 | // TestSolver is based on https://developers.google.com/optimization/lp/glop. 33 | func TestSolver(t *testing.T) { 34 | solver := NewSolver("LinearProgrammingExample", SolverGLOP_LINEAR_PROGRAMMING) 35 | x := solver.NumVar(0, SolverInfinity(), "x") 36 | y := solver.NumVar(0, SolverInfinity(), "y") 37 | 38 | // Constraint 0: x + 2y <= 14. 39 | constraint0 := solver.Constraint(-SolverInfinity(), float64(14)) 40 | //constraint0 := solver.Constraint() 41 | constraint0.SetCoefficient(x, 1) 42 | constraint0.SetCoefficient(y, 2) 43 | 44 | // Constraint 1: 3x - y >= 0. 45 | constraint1 := solver.Constraint(0.0, SolverInfinity()) 46 | constraint1.SetCoefficient(x, 3) 47 | constraint1.SetCoefficient(y, -1) 48 | 49 | // Constraint 2: x - y <= 2. 50 | constraint2 := solver.Constraint(-SolverInfinity(), 2.0) 51 | constraint2.SetCoefficient(x, 1) 52 | constraint2.SetCoefficient(y, -1) 53 | 54 | // Objective function: 3x + 4y. 55 | objective := solver.Objective() 56 | objective.SetCoefficient(x, 3) 57 | objective.SetCoefficient(y, 4) 58 | objective.SetMaximization() 59 | 60 | status := solver.Solve() 61 | t.Logf("solver status: %v", status) 62 | 63 | opt := 3*x.SolutionValue() + 4*y.SolutionValue() 64 | t.Logf("optimizal solution: 3 * %v + 4 * %v = %v", x.SolutionValue(), y.SolutionValue(), opt) 65 | 66 | if got, want := solver.NumVariables(), 2; got != want { 67 | t.Errorf("got %d variables, want %d", got, want) 68 | } 69 | if got, want := solver.NumConstraints(), 3; got != want { 70 | t.Errorf("got %d variables, want %d", got, want) 71 | } 72 | if got, want := x.SolutionValue(), 6.0; !cmp.Equal(got, want, cmpOpts...) { 73 | t.Errorf("got x_opt = %v, want %v", got, want) 74 | } 75 | if got, want := y.SolutionValue(), 4.0; !cmp.Equal(got, want, cmpOpts...) { 76 | t.Errorf("got y_opt = %v, want %v", got, want) 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /third_party/BUILD.bazel: -------------------------------------------------------------------------------- 1 | licenses(["notice"]) # Apache 2.0 2 | 3 | exports_files([ 4 | "pcre.BUILD", 5 | "scip.BUILD", 6 | "swig.BUILD", 7 | ]) 8 | 9 | sh_binary( 10 | name = "bazel-swig", 11 | srcs = ["bazel-swig.sh"], 12 | data = [ 13 | "@swig//:templates", 14 | "@swig//:swig", 15 | ], 16 | deps = ["@bazel_tools//tools/bash/runfiles"], 17 | ) 18 | -------------------------------------------------------------------------------- /third_party/bazel-swig.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # --- begin runfiles.bash initialization v2 --- 5 | # Copy-pasted from the Bazel Bash runfiles library v2. 6 | set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash 7 | source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ 8 | source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \ 9 | source "$0.runfiles/$f" 2>/dev/null || \ 10 | source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ 11 | source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ 12 | { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e 13 | # --- end runfiles.bash initialization v2 --- 14 | 15 | LIBDIR=`dirname $(rlocation swig/Lib/allkw.swg)` 16 | 17 | # Include all of the standard swig templates 18 | # See https://gitlab-extern.ivi.fraunhofer.de/philipps/or-tools/-/blob/9c5f3cffba703fd72d1ae6c75d0d8f10ee341d24/bazel/swig.bzl 19 | $(rlocation swig/swig) \ 20 | "-I$LIBDIR" "-I$LIBDIR/" \ 21 | $@ 22 | -------------------------------------------------------------------------------- /third_party/pcre.BUILD: -------------------------------------------------------------------------------- 1 | licenses(["notice"]) # BSD 2 | 3 | exports_files(["LICENCE"]) 4 | 5 | cc_library( 6 | name = "pcre", 7 | srcs = [ 8 | "pcre_byte_order.c", 9 | "pcre_chartables.c", 10 | "pcre_compile.c", 11 | "pcre_config.c", 12 | "pcre_dfa_exec.c", 13 | "pcre_exec.c", 14 | "pcre_fullinfo.c", 15 | "pcre_get.c", 16 | "pcre_globals.c", 17 | "pcre_internal.h", 18 | "pcre_jit_compile.c", 19 | "pcre_maketables.c", 20 | "pcre_newline.c", 21 | "pcre_ord2utf8.c", 22 | "pcre_refcount.c", 23 | "pcre_string_utils.c", 24 | "pcre_study.c", 25 | "pcre_tables.c", 26 | "pcre_ucd.c", 27 | "pcre_valid_utf8.c", 28 | "pcre_version.c", 29 | "pcre_xclass.c", 30 | "ucp.h", 31 | ], 32 | hdrs = [ 33 | "pcre.h", 34 | "pcreposix.h", 35 | ], 36 | copts = [ 37 | "-DHAVE_BCOPY=1", 38 | "-DHAVE_INTTYPES_H=1", 39 | "-DHAVE_MEMMOVE=1", 40 | "-DHAVE_STDINT_H=1", 41 | "-DHAVE_STRERROR=1", 42 | "-DHAVE_SYS_STAT_H=1", 43 | "-DHAVE_SYS_TYPES_H=1", 44 | "-DHAVE_UNISTD_H=1", 45 | "-DLINK_SIZE=2", 46 | "-DMATCH_LIMIT=10000000", 47 | "-DMATCH_LIMIT_RECURSION=1000", 48 | "-DMAX_NAME_COUNT=10000", 49 | "-DMAX_NAME_SIZE=32", 50 | "-DNEWLINE=10", 51 | "-DNO_RECURSE", 52 | "-DPARENS_NEST_LIMIT=50", 53 | "-DPOSIX_MALLOC_THRESHOLD=10", 54 | "-DSTDC_HEADERS=1", 55 | "-DSUPPORT_UCP", 56 | "-DSUPPORT_UTF", 57 | ], 58 | defines = ["PCRE_STATIC=1"], 59 | includes = ["."], 60 | visibility = ["@swig//:__pkg__"], # Please use RE2 61 | alwayslink = 1, 62 | ) 63 | 64 | genrule( 65 | name = "pcre_h", 66 | srcs = ["pcre.h.in"], 67 | outs = ["pcre.h"], 68 | cmd = "sed -e s/@PCRE_MAJOR@/8/" + 69 | " -e s/@PCRE_MINOR@/39/" + 70 | " -e s/@PCRE_PRERELEASE@//" + 71 | " -e s/@PCRE_DATE@/redacted/" + 72 | " $< >$@", 73 | ) 74 | 75 | genrule( 76 | name = "pcre_chartables_c", 77 | srcs = ["pcre_chartables.c.dist"], 78 | outs = ["pcre_chartables.c"], 79 | cmd = "cp $< $@", 80 | ) 81 | -------------------------------------------------------------------------------- /third_party/scip.BUILD: -------------------------------------------------------------------------------- 1 | # This file is cloned from 2 | # https://github.com/google/or-tools/blob/stable/bazel/scip.BUILD and is subject 3 | # to the license Apache 2.0 license. 4 | 5 | exports_files( 6 | ["src/lpi/lpi_glop.cpp"], 7 | ) 8 | 9 | config_setting( 10 | name = "on_linux", 11 | constraint_values = [ 12 | "@platforms//os:linux", 13 | ], 14 | ) 15 | 16 | config_setting( 17 | name = "on_macos", 18 | constraint_values = [ 19 | "@platforms//os:macos", 20 | ], 21 | ) 22 | 23 | config_setting( 24 | name = "on_windows", 25 | constraint_values = [ 26 | "@platforms//os:windows", 27 | ], 28 | ) 29 | 30 | PLATFORM_FLAGS = select({ 31 | "on_linux": [ 32 | "-Wunknown-pragmas", 33 | "-fexceptions", 34 | "-DSYM=bliss" 35 | ], 36 | "on_macos": [ 37 | "-Wunknown-pragmas", 38 | "-fexceptions", 39 | "-DSYM=bliss" 40 | ], 41 | "on_windows": [ 42 | "/DSYM=none", 43 | "/DSCIP_NO_SIGACTION", 44 | "/DSCIP_NO_STRTOK_R", 45 | ], 46 | "//conditions:default": [], 47 | }) 48 | 49 | PLATFORM_DEPS = select({ 50 | "on_linux": ["@bliss//:libbliss", "@zlib//:zlib"], 51 | "on_macos": ["@bliss//:libbliss", "@zlib//:zlib"], 52 | "on_windows": ["@zlib//:zlib"], 53 | "//conditions:default": [], 54 | }) 55 | 56 | BLISS_FILE = select({ 57 | "on_linux": ["src/symmetry/compute_symmetry_bliss.cpp"], 58 | "on_macos": ["src/symmetry/compute_symmetry_bliss.cpp"], 59 | "on_windows": ["src/symmetry/compute_symmetry_none.cpp"], 60 | "//conditions:default": ["src/symmetry/compute_symmetry_none.cpp"], 61 | }) 62 | 63 | cc_library( 64 | name = "libscip", 65 | srcs = glob( 66 | [ 67 | "src/*/*.c", 68 | ], 69 | exclude = [ 70 | "src/lpi/lpi_*.c", 71 | "src/scip/exprinterpret_*.c", 72 | "src/scip/nlpi_filtersqp.c", 73 | "src/scip/nlpi_worhp.c", 74 | "src/scip/compr_xyz.c", 75 | "src/scip/sorttpl.c", 76 | "src/symmetry/compute_symmetry_*.cpp", 77 | "src/tpi/tpi_*.c", 78 | ], 79 | ) + BLISS_FILE + [ 80 | "src/scip/exprinterpret_none.c", 81 | "src/tpi/tpi_tnycthrd.c", 82 | ], 83 | hdrs = glob( 84 | [ 85 | "src/*/*.h", 86 | "src/*/*.hpp", 87 | "src/scip/githash.c", 88 | "src/scip/sorttpl.c", 89 | "src/scip/buildflags.c", 90 | ], 91 | exclude = 92 | [ 93 | #"src/scip/prop_symmetry.h", 94 | ]), 95 | copts = [ 96 | "$(STACK_FRAME_UNLIMITED)", # src/scip/reader_cnf.c 97 | "-DSCIP_WITH_ZLIB", 98 | "-DWITH_SCIPDEF", 99 | "-DSCIP_ROUNDING_FE", 100 | "-DTPI_TNYC", # src/tpi/type_tpi_tnycthrd.h 101 | # Compile in thead-safe mode (required since we use TPI_TNYC). Note, 102 | # one does not technically need to add this, as SCIP code always 103 | # uses syntax like "#ifndef NPARASCIP". But let's be explicit here. 104 | "-DPARASCIP", 105 | "-Isrc", 106 | "-Isrc/scip", 107 | ] + PLATFORM_FLAGS, 108 | defines = [ 109 | # Scip v800 optionally depends on scip/config.h and 110 | # scip/scip_export.h that are generated by build system. 111 | # 112 | # We need every library and binary that depends on SCIP libraries to 113 | # define this macro. That is why we use `defines' here instead of 114 | # `copts' or `local_defines'. 115 | "NO_CONFIG_HEADER", 116 | ], 117 | features = ["-parse_headers"], 118 | includes = [ 119 | "src", 120 | ], 121 | visibility = ["//visibility:public"], 122 | deps = [ 123 | #"@cppad:cppad_includes", 124 | #"@zlib//:zlib", 125 | #"@bliss//:libbliss", 126 | ] + PLATFORM_DEPS, 127 | ) -------------------------------------------------------------------------------- /third_party/swig.BUILD: -------------------------------------------------------------------------------- 1 | licenses(["restricted"]) # GPLv3 2 | 3 | exports_files(["LICENSE"]) 4 | 5 | cc_binary( 6 | name = "swig", 7 | srcs = [ 8 | "Source/CParse/cparse.h", 9 | "Source/CParse/cscanner.c", 10 | "Source/CParse/parser.h", 11 | "Source/CParse/parser.c", 12 | "Source/CParse/templ.c", 13 | "Source/CParse/util.c", 14 | "Source/DOH/base.c", 15 | "Source/DOH/doh.h", 16 | "Source/DOH/dohint.h", 17 | "Source/DOH/file.c", 18 | "Source/DOH/fio.c", 19 | "Source/DOH/hash.c", 20 | "Source/DOH/list.c", 21 | "Source/DOH/memory.c", 22 | "Source/DOH/string.c", 23 | "Source/DOH/void.c", 24 | "Source/Include/swigconfig.h", 25 | "Source/Include/swigwarn.h", 26 | "Source/Modules/allocate.cxx", 27 | "Source/Modules/browser.cxx", 28 | "Source/Modules/contract.cxx", 29 | "Source/Modules/directors.cxx", 30 | "Source/Modules/emit.cxx", 31 | "Source/Modules/go.cxx", 32 | "Source/Modules/lang.cxx", 33 | "Source/Modules/main.cxx", 34 | "Source/Modules/module.cxx", 35 | "Source/Modules/nested.cxx", 36 | "Source/Modules/overload.cxx", 37 | "Source/Modules/python.cxx", 38 | "Source/Modules/swigmain-lite.cxx", 39 | "Source/Modules/swigmod.h", 40 | "Source/Modules/typepass.cxx", 41 | "Source/Modules/uffi.cxx", 42 | "Source/Modules/utils.cxx", 43 | "Source/Modules/xml.cxx", 44 | "Source/Preprocessor/cpp.c", 45 | "Source/Preprocessor/expr.c", 46 | "Source/Preprocessor/preprocessor.h", 47 | "Source/Swig/cwrap.c", 48 | "Source/Swig/deprecate.c", 49 | "Source/Swig/error.c", 50 | "Source/Swig/extend.c", 51 | "Source/Swig/fragment.c", 52 | "Source/Swig/getopt.c", 53 | "Source/Swig/include.c", 54 | "Source/Swig/misc.c", 55 | "Source/Swig/naming.c", 56 | "Source/Swig/parms.c", 57 | "Source/Swig/scanner.c", 58 | "Source/Swig/stype.c", 59 | "Source/Swig/swig.h", 60 | "Source/Swig/swigfile.h", 61 | "Source/Swig/swigopt.h", 62 | "Source/Swig/swigparm.h", 63 | "Source/Swig/swigscan.h", 64 | "Source/Swig/swigtree.h", 65 | "Source/Swig/swigwrap.h", 66 | "Source/Swig/symbol.c", 67 | "Source/Swig/tree.c", 68 | "Source/Swig/typemap.c", 69 | "Source/Swig/typeobj.c", 70 | "Source/Swig/typesys.c", 71 | "Source/Swig/wrapfunc.c", 72 | ], 73 | copts = ["$(STACK_FRAME_UNLIMITED)"] + select({ 74 | ":windows": [], 75 | "//conditions:default": [ 76 | "-Wno-parentheses", 77 | "-Wno-unused-variable", 78 | "-fexceptions", 79 | ], 80 | }), 81 | data = [":templates"], 82 | includes = [ 83 | "Source/CParse", 84 | "Source/DOH", 85 | "Source/Include", 86 | "Source/Modules", 87 | "Source/Preprocessor", 88 | "Source/Swig", 89 | ], 90 | output_licenses = ["unencumbered"], 91 | visibility = ["//visibility:public"], 92 | deps = ["@pcre"], 93 | ) 94 | 95 | # The template dirs need to be included in calls to the swig binary: 96 | # See 97 | # https://gitlab-extern.ivi.fraunhofer.de/philipps/or-tools/-/blob/9c5f3cffba703fd72d1ae6c75d0d8f10ee341d24/bazel/swig.bzl 98 | filegroup( 99 | name = "templates", 100 | srcs = [ 101 | "Lib/allkw.swg", 102 | "Lib/attribute.i", 103 | "Lib/carrays.i", 104 | "Lib/cdata.i", 105 | "Lib/cffi/cffi.swg", 106 | "Lib/cmalloc.i", 107 | "Lib/constraints.i", 108 | "Lib/cpointer.i", 109 | "Lib/cstring.i", 110 | "Lib/cwstring.i", 111 | "Lib/exception.i", 112 | 113 | "Lib/go/cdata.i", 114 | #"Lib/go/director.swg", 115 | "Lib/go/exception.i", 116 | "Lib/go/gokw.swg", 117 | "Lib/go/goruntime.swg", 118 | "Lib/go/gostring.swg", 119 | "Lib/go/go.swg", 120 | #"Lib/go/std_array.i", 121 | "Lib/go/std_common.i", 122 | "Lib/go/std_deque.i", 123 | "Lib/go/std_except.i", 124 | "Lib/go/std_list.i", 125 | "Lib/go/std_map.i", 126 | "Lib/go/std_pair.i", 127 | "Lib/go/std_string.i", 128 | "Lib/go/std_vector.i", 129 | "Lib/go/stl.i", 130 | "Lib/go/typemaps.i", 131 | 132 | "Lib/intrusive_ptr.i", 133 | "Lib/inttypes.i", 134 | "Lib/linkruntime.c", 135 | "Lib/math.i", 136 | "Lib/pointer.i", 137 | "Lib/python/argcargv.i", 138 | "Lib/python/attribute.i", 139 | "Lib/python/boost_shared_ptr.i", 140 | "Lib/python/builtin.swg", 141 | "Lib/python/carrays.i", 142 | "Lib/python/ccomplex.i", 143 | "Lib/python/cdata.i", 144 | "Lib/python/cmalloc.i", 145 | "Lib/python/cni.i", 146 | "Lib/python/complex.i", 147 | "Lib/python/cpointer.i", 148 | "Lib/python/cstring.i", 149 | "Lib/python/cwstring.i", 150 | "Lib/python/defarg.swg", 151 | "Lib/python/director.swg", 152 | "Lib/python/embed.i", 153 | "Lib/python/embed15.i", 154 | "Lib/python/exception.i", 155 | "Lib/python/factory.i", 156 | "Lib/python/file.i", 157 | "Lib/python/implicit.i", 158 | "Lib/python/jstring.i", 159 | "Lib/python/pyabc.i", 160 | "Lib/python/pyapi.swg", 161 | "Lib/python/pybackward.swg", 162 | "Lib/python/pybuffer.i", 163 | "Lib/python/pyclasses.swg", 164 | "Lib/python/pycomplex.swg", 165 | "Lib/python/pycontainer.swg", 166 | "Lib/python/pydocs.swg", 167 | "Lib/python/pyerrors.swg", 168 | "Lib/python/pyfragments.swg", 169 | "Lib/python/pyhead.swg", 170 | "Lib/python/pyinit.swg", 171 | "Lib/python/pyiterators.swg", 172 | "Lib/python/pymacros.swg", 173 | "Lib/python/pyname_compat.i", 174 | "Lib/python/pyopers.swg", 175 | "Lib/python/pyprimtypes.swg", 176 | "Lib/python/pyrun.swg", 177 | "Lib/python/pyruntime.swg", 178 | "Lib/python/pystdcommon.swg", 179 | "Lib/python/pystrings.swg", 180 | "Lib/python/python.swg", 181 | "Lib/python/pythonkw.swg", 182 | "Lib/python/pythreads.swg", 183 | "Lib/python/pytuplehlp.swg", 184 | "Lib/python/pytypemaps.swg", 185 | "Lib/python/pyuserdir.swg", 186 | "Lib/python/pywstrings.swg", 187 | "Lib/python/std_alloc.i", 188 | "Lib/python/std_auto_ptr.i", 189 | "Lib/python/std_basic_string.i", 190 | "Lib/python/std_carray.i", 191 | "Lib/python/std_char_traits.i", 192 | "Lib/python/std_common.i", 193 | "Lib/python/std_complex.i", 194 | "Lib/python/std_container.i", 195 | "Lib/python/std_deque.i", 196 | "Lib/python/std_except.i", 197 | "Lib/python/std_ios.i", 198 | "Lib/python/std_iostream.i", 199 | "Lib/python/std_list.i", 200 | "Lib/python/std_map.i", 201 | "Lib/python/std_multimap.i", 202 | "Lib/python/std_multiset.i", 203 | "Lib/python/std_pair.i", 204 | "Lib/python/std_set.i", 205 | "Lib/python/std_shared_ptr.i", 206 | "Lib/python/std_sstream.i", 207 | "Lib/python/std_streambuf.i", 208 | "Lib/python/std_string.i", 209 | "Lib/python/std_unordered_map.i", 210 | "Lib/python/std_unordered_multimap.i", 211 | "Lib/python/std_unordered_multiset.i", 212 | "Lib/python/std_unordered_set.i", 213 | "Lib/python/std_vector.i", 214 | "Lib/python/std_vectora.i", 215 | "Lib/python/std_wios.i", 216 | "Lib/python/std_wiostream.i", 217 | "Lib/python/std_wsstream.i", 218 | "Lib/python/std_wstreambuf.i", 219 | "Lib/python/std_wstring.i", 220 | "Lib/python/stl.i", 221 | "Lib/python/typemaps.i", 222 | "Lib/python/wchar.i", 223 | "Lib/runtime.swg", 224 | "Lib/shared_ptr.i", 225 | "Lib/std/_std_deque.i", 226 | "Lib/std/std_alloc.i", 227 | "Lib/std/std_basic_string.i", 228 | "Lib/std/std_carray.swg", 229 | "Lib/std/std_char_traits.i", 230 | "Lib/std/std_common.i", 231 | "Lib/std/std_container.i", 232 | "Lib/std/std_deque.i", 233 | "Lib/std/std_except.i", 234 | "Lib/std/std_ios.i", 235 | "Lib/std/std_iostream.i", 236 | "Lib/std/std_list.i", 237 | "Lib/std/std_map.i", 238 | "Lib/std/std_multimap.i", 239 | "Lib/std/std_multiset.i", 240 | "Lib/std/std_pair.i", 241 | "Lib/std/std_queue.i", 242 | "Lib/std/std_set.i", 243 | "Lib/std/std_sstream.i", 244 | "Lib/std/std_stack.i", 245 | "Lib/std/std_streambuf.i", 246 | "Lib/std/std_string.i", 247 | "Lib/std/std_unordered_map.i", 248 | "Lib/std/std_unordered_multimap.i", 249 | "Lib/std/std_unordered_multiset.i", 250 | "Lib/std/std_unordered_set.i", 251 | "Lib/std/std_vector.i", 252 | "Lib/std/std_vectora.i", 253 | "Lib/std/std_wios.i", 254 | "Lib/std/std_wiostream.i", 255 | "Lib/std/std_wsstream.i", 256 | "Lib/std/std_wstreambuf.i", 257 | "Lib/std/std_wstring.i", 258 | "Lib/std_except.i", 259 | "Lib/stdint.i", 260 | "Lib/stl.i", 261 | "Lib/swig.swg", 262 | "Lib/swigarch.i", 263 | "Lib/swigerrors.swg", 264 | "Lib/swiginit.swg", 265 | "Lib/swiglabels.swg", 266 | "Lib/swigrun.i", 267 | "Lib/swigrun.swg", 268 | "Lib/swigwarn.swg", 269 | "Lib/swigwarnings.swg", 270 | "Lib/typemaps/attribute.swg", 271 | "Lib/typemaps/carrays.swg", 272 | "Lib/typemaps/cdata.swg", 273 | "Lib/typemaps/cmalloc.swg", 274 | "Lib/typemaps/cpointer.swg", 275 | "Lib/typemaps/cstring.swg", 276 | "Lib/typemaps/cstrings.swg", 277 | "Lib/typemaps/cwstring.swg", 278 | "Lib/typemaps/enumint.swg", 279 | "Lib/typemaps/exception.swg", 280 | "Lib/typemaps/factory.swg", 281 | "Lib/typemaps/fragments.swg", 282 | "Lib/typemaps/implicit.swg", 283 | "Lib/typemaps/inoutlist.swg", 284 | "Lib/typemaps/misctypes.swg", 285 | "Lib/typemaps/primtypes.swg", 286 | "Lib/typemaps/ptrtypes.swg", 287 | "Lib/typemaps/std_except.swg", 288 | "Lib/typemaps/std_string.swg", 289 | "Lib/typemaps/std_strings.swg", 290 | "Lib/typemaps/std_wstring.swg", 291 | "Lib/typemaps/string.swg", 292 | "Lib/typemaps/strings.swg", 293 | "Lib/typemaps/swigmacros.swg", 294 | "Lib/typemaps/swigobject.swg", 295 | "Lib/typemaps/swigtype.swg", 296 | "Lib/typemaps/swigtypemaps.swg", 297 | "Lib/typemaps/traits.swg", 298 | "Lib/typemaps/typemaps.swg", 299 | "Lib/typemaps/valtypes.swg", 300 | "Lib/typemaps/void.swg", 301 | "Lib/typemaps/wstring.swg", 302 | "Lib/wchar.i", 303 | "Lib/windows.i", 304 | ], 305 | licenses = ["notice"], # simple notice license for Lib/ 306 | path = "Lib", 307 | visibility = ["//visibility:public"], 308 | ) 309 | 310 | genrule( 311 | name = "swigconfig", 312 | outs = ["Source/Include/swigconfig.h"], 313 | cmd = "cat <$@\n" + 314 | "#define HAVE_BOOL\n" + 315 | "#define HAVE_PCRE\n" + 316 | "#define HAVE_POPEN\n" + 317 | "#define PACKAGE_BUGREPORT \"http://www.swig.org\"\n" + 318 | "#define PACKAGE_VERSION \"3.0.8\"\n" + 319 | "#define STDC_HEADERS\n" + 320 | "#define SWIG_CXX \"bazel4lyfe\"\n" + 321 | "#define SWIG_LIB \"external/swig/Lib\"\n" + 322 | "#define SWIG_LIB_WIN_UNIX \"\"\n" + 323 | "#define SWIG_PLATFORM \"bazel4lyfe\"\n" + 324 | "EOF", 325 | ) 326 | 327 | genrule( 328 | name = "get_rid_of_stuff_we_dont_need_yet", 329 | srcs = ["Source/Modules/swigmain.cxx"], 330 | outs = ["Source/Modules/swigmain-lite.cxx"], 331 | cmd = "sed -e '/swig_allegrocl/d'" + 332 | " -e '/swig_cffi/d'" + 333 | " -e '/swig_chicken/d'" + 334 | " -e '/swig_clisp/d'" + 335 | " -e '/swig_csharp/d'" + 336 | " -e '/swig_d/d'" + 337 | # " -e '/swig_go/d'" + 338 | " -e '/swig_guile/d'" + 339 | " -e '/swig_java/d'" + 340 | " -e '/swig_lua/d'" + 341 | " -e '/swig_modula3/d'" + 342 | " -e '/swig_mzscheme/d'" + 343 | " -e '/swig_ocaml/d'" + 344 | " -e '/swig_octave/d'" + 345 | " -e '/swig_perl/d'" + 346 | " -e '/swig_php/d'" + 347 | " -e '/swig_pike/d'" + 348 | " -e '/swig_r/d'" + 349 | " -e '/swig_ruby/d'" + 350 | " -e '/swig_scilab/d'" + 351 | " -e '/swig_sexp/d'" + 352 | " -e '/swig_tcl/d'" + 353 | " -e '/swig_uffi/d'" + 354 | " $< >$@", 355 | ) 356 | 357 | config_setting( 358 | name = "windows", 359 | values = {"cpu": "x64_windows"}, 360 | ) 361 | --------------------------------------------------------------------------------