Skip to content

Commit c21017f

Browse files
committed
Merge remote-tracking branch 'origin/v10-minor'
2 parents 09e61e0 + d43af4b commit c21017f

File tree

11 files changed

+151
-57
lines changed

11 files changed

+151
-57
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,7 @@ set(scipheaders
822822
scip/pub_tree.h
823823
scip/pub_var.h
824824
scip/rational.h
825+
scip/rationalgmp.h
825826
scip/rbtree.h
826827
scip/reader_bnd.h
827828
scip/reader_ccg.h

src/lpiexact/lpiexact_qsoex.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#include "lpiexact/type_lpiexact.h"
5151
#include "lpiexact/lpiexact.h"
5252
#include "scip/pub_message.h"
53+
#include "scip/rationalgmp.h"
5354

5455

5556
/** solver name */

src/lpiexact/lpiexact_spx.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "lpiexact/type_lpiexact.h"
4141
#include "lpiexact/lpiexact.h"
4242
#include "scip/rational.h"
43+
#include "scip/rationalgmp.h"
4344

4445
/* check the return value of setParam methods */
4546
#define CHECK_SOPLEX_PARAM(x) \

src/scip/certificate.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@
5151
#include "scip/pub_fileio.h"
5252
#include "scip/type_prob.h"
5353
#include "blockmemshell/memory.h"
54-
#ifdef SCIP_WITH_GMP
55-
#include "gmp.h"
56-
#endif
5754

5855
#ifdef __cplusplus
5956
extern "C" {

src/scip/lpexact_bounding.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "scip/lpexact.h"
4747
#include "scip/prob.h"
4848
#include "scip/rational.h"
49+
#include "scip/rationalgmp.h"
4950
#include "scip/scip_certificate.h"
5051
#include "scip/scip_message.h"
5152
#include "scip/scip_prob.h"

src/scip/multiprecision.hpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2+
/* */
3+
/* This file is part of the program and library */
4+
/* SCIP --- Solving Constraint Integer Programs */
5+
/* */
6+
/* Copyright (c) 2002-2025 Zuse Institute Berlin (ZIB) */
7+
/* */
8+
/* Licensed under the Apache License, Version 2.0 (the "License"); */
9+
/* you may not use this file except in compliance with the License. */
10+
/* You may obtain a copy of the License at */
11+
/* */
12+
/* http://www.apache.org/licenses/LICENSE-2.0 */
13+
/* */
14+
/* Unless required by applicable law or agreed to in writing, software */
15+
/* distributed under the License is distributed on an "AS IS" BASIS, */
16+
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17+
/* See the License for the specific language governing permissions and */
18+
/* limitations under the License. */
19+
/* */
20+
/* You should have received a copy of the Apache-2.0 license */
21+
/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22+
/* */
23+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24+
25+
/**@file struct_rational.h
26+
* @brief definition of wrapper class for rational numbers
27+
* @author Leon Eifler
28+
*/
29+
30+
/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
31+
132
#ifndef __SCIP_MULTIPRECISION_HPP_
233
#define __SCIP_MULTIPRECISION_HPP_
334

src/scip/rational.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
#include "blockmemshell/memory.h"
3535
#include "scip/rational.h"
36+
#include "scip/rationalgmp.h"
3637
#include "scip/struct_rational.h"
3738
#include "scip/multiprecision.hpp"
3839
#include "scip/type_message.h"
@@ -49,10 +50,13 @@
4950
#include <string.h>
5051
#include <algorithm>
5152

53+
#ifdef SCIP_WITH_MPFR
54+
#include <mpfr.h>
55+
#endif
56+
5257
#ifdef SCIP_WITH_BOOST
5358
#include <boost/format.hpp>
5459
#ifdef SCIP_WITH_GMP
55-
#include <gmp.h>
5660
#include <boost/multiprecision/gmp.hpp>
5761
#endif
5862
#include <boost/multiprecision/number.hpp>

src/scip/rational.h

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,6 @@
4141
#include "scip/type_rational.h"
4242
#include "scip/type_set.h"
4343
#include "blockmemshell/memory.h"
44-
#ifdef SCIP_WITH_GMP
45-
#include <gmp.h>
46-
#endif
47-
48-
#ifdef SCIP_WITH_MPFR
49-
#include <mpfr.h>
50-
#endif
5144

5245
#ifdef __cplusplus
5346
extern "C" {
@@ -180,52 +173,6 @@ SCIP_RETCODE SCIPrationalReallocBlockArray(
180173
int newlen /**< size of src array */
181174
);
182175

183-
#if defined(SCIP_WITH_BOOST) && defined(SCIP_WITH_GMP)
184-
/** gets the underlying gmp rational pointer */
185-
SCIP_EXPORT
186-
mpq_t* SCIPrationalGetGMP(
187-
SCIP_RATIONAL* rational /**< rational to access */
188-
);
189-
190-
/** sets rational to gmp rational */
191-
SCIP_EXPORT
192-
void SCIPrationalSetGMP(
193-
SCIP_RATIONAL* rational, /**< rational to define */
194-
const mpq_t numb /**< gmp rational to set */
195-
);
196-
197-
/** creates rational from gmp rational */
198-
SCIP_EXPORT
199-
SCIP_RETCODE SCIPrationalCreateBlockGMP(
200-
BMS_BLKMEM* mem, /**< block memory */
201-
SCIP_RATIONAL** rational, /**< pointer to the rational to create */
202-
mpq_t numb /**< gmp rational to set */
203-
);
204-
205-
/** sets gmp rational array to values of rational array */
206-
SCIP_EXPORT
207-
void SCIPrationalSetGMPArray(
208-
mpq_t* mpqaaray, /**< gmp rational array */
209-
SCIP_RATIONAL** ratarrray, /**< rational array */
210-
int len /**< array length */
211-
);
212-
213-
/** sets rational array to values of gmp rational array */
214-
SCIP_EXPORT
215-
void SCIPrationalSetArrayGMP(
216-
SCIP_RATIONAL** ratarray, /**< rational array */
217-
mpq_t* mpqarray, /**< gmp rational array */
218-
int len /**< array length */
219-
);
220-
221-
/** clears gmp rational array */
222-
SCIP_EXPORT
223-
void SCIPrationalClearArrayGMP(
224-
mpq_t* mpqarray, /**< gmp rational array */
225-
int len /**< array length */
226-
);
227-
#endif
228-
229176
/** deletes a rational and frees the allocated ordinary memory */
230177
SCIP_EXPORT
231178
void SCIPrationalFree(

src/scip/rationalgmp.h

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2+
/* */
3+
/* This file is part of the program and library */
4+
/* SCIP --- Solving Constraint Integer Programs */
5+
/* */
6+
/* Copyright (c) 2002-2025 Zuse Institute Berlin (ZIB) */
7+
/* */
8+
/* Licensed under the Apache License, Version 2.0 (the "License"); */
9+
/* you may not use this file except in compliance with the License. */
10+
/* You may obtain a copy of the License at */
11+
/* */
12+
/* http://www.apache.org/licenses/LICENSE-2.0 */
13+
/* */
14+
/* Unless required by applicable law or agreed to in writing, software */
15+
/* distributed under the License is distributed on an "AS IS" BASIS, */
16+
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17+
/* See the License for the specific language governing permissions and */
18+
/* limitations under the License. */
19+
/* */
20+
/* You should have received a copy of the Apache-2.0 license */
21+
/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22+
/* */
23+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24+
25+
/**@file rationalgmp.h
26+
* @ingroup PUBLICCOREAPI
27+
* @brief wrapper for rational number arithmetic that interacts with GMP
28+
* @author Leon Eifler
29+
* @author Dominik Kamp
30+
*
31+
* This header file needs to be explicitly included by source that needs to convert between SCIP_Rational and GMP.
32+
* It is intentionally not included by other header files that belong to the public SCIP API.
33+
*/
34+
35+
/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
36+
37+
#ifndef __SCIP_RATIONALGMP_H__
38+
#define __SCIP_RATIONALGMP_H__
39+
40+
#include <stdlib.h>
41+
#include "scip/def.h"
42+
#include "scip/type_rational.h"
43+
44+
#if defined(SCIP_WITH_BOOST) && defined(SCIP_WITH_GMP)
45+
#include <gmp.h>
46+
#endif
47+
48+
#ifdef __cplusplus
49+
extern "C" {
50+
#endif
51+
52+
/**@addtogroup PublicRationalMethods
53+
*
54+
* @{
55+
*/
56+
57+
#if defined(SCIP_WITH_BOOST) && defined(SCIP_WITH_GMP)
58+
/** gets the underlying gmp rational pointer */
59+
SCIP_EXPORT
60+
mpq_t* SCIPrationalGetGMP(
61+
SCIP_RATIONAL* rational /**< rational to access */
62+
);
63+
64+
/** sets rational to gmp rational */
65+
SCIP_EXPORT
66+
void SCIPrationalSetGMP(
67+
SCIP_RATIONAL* rational, /**< rational to define */
68+
const mpq_t numb /**< gmp rational to set */
69+
);
70+
71+
/** creates rational from gmp rational */
72+
SCIP_EXPORT
73+
SCIP_RETCODE SCIPrationalCreateBlockGMP(
74+
BMS_BLKMEM* mem, /**< block memory */
75+
SCIP_RATIONAL** rational, /**< pointer to the rational to create */
76+
mpq_t numb /**< gmp rational to set */
77+
);
78+
79+
/** sets gmp rational array to values of rational array */
80+
SCIP_EXPORT
81+
void SCIPrationalSetGMPArray(
82+
mpq_t* mpqaaray, /**< gmp rational array */
83+
SCIP_RATIONAL** ratarrray, /**< rational array */
84+
int len /**< array length */
85+
);
86+
87+
/** sets rational array to values of gmp rational array */
88+
SCIP_EXPORT
89+
void SCIPrationalSetArrayGMP(
90+
SCIP_RATIONAL** ratarray, /**< rational array */
91+
mpq_t* mpqarray, /**< gmp rational array */
92+
int len /**< array length */
93+
);
94+
95+
/** clears gmp rational array */
96+
SCIP_EXPORT
97+
void SCIPrationalClearArrayGMP(
98+
mpq_t* mpqarray, /**< gmp rational array */
99+
int len /**< array length */
100+
);
101+
#endif
102+
103+
/** @} */
104+
105+
#ifdef __cplusplus
106+
}
107+
#endif
108+
109+
#endif

src/scip/reader_zpl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ extern "C" {
9898
#include "zimpl/xlpglue.h"
9999
#include "zimpl/zimpllib.h"
100100
#include "scip/rational.h"
101+
#include "scip/rationalgmp.h"
101102

102103
#ifdef __cplusplus
103104
}

0 commit comments

Comments
 (0)