Skip to content

Commit 27122e3

Browse files
authored
Proxy header + renamed constant to avoid any copyright issues (#3)
* Proxy header * Renamed constant to avoid any copyright issues * Removed XPRS_CC * Improved _get_entity_name impl * Added back _get_entity_name checks * I've also fixed a typo and added some urls in one of the readme that was missing them.
1 parent 587e502 commit 27122e3

File tree

6 files changed

+2656
-1006
lines changed

6 files changed

+2656
-1006
lines changed

include/pyoptinterface/xpress_model.hpp

Lines changed: 59 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
#include <memory>
55
#include <variant>
66

7-
#include <xprs.h>
7+
// #include <xprs.h>
8+
#include "../thirdparty/solvers/xpress/xpress_forward_decls.h"
89

910
#include "pyoptinterface/core.hpp"
1011
#include "pyoptinterface/container.hpp"
@@ -17,7 +18,7 @@
1718
#define XPRS_VER_MINOR 1
1819
#define XPRS_VER_BUILD 1
1920

20-
#if XPVERSION_MAJOR < XPRS_VER_MAJOR
21+
#if POI_XPVERSION_MAJOR < XPRS_VER_MAJOR
2122
#warning "System Xpress library major version is older than the officially supported version. " \
2223
"Some features may not work correctly."
2324
#endif
@@ -243,91 +244,91 @@ struct Env
243244
// Types associated with Xpress attribute and controls
244245
enum class CATypes : int
245246
{
246-
NOTDEFINED = XPRS_TYPE_NOTDEFINED,
247-
INT = XPRS_TYPE_INT,
248-
INT64 = XPRS_TYPE_INT64,
249-
DOUBLE = XPRS_TYPE_DOUBLE,
250-
STRING = XPRS_TYPE_STRING,
247+
NOTDEFINED = POI_XPRS_TYPE_NOTDEFINED,
248+
INT = POI_XPRS_TYPE_INT,
249+
INT64 = POI_XPRS_TYPE_INT64,
250+
DOUBLE = POI_XPRS_TYPE_DOUBLE,
251+
STRING = POI_XPRS_TYPE_STRING,
251252
};
252253

253254
enum class SOLSTATUS : int
254255
{
255-
NOTFOUND = XPRS_SOLSTATUS_NOTFOUND,
256-
OPTIMAL = XPRS_SOLSTATUS_OPTIMAL,
257-
FEASIBLE = XPRS_SOLSTATUS_FEASIBLE,
258-
INFEASIBLE = XPRS_SOLSTATUS_INFEASIBLE,
259-
UNBOUNDED = XPRS_SOLSTATUS_UNBOUNDED
256+
NOTFOUND = POI_XPRS_SOLSTATUS_NOTFOUND,
257+
OPTIMAL = POI_XPRS_SOLSTATUS_OPTIMAL,
258+
FEASIBLE = POI_XPRS_SOLSTATUS_FEASIBLE,
259+
INFEASIBLE = POI_XPRS_SOLSTATUS_INFEASIBLE,
260+
UNBOUNDED = POI_XPRS_SOLSTATUS_UNBOUNDED
260261
};
261262

262263
enum class SOLVESTATUS : int
263264
{
264-
UNSTARTED = XPRS_SOLVESTATUS_UNSTARTED,
265-
STOPPED = XPRS_SOLVESTATUS_STOPPED,
266-
FAILED = XPRS_SOLVESTATUS_FAILED,
267-
COMPLETED = XPRS_SOLVESTATUS_COMPLETED
265+
UNSTARTED = POI_XPRS_SOLVESTATUS_UNSTARTED,
266+
STOPPED = POI_XPRS_SOLVESTATUS_STOPPED,
267+
FAILED = POI_XPRS_SOLVESTATUS_FAILED,
268+
COMPLETED = POI_XPRS_SOLVESTATUS_COMPLETED
268269
};
269270

270271
enum class LPSTATUS : int
271272
{
272-
UNSTARTED = XPRS_LP_UNSTARTED,
273-
OPTIMAL = XPRS_LP_OPTIMAL,
274-
INFEAS = XPRS_LP_INFEAS,
275-
CUTOFF = XPRS_LP_CUTOFF,
276-
UNFINISHED = XPRS_LP_UNFINISHED,
277-
UNBOUNDED = XPRS_LP_UNBOUNDED,
278-
CUTOFF_IN_DUAL = XPRS_LP_CUTOFF_IN_DUAL,
279-
UNSOLVED = XPRS_LP_UNSOLVED,
280-
NONCONVEX = XPRS_LP_NONCONVEX
273+
UNSTARTED = POI_XPRS_LP_UNSTARTED,
274+
OPTIMAL = POI_XPRS_LP_OPTIMAL,
275+
INFEAS = POI_XPRS_LP_INFEAS,
276+
CUTOFF = POI_XPRS_LP_CUTOFF,
277+
UNFINISHED = POI_XPRS_LP_UNFINISHED,
278+
UNBOUNDED = POI_XPRS_LP_UNBOUNDED,
279+
CUTOFF_IN_DUAL = POI_XPRS_LP_CUTOFF_IN_DUAL,
280+
UNSOLVED = POI_XPRS_LP_UNSOLVED,
281+
NONCONVEX = POI_XPRS_LP_NONCONVEX
281282
};
282283

283284
enum class MIPSTATUS : int
284285
{
285-
NOT_LOADED = XPRS_MIP_NOT_LOADED,
286-
LP_NOT_OPTIMAL = XPRS_MIP_LP_NOT_OPTIMAL,
287-
LP_OPTIMAL = XPRS_MIP_LP_OPTIMAL,
288-
NO_SOL_FOUND = XPRS_MIP_NO_SOL_FOUND,
289-
SOLUTION = XPRS_MIP_SOLUTION,
290-
INFEAS = XPRS_MIP_INFEAS,
291-
OPTIMAL = XPRS_MIP_OPTIMAL,
292-
UNBOUNDED = XPRS_MIP_UNBOUNDED
286+
NOT_LOADED = POI_XPRS_MIP_NOT_LOADED,
287+
LP_NOT_OPTIMAL = POI_XPRS_MIP_LP_NOT_OPTIMAL,
288+
LP_OPTIMAL = POI_XPRS_MIP_LP_OPTIMAL,
289+
NO_SOL_FOUND = POI_XPRS_MIP_NO_SOL_FOUND,
290+
SOLUTION = POI_XPRS_MIP_SOLUTION,
291+
INFEAS = POI_XPRS_MIP_INFEAS,
292+
OPTIMAL = POI_XPRS_MIP_OPTIMAL,
293+
UNBOUNDED = POI_XPRS_MIP_UNBOUNDED
293294
};
294295

295296
enum class NLPSTATUS : int
296297
{
297-
UNSTARTED = XPRS_NLPSTATUS_UNSTARTED,
298-
SOLUTION = XPRS_NLPSTATUS_SOLUTION,
299-
LOCALLY_OPTIMAL = XPRS_NLPSTATUS_LOCALLY_OPTIMAL,
300-
OPTIMAL = XPRS_NLPSTATUS_OPTIMAL,
301-
NOSOLUTION = XPRS_NLPSTATUS_NOSOLUTION,
302-
LOCALLY_INFEASIBLE = XPRS_NLPSTATUS_LOCALLY_INFEASIBLE,
303-
INFEASIBLE = XPRS_NLPSTATUS_INFEASIBLE,
304-
UNBOUNDED = XPRS_NLPSTATUS_UNBOUNDED,
305-
UNFINISHED = XPRS_NLPSTATUS_UNFINISHED,
306-
UNSOLVED = XPRS_NLPSTATUS_UNSOLVED,
298+
UNSTARTED = POI_XPRS_NLPSTATUS_UNSTARTED,
299+
SOLUTION = POI_XPRS_NLPSTATUS_SOLUTION,
300+
LOCALLY_OPTIMAL = POI_XPRS_NLPSTATUS_LOCALLY_OPTIMAL,
301+
OPTIMAL = POI_XPRS_NLPSTATUS_OPTIMAL,
302+
NOSOLUTION = POI_XPRS_NLPSTATUS_NOSOLUTION,
303+
LOCALLY_INFEASIBLE = POI_XPRS_NLPSTATUS_LOCALLY_INFEASIBLE,
304+
INFEASIBLE = POI_XPRS_NLPSTATUS_INFEASIBLE,
305+
UNBOUNDED = POI_XPRS_NLPSTATUS_UNBOUNDED,
306+
UNFINISHED = POI_XPRS_NLPSTATUS_UNFINISHED,
307+
UNSOLVED = POI_XPRS_NLPSTATUS_UNSOLVED,
307308
};
308309

309310
enum class IISSOLSTATUS : int
310311
{
311-
UNSTARTED = XPRS_IIS_UNSTARTED,
312-
FEASIBLE = XPRS_IIS_FEASIBLE,
313-
COMPLETED = XPRS_IIS_COMPLETED,
314-
UNFINISHED = XPRS_IIS_UNFINISHED
312+
UNSTARTED = POI_XPRS_IIS_UNSTARTED,
313+
FEASIBLE = POI_XPRS_IIS_FEASIBLE,
314+
COMPLETED = POI_XPRS_IIS_COMPLETED,
315+
UNFINISHED = POI_XPRS_IIS_UNFINISHED
315316
};
316317

317318
enum class SOLAVAILABLE : int
318319
{
319-
NOTFOUND = XPRS_SOLAVAILABLE_NOTFOUND,
320-
OPTIMAL = XPRS_SOLAVAILABLE_OPTIMAL,
321-
FEASIBLE = XPRS_SOLAVAILABLE_FEASIBLE
320+
NOTFOUND = POI_XPRS_SOLAVAILABLE_NOTFOUND,
321+
OPTIMAL = POI_XPRS_SOLAVAILABLE_OPTIMAL,
322+
FEASIBLE = POI_XPRS_SOLAVAILABLE_FEASIBLE
322323
};
323324

324325
enum class OPTIMIZETYPE : int
325326
{
326-
NONE = XPRS_OPTIMIZETYPE_NONE,
327-
LP = XPRS_OPTIMIZETYPE_LP,
328-
MIP = XPRS_OPTIMIZETYPE_MIP,
329-
LOCAL = XPRS_OPTIMIZETYPE_LOCAL,
330-
GLOBAL = XPRS_OPTIMIZETYPE_GLOBAL
327+
NONE = POI_XPRS_OPTIMIZETYPE_NONE,
328+
LP = POI_XPRS_OPTIMIZETYPE_LP,
329+
MIP = POI_XPRS_OPTIMIZETYPE_MIP,
330+
LOCAL = POI_XPRS_OPTIMIZETYPE_LOCAL,
331+
GLOBAL = POI_XPRS_OPTIMIZETYPE_GLOBAL
331332
};
332333

333334
////////////////////////////////////////////////////////////////////////////////
@@ -512,8 +513,8 @@ class Model : public OnesideLinearConstraintMixin<Model>,
512513

513514
// Variables
514515
VariableIndex add_variable(VariableDomain domain = VariableDomain::Continuous,
515-
double lb = XPRS_MINUSINFINITY, double ub = XPRS_PLUSINFINITY,
516-
const char *name = nullptr);
516+
double lb = POI_XPRS_MINUSINFINITY,
517+
double ub = POI_XPRS_PLUSINFINITY, const char *name = nullptr);
517518
void delete_variable(VariableIndex variable);
518519
void delete_variables(const Vector<VariableIndex> &variables);
519520
void set_objective_coefficient(VariableIndex variable, double value);
@@ -638,7 +639,7 @@ class Model : public OnesideLinearConstraintMixin<Model>,
638639

639640
void cb_exit();
640641

641-
// NOTE: Xpress only provive ways to add local cuts, so, all these functions map to the same
642+
// NOTE: Xpress only provide ways to add local cuts, so, all these functions map to the same
642643
// XPRSaddcuts operation
643644
void cb_add_lazy_constraint(const ScalarAffineFunction &function, ConstraintSense sense,
644645
CoeffT rhs);

0 commit comments

Comments
 (0)