Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
xpress_interface.cc File Reference
#include <algorithm>
#include <clocale>
#include <fstream>
#include <istream>
#include <limits>
#include <memory>
#include <mutex>
#include <string>
#include "absl/strings/str_format.h"
#include "ortools/base/logging.h"
#include "ortools/base/timer.h"
#include "ortools/linear_solver/linear_solver.h"
#include "ortools/xpress/environment.h"

Go to the source code of this file.

Classes

class  operations_research::XpressMPCallbackContext
 
class  operations_research::MPCallbackWrapper
 Wraps the MPCallback in order to catch and store exceptions. More...
 
class  operations_research::XpressInterface
 
struct  operations_research::ScopedLocale
 

Namespaces

namespace  operations_research
 In SWIG mode, we don't want anything besides these top-level includes.
 

Macros

#define XPRS_INTEGER   'I'
 Initial version of this code was provided by RTE.
 
#define XPRS_CONTINUOUS   'C'
 
#define CHECK_STATUS(s)
 
#define XPRS_NAN   std::numeric_limits<double>::quiet_NaN()
 
#define setParamIfPossible_MACRO(target_map, setter, converter)
 

Enumerations

enum  operations_research::CUSTOM_INTERRUPT_REASON { operations_research::CALLBACK_EXCEPTION = 0 }
 
enum  operations_research::XPRS_BASIS_STATUS { operations_research::XPRS_AT_LOWER = 0 , operations_research::XPRS_BASIC = 1 , operations_research::XPRS_AT_UPPER = 2 , operations_research::XPRS_FREE_SUPER = 3 }
 

Functions

std::string operations_research::getSolverVersion (XPRSprob const &prob)
 
bool operations_research::readParameter (XPRSprob const &prob, std::string const &name, std::string const &value)
 Apply the specified name=value setting to prob.
 
void operations_research::printError (const XPRSprob &mLp, int line)
 
void XPRS_CC operations_research::XpressIntSolCallbackImpl (XPRSprob cbprob, void *cbdata)
 
void XPRS_CC operations_research::optimizermsg (XPRSprob prob, void *data, const char *sMsg, int nLen, int nMsgLvl)
 
int operations_research::getnumcols (const XPRSprob &mLp)
 
int operations_research::getnumrows (const XPRSprob &mLp)
 
int operations_research::getitcnt (const XPRSprob &mLp)
 
int operations_research::getnodecnt (const XPRSprob &mLp)
 
int operations_research::setobjoffset (const XPRSprob &mLp, double value)
 
void operations_research::addhint (const XPRSprob &mLp, int length, const double solval[], const int colind[])
 
void operations_research::interruptXPRESS (XPRSprob &xprsProb, CUSTOM_INTERRUPT_REASON reason)
 
static int operations_research::MPSolverToXpressBasisStatus (MPSolver::BasisStatus mpsolver_basis_status)
 Transform MPSolver basis status to XPRESS status.
 
static MPSolver::BasisStatus operations_research::XpressToMPSolverBasisStatus (int xpress_basis_status)
 Transform XPRESS basis status to MPSolver basis status.
 
static std::map< std::string, int > & operations_research::getMapStringControls ()
 
static std::map< std::string, int > & operations_research::getMapDoubleControls ()
 
static std::map< std::string, int > & operations_research::getMapIntControls ()
 
static std::map< std::string, int > & operations_research::getMapInt64Controls ()
 
std::vector< int > operations_research::XpressBasisStatusesFrom (const std::vector< MPSolver::BasisStatus > &statuses)
 
MPSolverInterfaceoperations_research::BuildXpressInterface (bool mip, MPSolver *const solver)
 
template<class Container >
void operations_research::splitMyString (const std::string &str, Container &cont, char delim=' ')
 
const char * operations_research::stringToCharPtr (std::string &var)
 

Macro Definition Documentation

◆ CHECK_STATUS

#define CHECK_STATUS ( s)
Value:
do { \
int const status_ = s; \
CHECK_EQ(0, status_); \
} while (0)

The argument to this macro is the invocation of a XPRS function that returns a status. If the function returns non-zero the macro aborts the program with an appropriate error message.

Definition at line 37 of file xpress_interface.cc.

◆ setParamIfPossible_MACRO

#define setParamIfPossible_MACRO ( target_map,
setter,
converter )
Value:
{ \
auto matchingParamIter = (target_map).find(paramAndValuePair.first); \
if (matchingParamIter != (target_map).end()) { \
const auto convertedValue = converter(paramAndValuePair.second); \
VLOG(1) << "Setting parameter " << paramAndValuePair.first \
<< " to value " << convertedValue << std::endl; \
setter(mLp, matchingParamIter->second, convertedValue); \
continue; \
} \
}
std::optional< int64_t > end

Definition at line 2125 of file xpress_interface.cc.

◆ XPRS_CONTINUOUS

#define XPRS_CONTINUOUS   'C'

Definition at line 32 of file xpress_interface.cc.

◆ XPRS_INTEGER

#define XPRS_INTEGER   'I'

Initial version of this code was provided by RTE.

Copyright 2019-2023 RTE Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition at line 31 of file xpress_interface.cc.

◆ XPRS_NAN

#define XPRS_NAN   std::numeric_limits<double>::quiet_NaN()

In case we need to return a double but don't have a value for that we just return a NaN.

Definition at line 216 of file xpress_interface.cc.