Skip to content

Commit 150c46f

Browse files
authored
Merge pull request #256158 from ambros-gleixner/scip-with-mpfr
scip 10.0.0
2 parents 0f4f9c0 + 434e5c2 commit 150c46f

File tree

3 files changed

+225
-178
lines changed

3 files changed

+225
-178
lines changed

Formula/o/or-tools.rb

Lines changed: 49 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class OrTools < Formula
22
desc "Google's Operations Research tools"
33
homepage "https://developers.google.com/optimization/"
44
license "Apache-2.0"
5-
revision 8
5+
revision 9
66
head "https://github.com/google/or-tools.git", branch: "stable"
77

88
# Remove `stable` block when patch is no longer needed.
@@ -16,6 +16,9 @@ class OrTools < Formula
1616
url "https://github.com/google/or-tools/commit/9d3350dcbc746d154f22a8b44d21f624604bd6c3.patch?full_index=1"
1717
sha256 "fb39e1aa1215d685419837dc6cef339cda36e704a68afc475a820f74c0653a61"
1818
end
19+
20+
# Workaround for SCIP 10 compatibility.
21+
patch :DATA
1922
end
2023

2124
livecheck do
@@ -24,12 +27,12 @@ class OrTools < Formula
2427
end
2528

2629
bottle do
27-
sha256 cellar: :any, arm64_tahoe: "a4ac96bc43c89b21f73cd7d3d612e7c9dfbb51691187327b751eaaa1e02da162"
28-
sha256 cellar: :any, arm64_sequoia: "87b7e1a6df98f9e467fb7836256544d88c011b621fda9fb48435fbb34a48cd99"
29-
sha256 cellar: :any, arm64_sonoma: "8b22e6ff9efcb5232b80c30c98ebf65fa00316ba1950d8c12268efb60dcb8d5d"
30-
sha256 cellar: :any, sonoma: "2a5e6d88f593c0f4e7de562888988a37fb43ef9e262b0716d43df93c7cbbb42c"
31-
sha256 arm64_linux: "018636956133a206930362a92426326a6bac922e0da679d0697175d355a280b2"
32-
sha256 x86_64_linux: "75f68270d6ffb6363f34dd283bd0b52f34d81fae8bd23029d210dcb9394b30dc"
30+
sha256 cellar: :any, arm64_tahoe: "77367f0a8d406375be72d7d6c96e26b5c1891f994a85ab7bf01d5e9305cfe2e9"
31+
sha256 cellar: :any, arm64_sequoia: "582e9f727a2f706eb561e7e05e36289337dff6c5584702f6934295f8e8d08d76"
32+
sha256 cellar: :any, arm64_sonoma: "c25fe2a1d9d167d6d4d04c53c60e595e0890a91db91ba9a9ffd19767b04146c1"
33+
sha256 cellar: :any, sonoma: "d2f676b856070f592d82ffab5d4a5f2d7455e511b31f9829ca749ab62efcfb19"
34+
sha256 arm64_linux: "10a9f21a0b1b6fdd2ed56edb3bc3a3366ee81f6f49783ba345a06e0b764c516b"
35+
sha256 x86_64_linux: "eb3091e6c99c57c686715ed4760054e8dfb6c2162b067f610626a0918e7f2764"
3336
end
3437

3538
depends_on "cmake" => [:build, :test]
@@ -50,7 +53,10 @@ class OrTools < Formula
5053
uses_from_macos "zlib"
5154

5255
# Workaround until upstream updates Abseil. Likely will be handled by sync with internal copy
53-
patch :DATA
56+
patch do
57+
url "https://raw.githubusercontent.com/Homebrew/homebrew-core/6d739af5/Patches/or-tools/abseil-bump.diff"
58+
sha256 "586f6c0f16acd58be769436aae4d272356bd4740d6426a9ed8d92795d34bab8e"
59+
end
5460

5561
def install
5662
args = %w[
@@ -138,161 +144,38 @@ def install
138144
end
139145

140146
__END__
141-
diff --git a/ortools/math_opt/cpp/model.cc b/ortools/math_opt/cpp/model.cc
142-
index 12ea552d78..9d19f5af72 100644
143-
--- a/ortools/math_opt/cpp/model.cc
144-
+++ b/ortools/math_opt/cpp/model.cc
145-
@@ -55,7 +55,7 @@ constexpr double kInf = std::numeric_limits<double>::infinity();
146-
147-
absl::StatusOr<std::unique_ptr<Model>> Model::FromModelProto(
148-
const ModelProto& model_proto) {
149-
- ASSIGN_OR_RETURN(absl::Nonnull<std::unique_ptr<ModelStorage>> storage,
150-
+ ASSIGN_OR_RETURN(absl_nonnull std::unique_ptr<ModelStorage> storage,
151-
ModelStorage::FromModelProto(model_proto));
152-
return std::make_unique<Model>(std::move(storage));
153-
}
154-
@@ -63,10 +63,10 @@ absl::StatusOr<std::unique_ptr<Model>> Model::FromModelProto(
155-
Model::Model(const absl::string_view name)
156-
: storage_(std::make_shared<ModelStorage>(name)) {}
157-
158-
-Model::Model(absl::Nonnull<std::unique_ptr<ModelStorage>> storage)
159-
+Model::Model(absl_nonnull std::unique_ptr<ModelStorage> storage)
160-
: storage_(ABSL_DIE_IF_NULL(std::move(storage))) {}
161-
162-
-absl::Nonnull<std::unique_ptr<Model>> Model::Clone(
163-
+absl_nonnull std::unique_ptr<Model> Model::Clone(
164-
const std::optional<absl::string_view> new_name) const {
165-
return std::make_unique<Model>(storage_->Clone(new_name));
166-
}
167-
diff --git a/ortools/math_opt/cpp/model.h b/ortools/math_opt/cpp/model.h
168-
index bb9939f098..6cb65ed256 100644
169-
--- a/ortools/math_opt/cpp/model.h
170-
+++ b/ortools/math_opt/cpp/model.h
171-
@@ -137,7 +137,7 @@ class Model {
172-
// This constructor is used when loading a model, for example from a
173-
// ModelProto or an MPS file. Note that in those cases the FromModelProto()
174-
// should be used.
175-
- explicit Model(absl::Nonnull<std::unique_ptr<ModelStorage>> storage);
176-
+ explicit Model(absl_nonnull std::unique_ptr<ModelStorage> storage);
177-
178-
Model(const Model&) = delete;
179-
Model& operator=(const Model&) = delete;
180-
@@ -159,7 +159,7 @@ class Model {
181-
// * in an arbitrary order using Variables() and LinearConstraints().
182-
//
183-
// Note that the returned model does not have any update tracker.
184-
- absl::Nonnull<std::unique_ptr<Model>> Clone(
185-
+ absl_nonnull std::unique_ptr<Model> Clone(
186-
std::optional<absl::string_view> new_name = std::nullopt) const;
187-
188-
inline absl::string_view name() const;
189-
@@ -925,7 +925,7 @@ class Model {
190-
// We use a shared_ptr here so that the UpdateTracker class can have a
191-
// weak_ptr on the ModelStorage. This let it have a destructor that don't
192-
// crash when called after the destruction of the associated Model.
193-
- const absl::Nonnull<std::shared_ptr<ModelStorage>> storage_;
194-
+ const absl_nonnull std::shared_ptr<ModelStorage> storage_;
195-
};
196-
197-
////////////////////////////////////////////////////////////////////////////////
198-
diff --git a/ortools/math_opt/storage/model_storage.cc b/ortools/math_opt/storage/model_storage.cc
199-
index 3c5139d07e..9c24890944 100644
200-
--- a/ortools/math_opt/storage/model_storage.cc
201-
+++ b/ortools/math_opt/storage/model_storage.cc
202-
@@ -46,7 +46,7 @@
203-
namespace operations_research {
204-
namespace math_opt {
205-
206-
-absl::StatusOr<absl::Nonnull<std::unique_ptr<ModelStorage>>>
207-
+absl::StatusOr<absl_nonnull std::unique_ptr<ModelStorage>>
208-
ModelStorage::FromModelProto(const ModelProto& model_proto) {
209-
// We don't check names since ModelStorage does not do so before exporting
210-
// models. Thus a model built by ModelStorage can contain duplicated
211-
@@ -144,7 +144,7 @@ void ModelStorage::UpdateLinearConstraintCoefficients(
212-
}
213-
}
214-
215-
-absl::Nonnull<std::unique_ptr<ModelStorage>> ModelStorage::Clone(
216-
+absl_nonnull std::unique_ptr<ModelStorage> ModelStorage::Clone(
217-
const std::optional<absl::string_view> new_name) const {
218-
// We leverage the private copy constructor that copies copyable_data_ but not
219-
// update_trackers_ here.
220-
diff --git a/ortools/math_opt/storage/model_storage.h b/ortools/math_opt/storage/model_storage.h
221-
index 2334290cdc..127dbce14c 100644
222-
--- a/ortools/math_opt/storage/model_storage.h
223-
+++ b/ortools/math_opt/storage/model_storage.h
224-
@@ -177,7 +177,7 @@ class ModelStorage {
225-
// considered invalid when solving.
226-
//
227-
// See ApplyUpdateProto() for dealing with subsequent updates.
228-
- static absl::StatusOr<absl::Nonnull<std::unique_ptr<ModelStorage> > >
229-
+ static absl::StatusOr<absl_nonnull std::unique_ptr<ModelStorage>>
230-
FromModelProto(const ModelProto& model_proto);
231-
232-
// Creates an empty minimization problem.
233-
@@ -192,7 +192,7 @@ class ModelStorage {
234-
// reused any id of variable/constraint that was deleted in the original.
235-
//
236-
// Note that the returned model does not have any update tracker.
237-
- absl::Nonnull<std::unique_ptr<ModelStorage> > Clone(
238-
+ absl_nonnull std::unique_ptr<ModelStorage> Clone(
239-
std::optional<absl::string_view> new_name = std::nullopt) const;
240-
241-
inline const std::string& name() const { return copyable_data_.name; }
242-
@@ -1311,10 +1311,10 @@ namespace operations_research::math_opt {
243-
244-
// Aliases for non-nullable and nullable pointers to a `ModelStorage`.
245-
// We should mostly be using the former, but in some cases we need the latter.
246-
-using ModelStoragePtr = absl::Nonnull<ModelStorage*>;
247-
-using NullableModelStoragePtr = absl::Nullable<ModelStorage*>;
248-
-using ModelStorageCPtr = absl::Nonnull<const ModelStorage*>;
249-
-using NullableModelStorageCPtr = absl::Nullable<const ModelStorage*>;
250-
+using ModelStoragePtr = ModelStorage* absl_nonnull;
251-
+using NullableModelStoragePtr = ModelStorage* absl_nullable;
252-
+using ModelStorageCPtr = const ModelStorage* absl_nonnull;
253-
+using NullableModelStorageCPtr = const ModelStorage* absl_nullable;
254-
255-
} // namespace operations_research::math_opt
256-
257-
diff --git a/ortools/math_opt/storage/model_storage_v2.cc b/ortools/math_opt/storage/model_storage_v2.cc
258-
index e911eaecc4..60b0ec952d 100644
259-
--- a/ortools/math_opt/storage/model_storage_v2.cc
260-
+++ b/ortools/math_opt/storage/model_storage_v2.cc
261-
@@ -76,13 +76,13 @@ void ModelStorageV2::DeleteLinearConstraint(LinearConstraintId id) {
262-
<< ", it is not in the model";
263-
}
264-
265-
-absl::StatusOr<absl::Nonnull<std::unique_ptr<ModelStorageV2>>>
266-
+absl::StatusOr<absl_nonnull std::unique_ptr<ModelStorageV2>>
267-
ModelStorageV2::FromModelProto(const ModelProto& model_proto) {
268-
ASSIGN_OR_RETURN(Elemental e, Elemental::FromModelProto(model_proto));
269-
return absl::WrapUnique(new ModelStorageV2(std::move(e)));
270-
}
271-
272-
-absl::Nonnull<std::unique_ptr<ModelStorageV2>> ModelStorageV2::Clone(
273-
+absl_nonnull std::unique_ptr<ModelStorageV2> ModelStorageV2::Clone(
274-
const std::optional<absl::string_view> new_name) const {
275-
return absl::WrapUnique(new ModelStorageV2(elemental_.Clone(new_name)));
276-
}
277-
diff --git a/ortools/math_opt/storage/model_storage_v2.h b/ortools/math_opt/storage/model_storage_v2.h
278-
index 45078bedad..c8c13b7232 100644
279-
--- a/ortools/math_opt/storage/model_storage_v2.h
280-
+++ b/ortools/math_opt/storage/model_storage_v2.h
281-
@@ -90,7 +90,7 @@ class ModelStorageV2 {
282-
// considered invalid when solving.
283-
//
284-
// See ApplyUpdateProto() for dealing with subsequent updates.
285-
- static absl::StatusOr<absl::Nonnull<std::unique_ptr<ModelStorageV2>>>
286-
+ static absl::StatusOr<absl_nonnull std::unique_ptr<ModelStorageV2>>
287-
FromModelProto(const ModelProto& model_proto);
288-
289-
// Creates an empty minimization problem.
290-
@@ -106,7 +106,7 @@ class ModelStorageV2 {
291-
// reused any id of variable/constraint that was deleted in the original.
292-
//
293-
// Note that the returned model does not have any update tracker.
294-
- absl::Nonnull<std::unique_ptr<ModelStorageV2>> Clone(
295-
+ absl_nonnull std::unique_ptr<ModelStorageV2> Clone(
296-
std::optional<absl::string_view> new_name = std::nullopt) const;
297-
298-
inline const std::string& name() const { return elemental_.model_name(); }
147+
diff --git a/ortools/linear_solver/proto_solver/scip_proto_solver.cc b/ortools/linear_solver/proto_solver/scip_proto_solver.cc
148+
index f40a10d4749..d96d74755da 100644
149+
--- a/ortools/linear_solver/proto_solver/scip_proto_solver.cc
150+
+++ b/ortools/linear_solver/proto_solver/scip_proto_solver.cc
151+
@@ -50,7 +50,13 @@
152+
#include "scip/cons_indicator.h"
153+
#include "scip/cons_linear.h"
154+
#include "scip/cons_or.h"
155+
+#if SCIP_VERSION_MAJOR >= 10
156+
+#include "scip/cons_nonlinear.h"
157+
+#define SCIPcreateConsBasicQuadratic SCIPcreateConsBasicQuadraticNonlinear
158+
+#define SCIPcreateConsQuadratic SCIPcreateConsQuadraticNonlinear
159+
+#else
160+
#include "scip/cons_quadratic.h"
161+
+#endif // SCIP_VERSION_MAJOR >= 10
162+
#include "scip/cons_sos1.h"
163+
#include "scip/cons_sos2.h"
164+
#include "scip/def.h"
165+
diff --git a/ortools/gscip/gscip.cc b/ortools/gscip/gscip.cc
166+
index 872043d23aa..7bcac209d5f 100644
167+
--- a/ortools/gscip/gscip.cc
168+
+++ b/ortools/gscip/gscip.cc
169+
@@ -47,7 +47,12 @@
170+
#include "scip/cons_indicator.h"
171+
#include "scip/cons_linear.h"
172+
#include "scip/cons_or.h"
173+
+#if SCIP_VERSION_MAJOR >= 10
174+
+#include "scip/cons_nonlinear.h"
175+
+#define SCIPcreateConsQuadratic SCIPcreateConsQuadraticNonlinear
176+
+#else
177+
#include "scip/cons_quadratic.h"
178+
+#endif // SCIP_VERSION_MAJOR >= 10
179+
#include "scip/cons_sos1.h"
180+
#include "scip/cons_sos2.h"
181+
#include "scip/def.h"

Formula/s/scip.rb

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class Scip < Formula
22
desc "Solver for mixed integer programming and mixed integer nonlinear programming"
33
homepage "https://scipopt.org"
4-
url "https://scipopt.org/download/release/scip-9.2.4.tgz"
5-
sha256 "d88217393a6f86c18f2957c6d36d90d28287a01473fb7378417ab49ad72a50ea"
4+
url "https://scipopt.org/download/release/scip-10.0.0.tgz"
5+
sha256 "b91d2ed32c422a13c502c37cf296eb9550e55d6bd311e61bfa6dfb9811b03d87"
66
license "Apache-2.0"
77

88
livecheck do
@@ -11,19 +11,20 @@ class Scip < Formula
1111
end
1212

1313
bottle do
14-
sha256 cellar: :any, arm64_tahoe: "8e345527c5788204b410c15d3f9ad6ef3a30d626641c49c80429b96f93d8a28a"
15-
sha256 cellar: :any, arm64_sequoia: "8cfd22fa1f1a525de6a8fe28acf3b5c8ed7e3aaf0fff4bed1f323a56b29c6e00"
16-
sha256 cellar: :any, arm64_sonoma: "a6d778cea731f914cb00cd4a8a8cc9465c4dfc28793c51025e078d087e27c011"
17-
sha256 cellar: :any, sonoma: "fc8a392321d3640bd79af687a026e83ec83090ae1a78453474f1f1432a481803"
18-
sha256 cellar: :any_skip_relocation, arm64_linux: "87ead7c33e3744da5cc7d6a79955e7fcfc013338a8f49024eee7f82647ee46ee"
19-
sha256 cellar: :any_skip_relocation, x86_64_linux: "beee5ba170ef0b8e55436ca899e694759c286d005c94277203a36b7cf6d74a45"
14+
sha256 cellar: :any, arm64_tahoe: "d34ce00329bf1ee4b0eb0e173c8a32559d3e5ed807a58ce7c38d64b2a5a8b515"
15+
sha256 cellar: :any, arm64_sequoia: "53cc523a67b262b84cfcd148cc45e341b0e78af1a09726f05cd3806ca96a816a"
16+
sha256 cellar: :any, arm64_sonoma: "14e01b3befd24f3a7c7a6f4fcc5ac8040207d6c6b558e88b55de1571d05c6420"
17+
sha256 cellar: :any, sonoma: "169ba2332962c0dd133d2d818132af9dec46687cb34cb2b464350a2a7b847cbf"
18+
sha256 cellar: :any_skip_relocation, arm64_linux: "e261bc85758fd9965ef7173d4b7eb14d4cbf09228a1835df0ec34043bc92fc52"
19+
sha256 cellar: :any_skip_relocation, x86_64_linux: "2159678993d921f14507fa26cc06e12d51e383df2079b8bbe5f03321c2aaac4c"
2020
end
2121

2222
depends_on "cmake" => :build
23-
depends_on "boost"
24-
depends_on "cppad"
23+
depends_on "boost" => :no_linkage
24+
depends_on "cppad" => :no_linkage
2525
depends_on "gmp"
2626
depends_on "ipopt"
27+
depends_on "mpfr" => :no_linkage
2728
depends_on "openblas"
2829
depends_on "papilo"
2930
depends_on "readline"
@@ -43,10 +44,15 @@ def install
4344

4445
pkgshare.install "check/instances/MIP/enigma.mps"
4546
pkgshare.install "check/instances/MINLP/gastrans.nl"
47+
pkgshare.install "check/instances/MIPEX/flugpl_rational.mps"
4648
end
4749

4850
test do
49-
assert_match "problem is solved [optimal solution found]", shell_output("#{bin}/scip -f #{pkgshare}/enigma.mps")
50-
assert_match "problem is solved [optimal solution found]", shell_output("#{bin}/scip -f #{pkgshare}/gastrans.nl")
51+
expected = "problem is solved [optimal solution found]"
52+
assert_match expected, shell_output("#{bin}/scip -f #{pkgshare}/enigma.mps")
53+
assert_match expected, shell_output("#{bin}/scip -f #{pkgshare}/gastrans.nl")
54+
55+
command = "set exact enable TRUE read #{pkgshare}/flugpl_rational.mps optimize quit"
56+
assert_match expected, shell_output("#{bin}/scip -c \"#{command}\"")
5157
end
5258
end

0 commit comments

Comments
 (0)