[1665] | 1 | // $Id: Clp_C_Interface.cpp 2019 2014-01-31 05:18:01Z stefan $ |
---|
[241] | 2 | // Copyright (C) 2003, International Business Machines |
---|
| 3 | // Corporation and others. All Rights Reserved. |
---|
[1665] | 4 | // This code is licensed under the terms of the Eclipse Public License (EPL). |
---|
[241] | 5 | |
---|
| 6 | |
---|
| 7 | #include "CoinPragma.hpp" |
---|
| 8 | |
---|
[1231] | 9 | #include <cmath> |
---|
| 10 | #include <cstring> |
---|
[241] | 11 | |
---|
| 12 | #include "CoinHelperFunctions.hpp" |
---|
[2019] | 13 | #include "ClpConfig.h" |
---|
[241] | 14 | #include "ClpSimplex.hpp" |
---|
[891] | 15 | #include "ClpInterior.hpp" |
---|
[1480] | 16 | #ifndef SLIM_CLP |
---|
| 17 | #include "Idiot.hpp" |
---|
| 18 | #endif |
---|
[241] | 19 | #include <cfloat> |
---|
[429] | 20 | // Get C stuff but with extern C |
---|
| 21 | #define CLP_EXTERN_C |
---|
| 22 | #include "Coin_C_defines.h" |
---|
[241] | 23 | |
---|
[441] | 24 | /// To allow call backs |
---|
[242] | 25 | class CMessageHandler : public CoinMessageHandler { |
---|
[1525] | 26 | |
---|
[242] | 27 | public: |
---|
[1525] | 28 | /**@name Overrides */ |
---|
| 29 | //@{ |
---|
| 30 | virtual int print(); |
---|
| 31 | //@} |
---|
| 32 | /**@name set and get */ |
---|
| 33 | //@{ |
---|
| 34 | /// Model |
---|
| 35 | const Clp_Simplex * model() const; |
---|
| 36 | void setModel(Clp_Simplex * model); |
---|
| 37 | /// Call back |
---|
| 38 | void setCallBack(clp_callback callback); |
---|
| 39 | //@} |
---|
[242] | 40 | |
---|
[1525] | 41 | /**@name Constructors, destructor */ |
---|
| 42 | //@{ |
---|
| 43 | /** Default constructor. */ |
---|
| 44 | CMessageHandler(); |
---|
| 45 | /// Constructor with pointer to model |
---|
| 46 | CMessageHandler(Clp_Simplex * model, |
---|
| 47 | FILE * userPointer = NULL); |
---|
| 48 | /** Destructor */ |
---|
| 49 | virtual ~CMessageHandler(); |
---|
| 50 | //@} |
---|
[242] | 51 | |
---|
[1525] | 52 | /**@name Copy method */ |
---|
| 53 | //@{ |
---|
| 54 | /** The copy constructor. */ |
---|
| 55 | CMessageHandler(const CMessageHandler&); |
---|
| 56 | /** The copy constructor from an CoinSimplexMessageHandler. */ |
---|
| 57 | CMessageHandler(const CoinMessageHandler&); |
---|
| 58 | |
---|
| 59 | CMessageHandler& operator=(const CMessageHandler&); |
---|
| 60 | /// Clone |
---|
| 61 | virtual CoinMessageHandler * clone() const ; |
---|
| 62 | //@} |
---|
| 63 | |
---|
| 64 | |
---|
[242] | 65 | protected: |
---|
[1525] | 66 | /**@name Data members |
---|
| 67 | The data members are protected to allow access for derived classes. */ |
---|
| 68 | //@{ |
---|
| 69 | /// Pointer back to model |
---|
| 70 | Clp_Simplex * model_; |
---|
| 71 | /// call back |
---|
| 72 | clp_callback callback_; |
---|
| 73 | //@} |
---|
[242] | 74 | }; |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | //------------------------------------------------------------------- |
---|
[1525] | 78 | // Default Constructor |
---|
[242] | 79 | //------------------------------------------------------------------- |
---|
[1525] | 80 | CMessageHandler::CMessageHandler () |
---|
| 81 | : CoinMessageHandler(), |
---|
| 82 | model_(NULL), |
---|
| 83 | callback_(NULL) |
---|
[242] | 84 | { |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | //------------------------------------------------------------------- |
---|
[1525] | 88 | // Copy constructor |
---|
[242] | 89 | //------------------------------------------------------------------- |
---|
[1525] | 90 | CMessageHandler::CMessageHandler (const CMessageHandler & rhs) |
---|
| 91 | : CoinMessageHandler(rhs), |
---|
| 92 | model_(rhs.model_), |
---|
| 93 | callback_(rhs.callback_) |
---|
| 94 | { |
---|
[242] | 95 | } |
---|
| 96 | |
---|
[1525] | 97 | CMessageHandler::CMessageHandler (const CoinMessageHandler & rhs) |
---|
| 98 | : CoinMessageHandler(rhs), |
---|
| 99 | model_(NULL), |
---|
| 100 | callback_(NULL) |
---|
| 101 | { |
---|
[242] | 102 | } |
---|
| 103 | |
---|
| 104 | // Constructor with pointer to model |
---|
| 105 | CMessageHandler::CMessageHandler(Clp_Simplex * model, |
---|
[1525] | 106 | FILE * ) |
---|
| 107 | : CoinMessageHandler(), |
---|
| 108 | model_(model), |
---|
| 109 | callback_(NULL) |
---|
[242] | 110 | { |
---|
| 111 | } |
---|
| 112 | |
---|
| 113 | //------------------------------------------------------------------- |
---|
[1525] | 114 | // Destructor |
---|
[242] | 115 | //------------------------------------------------------------------- |
---|
| 116 | CMessageHandler::~CMessageHandler () |
---|
| 117 | { |
---|
| 118 | } |
---|
| 119 | |
---|
| 120 | //---------------------------------------------------------------- |
---|
[1525] | 121 | // Assignment operator |
---|
[242] | 122 | //------------------------------------------------------------------- |
---|
| 123 | CMessageHandler & |
---|
| 124 | CMessageHandler::operator=(const CMessageHandler& rhs) |
---|
| 125 | { |
---|
[1525] | 126 | if (this != &rhs) { |
---|
| 127 | CoinMessageHandler::operator=(rhs); |
---|
| 128 | model_ = rhs.model_; |
---|
| 129 | callback_ = rhs.callback_; |
---|
| 130 | } |
---|
| 131 | return *this; |
---|
[242] | 132 | } |
---|
| 133 | //------------------------------------------------------------------- |
---|
| 134 | // Clone |
---|
| 135 | //------------------------------------------------------------------- |
---|
| 136 | CoinMessageHandler * CMessageHandler::clone() const |
---|
| 137 | { |
---|
[1525] | 138 | return new CMessageHandler(*this); |
---|
[242] | 139 | } |
---|
| 140 | |
---|
[1525] | 141 | int |
---|
[242] | 142 | CMessageHandler::print() |
---|
| 143 | { |
---|
[1525] | 144 | if (callback_) { |
---|
| 145 | int messageNumber = currentMessage().externalNumber(); |
---|
| 146 | if (currentSource() != "Clp") |
---|
| 147 | messageNumber += 1000000; |
---|
| 148 | int i; |
---|
| 149 | int nDouble = numberDoubleFields(); |
---|
| 150 | assert (nDouble <= 10); |
---|
| 151 | double vDouble[10]; |
---|
| 152 | for (i = 0; i < nDouble; i++) |
---|
| 153 | vDouble[i] = doubleValue(i); |
---|
| 154 | int nInt = numberIntFields(); |
---|
| 155 | assert (nInt <= 10); |
---|
| 156 | int vInt[10]; |
---|
| 157 | for (i = 0; i < nInt; i++) |
---|
| 158 | vInt[i] = intValue(i); |
---|
| 159 | int nString = numberStringFields(); |
---|
| 160 | assert (nString <= 10); |
---|
| 161 | char * vString[10]; |
---|
| 162 | for (i = 0; i < nString; i++) { |
---|
| 163 | std::string value = stringValue(i); |
---|
| 164 | vString[i] = CoinStrdup(value.c_str()); |
---|
| 165 | } |
---|
| 166 | callback_(model_, messageNumber, |
---|
| 167 | nDouble, vDouble, |
---|
| 168 | nInt, vInt, |
---|
| 169 | nString, vString); |
---|
| 170 | for (i = 0; i < nString; i++) |
---|
| 171 | free(vString[i]); |
---|
| 172 | |
---|
| 173 | } |
---|
| 174 | return CoinMessageHandler::print(); |
---|
[242] | 175 | } |
---|
| 176 | const Clp_Simplex * |
---|
| 177 | CMessageHandler::model() const |
---|
| 178 | { |
---|
[1525] | 179 | return model_; |
---|
[242] | 180 | } |
---|
[1525] | 181 | void |
---|
[242] | 182 | CMessageHandler::setModel(Clp_Simplex * model) |
---|
| 183 | { |
---|
[1525] | 184 | model_ = model; |
---|
[242] | 185 | } |
---|
| 186 | // Call back |
---|
[1525] | 187 | void |
---|
[242] | 188 | CMessageHandler::setCallBack(clp_callback callback) |
---|
| 189 | { |
---|
[1525] | 190 | callback_ = callback; |
---|
[242] | 191 | } |
---|
| 192 | |
---|
[241] | 193 | #include "Clp_C_Interface.h" |
---|
| 194 | #include <string> |
---|
| 195 | #include <stdio.h> |
---|
| 196 | #include <iostream> |
---|
| 197 | |
---|
[1525] | 198 | #if defined(__MWERKS__) |
---|
[431] | 199 | #pragma export on |
---|
| 200 | #endif |
---|
[2019] | 201 | |
---|
| 202 | |
---|
| 203 | COINLIBAPI const char* COINLINKAGE |
---|
| 204 | Clp_Version(void) |
---|
| 205 | { |
---|
| 206 | return CLP_VERSION; |
---|
| 207 | } |
---|
| 208 | COINLIBAPI int COINLINKAGE |
---|
| 209 | Clp_VersionMajor(void) |
---|
| 210 | { |
---|
| 211 | return CLP_VERSION_MAJOR; |
---|
| 212 | } |
---|
| 213 | COINLIBAPI int COINLINKAGE Clp_VersionMinor(void) |
---|
| 214 | { |
---|
| 215 | return CLP_VERSION_MINOR; |
---|
| 216 | } |
---|
| 217 | COINLIBAPI int COINLINKAGE Clp_VersionRelease(void) |
---|
| 218 | { |
---|
| 219 | return CLP_VERSION_RELEASE; |
---|
| 220 | } |
---|
| 221 | |
---|
[241] | 222 | /* Default constructor */ |
---|
[1525] | 223 | COINLIBAPI Clp_Simplex * COINLINKAGE |
---|
[241] | 224 | Clp_newModel() |
---|
| 225 | { |
---|
[1525] | 226 | Clp_Simplex * model = new Clp_Simplex; |
---|
| 227 | model->model_ = new ClpSimplex(); |
---|
| 228 | model->handler_ = NULL; |
---|
| 229 | return model; |
---|
[241] | 230 | } |
---|
| 231 | /* Destructor */ |
---|
[1525] | 232 | COINLIBAPI void COINLINKAGE |
---|
[241] | 233 | Clp_deleteModel(Clp_Simplex * model) |
---|
| 234 | { |
---|
[1525] | 235 | delete model->model_; |
---|
| 236 | delete model->handler_; |
---|
| 237 | delete model; |
---|
[241] | 238 | } |
---|
| 239 | |
---|
| 240 | /* Loads a problem (the constraints on the |
---|
| 241 | rows are given by lower and upper bounds). If a pointer is NULL then the |
---|
| 242 | following values are the default: |
---|
| 243 | <ul> |
---|
| 244 | <li> <code>colub</code>: all columns have upper bound infinity |
---|
[1525] | 245 | <li> <code>collb</code>: all columns have lower bound 0 |
---|
[241] | 246 | <li> <code>rowub</code>: all rows have upper bound infinity |
---|
| 247 | <li> <code>rowlb</code>: all rows have lower bound -infinity |
---|
| 248 | <li> <code>obj</code>: all variables have 0 objective coefficient |
---|
| 249 | </ul> |
---|
| 250 | */ |
---|
| 251 | /* Just like the other loadProblem() method except that the matrix is |
---|
| 252 | given in a standard column major ordered format (without gaps). */ |
---|
[1525] | 253 | COINLIBAPI void COINLINKAGE |
---|
[241] | 254 | Clp_loadProblem (Clp_Simplex * model, const int numcols, const int numrows, |
---|
[1525] | 255 | const CoinBigIndex * start, const int* index, |
---|
| 256 | const double* value, |
---|
| 257 | const double* collb, const double* colub, |
---|
| 258 | const double* obj, |
---|
| 259 | const double* rowlb, const double* rowub) |
---|
[241] | 260 | { |
---|
[1525] | 261 | const char prefix[] = "Clp_c_Interface::Clp_loadProblem(): "; |
---|
| 262 | const int verbose = 0; |
---|
| 263 | if (verbose > 1) { |
---|
| 264 | printf("%s numcols = %i, numrows = %i\n", |
---|
| 265 | prefix, numcols, numrows); |
---|
| 266 | printf("%s model = %p, start = %p, index = %p, value = %p\n", |
---|
| 267 | prefix, reinterpret_cast<const void *>(model), reinterpret_cast<const void *>(start), reinterpret_cast<const void *>(index), reinterpret_cast<const void *>(value)); |
---|
| 268 | printf("%s collb = %p, colub = %p, obj = %p, rowlb = %p, rowub = %p\n", |
---|
| 269 | prefix, reinterpret_cast<const void *>(collb), reinterpret_cast<const void *>(colub), reinterpret_cast<const void *>(obj), reinterpret_cast<const void *>(rowlb), reinterpret_cast<const void *>(rowub)); |
---|
| 270 | } |
---|
| 271 | model->model_->loadProblem(numcols, numrows, start, index, value, |
---|
| 272 | collb, colub, obj, rowlb, rowub); |
---|
[241] | 273 | } |
---|
[891] | 274 | /* read quadratic part of the objective (the matrix part) */ |
---|
[1525] | 275 | COINLIBAPI void COINLINKAGE |
---|
| 276 | Clp_loadQuadraticObjective(Clp_Simplex * model, |
---|
| 277 | const int numberColumns, |
---|
[891] | 278 | const CoinBigIndex * start, |
---|
[1525] | 279 | const int * column, |
---|
[891] | 280 | const double * element) |
---|
| 281 | { |
---|
| 282 | |
---|
[1525] | 283 | model->model_->loadQuadraticObjective(numberColumns, |
---|
| 284 | start, column, element); |
---|
[891] | 285 | |
---|
| 286 | } |
---|
[241] | 287 | /* Read an mps file from the given filename */ |
---|
[1525] | 288 | COINLIBAPI int COINLINKAGE |
---|
| 289 | Clp_readMps(Clp_Simplex * model, const char *filename, |
---|
| 290 | int keepNames, |
---|
| 291 | int ignoreErrors) |
---|
[241] | 292 | { |
---|
[1525] | 293 | return model->model_->readMps(filename, keepNames != 0, ignoreErrors != 0); |
---|
[241] | 294 | } |
---|
| 295 | /* Copy in integer informations */ |
---|
[1525] | 296 | COINLIBAPI void COINLINKAGE |
---|
| 297 | Clp_copyInIntegerInformation(Clp_Simplex * model, const char * information) |
---|
[241] | 298 | { |
---|
[1525] | 299 | model->model_->copyInIntegerInformation(information); |
---|
[241] | 300 | } |
---|
| 301 | /* Drop integer informations */ |
---|
[1525] | 302 | COINLIBAPI void COINLINKAGE |
---|
[241] | 303 | Clp_deleteIntegerInformation(Clp_Simplex * model) |
---|
| 304 | { |
---|
[1525] | 305 | model->model_->deleteIntegerInformation(); |
---|
[241] | 306 | } |
---|
| 307 | /* Resizes rim part of model */ |
---|
[1525] | 308 | COINLIBAPI void COINLINKAGE |
---|
[241] | 309 | Clp_resize (Clp_Simplex * model, int newNumberRows, int newNumberColumns) |
---|
| 310 | { |
---|
[1525] | 311 | model->model_->resize(newNumberRows, newNumberColumns); |
---|
[241] | 312 | } |
---|
| 313 | /* Deletes rows */ |
---|
[1525] | 314 | COINLIBAPI void COINLINKAGE |
---|
[241] | 315 | Clp_deleteRows(Clp_Simplex * model, int number, const int * which) |
---|
| 316 | { |
---|
[1525] | 317 | model->model_->deleteRows(number, which); |
---|
[241] | 318 | } |
---|
| 319 | /* Add rows */ |
---|
[1525] | 320 | COINLIBAPI void COINLINKAGE |
---|
| 321 | Clp_addRows(Clp_Simplex * model, int number, const double * rowLower, |
---|
| 322 | const double * rowUpper, |
---|
| 323 | const int * rowStarts, const int * columns, |
---|
| 324 | const double * elements) |
---|
[241] | 325 | { |
---|
[1525] | 326 | model->model_->addRows(number, rowLower, rowUpper, rowStarts, columns, elements); |
---|
[241] | 327 | } |
---|
| 328 | |
---|
| 329 | /* Deletes columns */ |
---|
[1525] | 330 | COINLIBAPI void COINLINKAGE |
---|
[241] | 331 | Clp_deleteColumns(Clp_Simplex * model, int number, const int * which) |
---|
| 332 | { |
---|
[1525] | 333 | model->model_->deleteColumns(number, which); |
---|
[241] | 334 | } |
---|
| 335 | /* Add columns */ |
---|
[1525] | 336 | COINLIBAPI void COINLINKAGE |
---|
| 337 | Clp_addColumns(Clp_Simplex * model, int number, const double * columnLower, |
---|
| 338 | const double * columnUpper, |
---|
| 339 | const double * objective, |
---|
| 340 | const int * columnStarts, const int * rows, |
---|
| 341 | const double * elements) |
---|
[241] | 342 | { |
---|
[1525] | 343 | model->model_->addColumns(number, columnLower, columnUpper, objective, |
---|
| 344 | columnStarts, rows, elements); |
---|
[241] | 345 | } |
---|
[409] | 346 | /* Change row lower bounds */ |
---|
[1525] | 347 | COINLIBAPI void COINLINKAGE |
---|
| 348 | Clp_chgRowLower(Clp_Simplex * model, const double * rowLower) |
---|
[409] | 349 | { |
---|
[1525] | 350 | model->model_->chgRowLower(rowLower); |
---|
[409] | 351 | } |
---|
| 352 | /* Change row upper bounds */ |
---|
[1525] | 353 | COINLIBAPI void COINLINKAGE |
---|
| 354 | Clp_chgRowUpper(Clp_Simplex * model, const double * rowUpper) |
---|
[409] | 355 | { |
---|
[1525] | 356 | model->model_->chgRowUpper(rowUpper); |
---|
[409] | 357 | } |
---|
| 358 | /* Change column lower bounds */ |
---|
[1525] | 359 | COINLIBAPI void COINLINKAGE |
---|
| 360 | Clp_chgColumnLower(Clp_Simplex * model, const double * columnLower) |
---|
[409] | 361 | { |
---|
[1525] | 362 | model->model_->chgColumnLower(columnLower); |
---|
[409] | 363 | } |
---|
| 364 | /* Change column upper bounds */ |
---|
[1525] | 365 | COINLIBAPI void COINLINKAGE |
---|
| 366 | Clp_chgColumnUpper(Clp_Simplex * model, const double * columnUpper) |
---|
[409] | 367 | { |
---|
[1525] | 368 | model->model_->chgColumnUpper(columnUpper); |
---|
[409] | 369 | } |
---|
| 370 | /* Change objective coefficients */ |
---|
[1525] | 371 | COINLIBAPI void COINLINKAGE |
---|
| 372 | Clp_chgObjCoefficients(Clp_Simplex * model, const double * objIn) |
---|
[409] | 373 | { |
---|
[1525] | 374 | model->model_->chgObjCoefficients(objIn); |
---|
[409] | 375 | } |
---|
[241] | 376 | /* Drops names - makes lengthnames 0 and names empty */ |
---|
[1525] | 377 | COINLIBAPI void COINLINKAGE |
---|
[241] | 378 | Clp_dropNames(Clp_Simplex * model) |
---|
| 379 | { |
---|
[1525] | 380 | model->model_->dropNames(); |
---|
[241] | 381 | } |
---|
| 382 | /* Copies in names */ |
---|
[1525] | 383 | COINLIBAPI void COINLINKAGE |
---|
[241] | 384 | Clp_copyNames(Clp_Simplex * model, const char * const * rowNamesIn, |
---|
[1525] | 385 | const char * const * columnNamesIn) |
---|
[241] | 386 | { |
---|
[1525] | 387 | int iRow; |
---|
| 388 | std::vector<std::string> rowNames; |
---|
| 389 | int numberRows = model->model_->numberRows(); |
---|
| 390 | rowNames.reserve(numberRows); |
---|
| 391 | for (iRow = 0; iRow < numberRows; iRow++) { |
---|
| 392 | rowNames.push_back(rowNamesIn[iRow]); |
---|
| 393 | } |
---|
| 394 | |
---|
| 395 | int iColumn; |
---|
| 396 | std::vector<std::string> columnNames; |
---|
| 397 | int numberColumns = model->model_->numberColumns(); |
---|
| 398 | columnNames.reserve(numberColumns); |
---|
| 399 | for (iColumn = 0; iColumn < numberColumns; iColumn++) { |
---|
| 400 | columnNames.push_back(columnNamesIn[iColumn]); |
---|
| 401 | } |
---|
| 402 | model->model_->copyNames(rowNames, columnNames); |
---|
[241] | 403 | } |
---|
| 404 | |
---|
| 405 | /* Number of rows */ |
---|
[1525] | 406 | COINLIBAPI int COINLINKAGE |
---|
[241] | 407 | Clp_numberRows(Clp_Simplex * model) |
---|
| 408 | { |
---|
[1525] | 409 | return model->model_->numberRows(); |
---|
[241] | 410 | } |
---|
| 411 | /* Number of columns */ |
---|
[1525] | 412 | COINLIBAPI int COINLINKAGE |
---|
[241] | 413 | Clp_numberColumns(Clp_Simplex * model) |
---|
| 414 | { |
---|
[1525] | 415 | return model->model_->numberColumns(); |
---|
[241] | 416 | } |
---|
| 417 | /* Primal tolerance to use */ |
---|
[1525] | 418 | COINLIBAPI double COINLINKAGE |
---|
[241] | 419 | Clp_primalTolerance(Clp_Simplex * model) |
---|
| 420 | { |
---|
[1525] | 421 | return model->model_->primalTolerance(); |
---|
[241] | 422 | } |
---|
[1525] | 423 | COINLIBAPI void COINLINKAGE |
---|
| 424 | Clp_setPrimalTolerance(Clp_Simplex * model, double value) |
---|
[241] | 425 | { |
---|
[1525] | 426 | model->model_->setPrimalTolerance(value); |
---|
[241] | 427 | } |
---|
| 428 | /* Dual tolerance to use */ |
---|
[1525] | 429 | COINLIBAPI double COINLINKAGE |
---|
[241] | 430 | Clp_dualTolerance(Clp_Simplex * model) |
---|
| 431 | { |
---|
[1525] | 432 | return model->model_->dualTolerance(); |
---|
[241] | 433 | } |
---|
[1525] | 434 | COINLIBAPI void COINLINKAGE |
---|
| 435 | Clp_setDualTolerance(Clp_Simplex * model, double value) |
---|
[241] | 436 | { |
---|
[1525] | 437 | model->model_->setDualTolerance(value); |
---|
[241] | 438 | } |
---|
| 439 | /* Dual objective limit */ |
---|
[1525] | 440 | COINLIBAPI double COINLINKAGE |
---|
[241] | 441 | Clp_dualObjectiveLimit(Clp_Simplex * model) |
---|
| 442 | { |
---|
[1525] | 443 | return model->model_->dualObjectiveLimit(); |
---|
[241] | 444 | } |
---|
[1525] | 445 | COINLIBAPI void COINLINKAGE |
---|
[241] | 446 | Clp_setDualObjectiveLimit(Clp_Simplex * model, double value) |
---|
| 447 | { |
---|
[1525] | 448 | model->model_->setDualObjectiveLimit(value); |
---|
[241] | 449 | } |
---|
| 450 | /* Objective offset */ |
---|
[1525] | 451 | COINLIBAPI double COINLINKAGE |
---|
[241] | 452 | Clp_objectiveOffset(Clp_Simplex * model) |
---|
| 453 | { |
---|
[1525] | 454 | return model->model_->objectiveOffset(); |
---|
[241] | 455 | } |
---|
[1525] | 456 | COINLIBAPI void COINLINKAGE |
---|
[241] | 457 | Clp_setObjectiveOffset(Clp_Simplex * model, double value) |
---|
| 458 | { |
---|
[1525] | 459 | model->model_->setObjectiveOffset(value); |
---|
[241] | 460 | } |
---|
| 461 | /* Fills in array with problem name */ |
---|
[1525] | 462 | COINLIBAPI void COINLINKAGE |
---|
[241] | 463 | Clp_problemName(Clp_Simplex * model, int maxNumberCharacters, char * array) |
---|
| 464 | { |
---|
[1525] | 465 | std::string name = model->model_->problemName(); |
---|
[1689] | 466 | maxNumberCharacters = CoinMin(maxNumberCharacters, |
---|
| 467 | ((int) strlen(name.c_str()))+1) ; |
---|
[1525] | 468 | strncpy(array, name.c_str(), maxNumberCharacters - 1); |
---|
| 469 | array[maxNumberCharacters-1] = '\0'; |
---|
[241] | 470 | } |
---|
[429] | 471 | /* Sets problem name. Must have \0 at end. */ |
---|
[1525] | 472 | COINLIBAPI int COINLINKAGE |
---|
[1402] | 473 | Clp_setProblemName(Clp_Simplex * model, int /*maxNumberCharacters*/, char * array) |
---|
[429] | 474 | { |
---|
[1525] | 475 | return model->model_->setStrParam(ClpProbName, array); |
---|
[429] | 476 | } |
---|
[241] | 477 | /* Number of iterations */ |
---|
[1525] | 478 | COINLIBAPI int COINLINKAGE |
---|
[241] | 479 | Clp_numberIterations(Clp_Simplex * model) |
---|
| 480 | { |
---|
[1525] | 481 | return model->model_->numberIterations(); |
---|
[241] | 482 | } |
---|
[1525] | 483 | COINLIBAPI void COINLINKAGE |
---|
[241] | 484 | Clp_setNumberIterations(Clp_Simplex * model, int numberIterations) |
---|
| 485 | { |
---|
[1525] | 486 | model->model_->setNumberIterations(numberIterations); |
---|
[241] | 487 | } |
---|
| 488 | /* Maximum number of iterations */ |
---|
[429] | 489 | COINLIBAPI int maximumIterations(Clp_Simplex * model) |
---|
[241] | 490 | { |
---|
[1525] | 491 | return model->model_->maximumIterations(); |
---|
[241] | 492 | } |
---|
[1525] | 493 | COINLIBAPI void COINLINKAGE |
---|
[241] | 494 | Clp_setMaximumIterations(Clp_Simplex * model, int value) |
---|
| 495 | { |
---|
[1525] | 496 | model->model_->setMaximumIterations(value); |
---|
[241] | 497 | } |
---|
| 498 | /* Maximum time in seconds (from when set called) */ |
---|
[1525] | 499 | COINLIBAPI double COINLINKAGE |
---|
[241] | 500 | Clp_maximumSeconds(Clp_Simplex * model) |
---|
| 501 | { |
---|
[1525] | 502 | return model->model_->maximumSeconds(); |
---|
[241] | 503 | } |
---|
[1525] | 504 | COINLIBAPI void COINLINKAGE |
---|
[241] | 505 | Clp_setMaximumSeconds(Clp_Simplex * model, double value) |
---|
| 506 | { |
---|
[1525] | 507 | model->model_->setMaximumSeconds(value); |
---|
[241] | 508 | } |
---|
| 509 | /* Returns true if hit maximum iteratio`ns (or time) */ |
---|
[1525] | 510 | COINLIBAPI int COINLINKAGE |
---|
[241] | 511 | Clp_hitMaximumIterations(Clp_Simplex * model) |
---|
| 512 | { |
---|
[1525] | 513 | return model->model_->hitMaximumIterations() ? 1 : 0; |
---|
[241] | 514 | } |
---|
| 515 | /* Status of problem: |
---|
| 516 | 0 - optimal |
---|
| 517 | 1 - primal infeasible |
---|
| 518 | 2 - dual infeasible |
---|
| 519 | 3 - stopped on iterations etc |
---|
| 520 | 4 - stopped due to errors |
---|
| 521 | */ |
---|
[1525] | 522 | COINLIBAPI int COINLINKAGE |
---|
[241] | 523 | Clp_status(Clp_Simplex * model) |
---|
| 524 | { |
---|
[1525] | 525 | return model->model_->status(); |
---|
[241] | 526 | } |
---|
| 527 | /* Set problem status */ |
---|
[1525] | 528 | COINLIBAPI void COINLINKAGE |
---|
[241] | 529 | Clp_setProblemStatus(Clp_Simplex * model, int problemStatus) |
---|
| 530 | { |
---|
[1525] | 531 | model->model_->setProblemStatus(problemStatus); |
---|
[241] | 532 | } |
---|
| 533 | /* Secondary status of problem - may get extended |
---|
| 534 | 0 - none |
---|
| 535 | 1 - primal infeasible because dual limit reached |
---|
| 536 | 2 - scaled problem optimal - unscaled has primal infeasibilities |
---|
| 537 | 3 - scaled problem optimal - unscaled has dual infeasibilities |
---|
| 538 | 4 - scaled problem optimal - unscaled has both dual and primal infeasibilities |
---|
| 539 | */ |
---|
[1525] | 540 | COINLIBAPI int COINLINKAGE |
---|
[241] | 541 | Clp_secondaryStatus(Clp_Simplex * model) |
---|
| 542 | { |
---|
[1525] | 543 | return model->model_->secondaryStatus(); |
---|
[241] | 544 | } |
---|
[1525] | 545 | COINLIBAPI void COINLINKAGE |
---|
[241] | 546 | Clp_setSecondaryStatus(Clp_Simplex * model, int status) |
---|
| 547 | { |
---|
[1525] | 548 | model->model_->setSecondaryStatus(status); |
---|
[241] | 549 | } |
---|
| 550 | /* Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore */ |
---|
[1525] | 551 | COINLIBAPI double COINLINKAGE |
---|
[241] | 552 | Clp_optimizationDirection(Clp_Simplex * model) |
---|
| 553 | { |
---|
[1525] | 554 | return model->model_->optimizationDirection(); |
---|
[241] | 555 | } |
---|
[1525] | 556 | COINLIBAPI void COINLINKAGE |
---|
[241] | 557 | Clp_setOptimizationDirection(Clp_Simplex * model, double value) |
---|
| 558 | { |
---|
[1525] | 559 | model->model_->setOptimizationDirection(value); |
---|
[241] | 560 | } |
---|
| 561 | /* Primal row solution */ |
---|
[1525] | 562 | COINLIBAPI double * COINLINKAGE |
---|
[241] | 563 | Clp_primalRowSolution(Clp_Simplex * model) |
---|
| 564 | { |
---|
[1525] | 565 | return model->model_->primalRowSolution(); |
---|
[241] | 566 | } |
---|
| 567 | /* Primal column solution */ |
---|
[1525] | 568 | COINLIBAPI double * COINLINKAGE |
---|
[241] | 569 | Clp_primalColumnSolution(Clp_Simplex * model) |
---|
| 570 | { |
---|
[1525] | 571 | return model->model_->primalColumnSolution(); |
---|
[241] | 572 | } |
---|
| 573 | /* Dual row solution */ |
---|
[1525] | 574 | COINLIBAPI double * COINLINKAGE |
---|
[241] | 575 | Clp_dualRowSolution(Clp_Simplex * model) |
---|
| 576 | { |
---|
[1525] | 577 | return model->model_->dualRowSolution(); |
---|
[241] | 578 | } |
---|
| 579 | /* Reduced costs */ |
---|
[1525] | 580 | COINLIBAPI double * COINLINKAGE |
---|
[241] | 581 | Clp_dualColumnSolution(Clp_Simplex * model) |
---|
| 582 | { |
---|
[1525] | 583 | return model->model_->dualColumnSolution(); |
---|
[241] | 584 | } |
---|
| 585 | /* Row lower */ |
---|
[1525] | 586 | COINLIBAPI double* COINLINKAGE |
---|
[241] | 587 | Clp_rowLower(Clp_Simplex * model) |
---|
| 588 | { |
---|
[1525] | 589 | return model->model_->rowLower(); |
---|
[241] | 590 | } |
---|
| 591 | /* Row upper */ |
---|
[1525] | 592 | COINLIBAPI double* COINLINKAGE |
---|
[241] | 593 | Clp_rowUpper(Clp_Simplex * model) |
---|
| 594 | { |
---|
[1525] | 595 | return model->model_->rowUpper(); |
---|
[241] | 596 | } |
---|
| 597 | /* Objective */ |
---|
[1525] | 598 | COINLIBAPI double * COINLINKAGE |
---|
[241] | 599 | Clp_objective(Clp_Simplex * model) |
---|
| 600 | { |
---|
[1525] | 601 | return model->model_->objective(); |
---|
[241] | 602 | } |
---|
| 603 | /* Column Lower */ |
---|
[1525] | 604 | COINLIBAPI double * COINLINKAGE |
---|
[241] | 605 | Clp_columnLower(Clp_Simplex * model) |
---|
| 606 | { |
---|
[1525] | 607 | return model->model_->columnLower(); |
---|
[241] | 608 | } |
---|
| 609 | /* Column Upper */ |
---|
[1525] | 610 | COINLIBAPI double * COINLINKAGE |
---|
[241] | 611 | Clp_columnUpper(Clp_Simplex * model) |
---|
| 612 | { |
---|
[1525] | 613 | return model->model_->columnUpper(); |
---|
[241] | 614 | } |
---|
| 615 | /* Number of elements in matrix */ |
---|
[1525] | 616 | COINLIBAPI int COINLINKAGE |
---|
[241] | 617 | Clp_getNumElements(Clp_Simplex * model) |
---|
| 618 | { |
---|
[1525] | 619 | return model->model_->getNumElements(); |
---|
[241] | 620 | } |
---|
[1525] | 621 | // Column starts in matrix |
---|
[429] | 622 | COINLIBAPI const CoinBigIndex * COINLINKAGE Clp_getVectorStarts(Clp_Simplex * model) |
---|
| 623 | { |
---|
[1525] | 624 | CoinPackedMatrix * matrix; |
---|
| 625 | matrix = model->model_->matrix(); |
---|
| 626 | return (matrix == NULL) ? NULL : matrix->getVectorStarts(); |
---|
[429] | 627 | } |
---|
| 628 | |
---|
[1525] | 629 | // Row indices in matrix |
---|
[429] | 630 | COINLIBAPI const int * COINLINKAGE Clp_getIndices(Clp_Simplex * model) |
---|
| 631 | { |
---|
[1525] | 632 | CoinPackedMatrix * matrix = model->model_->matrix(); |
---|
| 633 | return (matrix == NULL) ? NULL : matrix->getIndices(); |
---|
| 634 | } |
---|
[429] | 635 | |
---|
[1525] | 636 | // Column vector lengths in matrix |
---|
[429] | 637 | COINLIBAPI const int * COINLINKAGE Clp_getVectorLengths(Clp_Simplex * model) |
---|
| 638 | { |
---|
[1525] | 639 | CoinPackedMatrix * matrix = model->model_->matrix(); |
---|
| 640 | return (matrix == NULL) ? NULL : matrix->getVectorLengths(); |
---|
| 641 | } |
---|
| 642 | |
---|
| 643 | // Element values in matrix |
---|
[429] | 644 | COINLIBAPI const double * COINLINKAGE Clp_getElements(Clp_Simplex * model) |
---|
| 645 | { |
---|
[1525] | 646 | CoinPackedMatrix * matrix = model->model_->matrix(); |
---|
| 647 | return (matrix == NULL) ? NULL : matrix->getElements(); |
---|
[429] | 648 | } |
---|
[241] | 649 | /* Objective value */ |
---|
[1525] | 650 | COINLIBAPI double COINLINKAGE |
---|
[241] | 651 | Clp_objectiveValue(Clp_Simplex * model) |
---|
| 652 | { |
---|
[1525] | 653 | return model->model_->objectiveValue(); |
---|
[241] | 654 | } |
---|
| 655 | /* Integer information */ |
---|
[1525] | 656 | COINLIBAPI char * COINLINKAGE |
---|
[241] | 657 | Clp_integerInformation(Clp_Simplex * model) |
---|
| 658 | { |
---|
[1525] | 659 | return model->model_->integerInformation(); |
---|
[241] | 660 | } |
---|
| 661 | /* Infeasibility/unbounded ray (NULL returned if none/wrong) |
---|
[1901] | 662 | Up to user to use free() on these arrays. */ |
---|
[1525] | 663 | COINLIBAPI double * COINLINKAGE |
---|
[241] | 664 | Clp_infeasibilityRay(Clp_Simplex * model) |
---|
| 665 | { |
---|
[1901] | 666 | const double * ray = model->model_->internalRay(); |
---|
| 667 | double * array = NULL; |
---|
| 668 | int numberRows = model->model_->numberRows(); |
---|
| 669 | int status = model->model_->status(); |
---|
| 670 | if (status == 1 && ray) { |
---|
| 671 | array = static_cast<double*>(malloc(numberRows*sizeof(double))); |
---|
| 672 | memcpy(array,ray,numberRows*sizeof(double)); |
---|
[1926] | 673 | #ifdef PRINT_RAY_METHOD |
---|
| 674 | printf("Infeasibility ray obtained by algorithm %s\n",model->model_->algorithm()>0 ? |
---|
| 675 | "primal" : "dual"); |
---|
[1901] | 676 | #endif |
---|
| 677 | } |
---|
| 678 | return array; |
---|
[241] | 679 | } |
---|
[1525] | 680 | COINLIBAPI double * COINLINKAGE |
---|
[241] | 681 | Clp_unboundedRay(Clp_Simplex * model) |
---|
| 682 | { |
---|
[1901] | 683 | const double * ray = model->model_->internalRay(); |
---|
| 684 | double * array = NULL; |
---|
| 685 | int numberColumns = model->model_->numberColumns(); |
---|
| 686 | int status = model->model_->status(); |
---|
| 687 | if (status == 2 && ray) { |
---|
| 688 | array = static_cast<double*>(malloc(numberColumns*sizeof(double))); |
---|
| 689 | memcpy(array,ray,numberColumns*sizeof(double)); |
---|
| 690 | } |
---|
| 691 | return array; |
---|
[241] | 692 | } |
---|
[2019] | 693 | COINLIBAPI void COINLINKAGE |
---|
| 694 | Clp_freeRay(Clp_Simplex * model, double * ray) |
---|
| 695 | { |
---|
| 696 | free(ray); |
---|
| 697 | } |
---|
[241] | 698 | /* See if status array exists (partly for OsiClp) */ |
---|
[1525] | 699 | COINLIBAPI int COINLINKAGE |
---|
[241] | 700 | Clp_statusExists(Clp_Simplex * model) |
---|
| 701 | { |
---|
[1525] | 702 | return model->model_->statusExists() ? 1 : 0; |
---|
[241] | 703 | } |
---|
| 704 | /* Return address of status array (char[numberRows+numberColumns]) */ |
---|
[1525] | 705 | COINLIBAPI unsigned char * COINLINKAGE |
---|
[241] | 706 | Clp_statusArray(Clp_Simplex * model) |
---|
| 707 | { |
---|
[1525] | 708 | return model->model_->statusArray(); |
---|
[241] | 709 | } |
---|
| 710 | /* Copy in status vector */ |
---|
[1525] | 711 | COINLIBAPI void COINLINKAGE |
---|
[241] | 712 | Clp_copyinStatus(Clp_Simplex * model, const unsigned char * statusArray) |
---|
| 713 | { |
---|
[1525] | 714 | model->model_->copyinStatus(statusArray); |
---|
[241] | 715 | } |
---|
| 716 | |
---|
| 717 | /* User pointer for whatever reason */ |
---|
[1525] | 718 | COINLIBAPI void COINLINKAGE |
---|
[241] | 719 | Clp_setUserPointer (Clp_Simplex * model, void * pointer) |
---|
| 720 | { |
---|
[1525] | 721 | model->model_->setUserPointer(pointer); |
---|
[241] | 722 | } |
---|
[1525] | 723 | COINLIBAPI void * COINLINKAGE |
---|
[241] | 724 | Clp_getUserPointer (Clp_Simplex * model) |
---|
| 725 | { |
---|
[1525] | 726 | return model->model_->getUserPointer(); |
---|
[241] | 727 | } |
---|
| 728 | /* Pass in Callback function */ |
---|
[1525] | 729 | COINLIBAPI void COINLINKAGE |
---|
| 730 | Clp_registerCallBack(Clp_Simplex * model, |
---|
| 731 | clp_callback userCallBack) |
---|
[241] | 732 | { |
---|
[1525] | 733 | // Will be copy of users one |
---|
| 734 | delete model->handler_; |
---|
| 735 | model->handler_ = new CMessageHandler(*(model->model_->messageHandler())); |
---|
| 736 | model->handler_->setCallBack(userCallBack); |
---|
| 737 | model->handler_->setModel(model); |
---|
| 738 | model->model_->passInMessageHandler(model->handler_); |
---|
[241] | 739 | } |
---|
| 740 | /* Unset Callback function */ |
---|
[1525] | 741 | COINLIBAPI void COINLINKAGE |
---|
[241] | 742 | Clp_clearCallBack(Clp_Simplex * model) |
---|
| 743 | { |
---|
[1525] | 744 | delete model->handler_; |
---|
| 745 | model->handler_ = NULL; |
---|
[241] | 746 | } |
---|
| 747 | /* Amount of print out: |
---|
| 748 | 0 - none |
---|
| 749 | 1 - just final |
---|
| 750 | 2 - just factorizations |
---|
| 751 | 3 - as 2 plus a bit more |
---|
| 752 | 4 - verbose |
---|
| 753 | above that 8,16,32 etc just for selective debug |
---|
| 754 | */ |
---|
[1525] | 755 | COINLIBAPI void COINLINKAGE |
---|
[241] | 756 | Clp_setLogLevel(Clp_Simplex * model, int value) |
---|
| 757 | { |
---|
[1525] | 758 | model->model_->setLogLevel(value); |
---|
[241] | 759 | } |
---|
[1525] | 760 | COINLIBAPI int COINLINKAGE |
---|
[241] | 761 | Clp_logLevel(Clp_Simplex * model) |
---|
| 762 | { |
---|
[1525] | 763 | return model->model_->logLevel(); |
---|
[241] | 764 | } |
---|
| 765 | /* length of names (0 means no names0 */ |
---|
[1525] | 766 | COINLIBAPI int COINLINKAGE |
---|
[241] | 767 | Clp_lengthNames(Clp_Simplex * model) |
---|
| 768 | { |
---|
[1525] | 769 | return model->model_->lengthNames(); |
---|
[241] | 770 | } |
---|
| 771 | /* Fill in array (at least lengthNames+1 long) with a row name */ |
---|
[1525] | 772 | COINLIBAPI void COINLINKAGE |
---|
[241] | 773 | Clp_rowName(Clp_Simplex * model, int iRow, char * name) |
---|
| 774 | { |
---|
[1525] | 775 | std::string rowName = model->model_->rowName(iRow); |
---|
| 776 | strcpy(name, rowName.c_str()); |
---|
[241] | 777 | } |
---|
| 778 | /* Fill in array (at least lengthNames+1 long) with a column name */ |
---|
[1525] | 779 | COINLIBAPI void COINLINKAGE |
---|
[241] | 780 | Clp_columnName(Clp_Simplex * model, int iColumn, char * name) |
---|
| 781 | { |
---|
[1525] | 782 | std::string columnName = model->model_->columnName(iColumn); |
---|
| 783 | strcpy(name, columnName.c_str()); |
---|
[241] | 784 | } |
---|
| 785 | |
---|
| 786 | /* General solve algorithm which can do presolve. |
---|
| 787 | See ClpSolve.hpp for options |
---|
| 788 | */ |
---|
[1525] | 789 | COINLIBAPI int COINLINKAGE |
---|
[241] | 790 | Clp_initialSolve(Clp_Simplex * model) |
---|
| 791 | { |
---|
[1525] | 792 | return model->model_->initialSolve(); |
---|
[241] | 793 | } |
---|
[1902] | 794 | /* Pass solve options. (Exception to direct analogue rule) */ |
---|
| 795 | COINLIBAPI int COINLINKAGE |
---|
| 796 | Clp_initialSolveWithOptions(Clp_Simplex * model, Clp_Solve * s) |
---|
| 797 | { |
---|
| 798 | return model->model_->initialSolve(s->options); |
---|
| 799 | } |
---|
[891] | 800 | /* Barrier initial solve */ |
---|
[1525] | 801 | COINLIBAPI int COINLINKAGE |
---|
[891] | 802 | Clp_initialBarrierSolve(Clp_Simplex * model0) |
---|
| 803 | { |
---|
[1525] | 804 | ClpSimplex *model = model0->model_; |
---|
[891] | 805 | |
---|
[1525] | 806 | return model->initialBarrierSolve(); |
---|
| 807 | |
---|
[891] | 808 | } |
---|
| 809 | /* Barrier initial solve */ |
---|
[1525] | 810 | COINLIBAPI int COINLINKAGE |
---|
[891] | 811 | Clp_initialBarrierNoCrossSolve(Clp_Simplex * model0) |
---|
| 812 | { |
---|
[1525] | 813 | ClpSimplex *model = model0->model_; |
---|
[891] | 814 | |
---|
[1525] | 815 | return model->initialBarrierNoCrossSolve(); |
---|
| 816 | |
---|
[891] | 817 | } |
---|
[241] | 818 | /* Dual initial solve */ |
---|
[1525] | 819 | COINLIBAPI int COINLINKAGE |
---|
[241] | 820 | Clp_initialDualSolve(Clp_Simplex * model) |
---|
| 821 | { |
---|
[1525] | 822 | return model->model_->initialDualSolve(); |
---|
[241] | 823 | } |
---|
| 824 | /* Primal initial solve */ |
---|
[1525] | 825 | COINLIBAPI int COINLINKAGE |
---|
[241] | 826 | Clp_initialPrimalSolve(Clp_Simplex * model) |
---|
| 827 | { |
---|
[1525] | 828 | return model->model_->initialPrimalSolve(); |
---|
[241] | 829 | } |
---|
| 830 | /* Dual algorithm - see ClpSimplexDual.hpp for method */ |
---|
[1525] | 831 | COINLIBAPI int COINLINKAGE |
---|
[241] | 832 | Clp_dual(Clp_Simplex * model, int ifValuesPass) |
---|
| 833 | { |
---|
[1525] | 834 | return model->model_->dual(ifValuesPass); |
---|
[241] | 835 | } |
---|
| 836 | /* Primal algorithm - see ClpSimplexPrimal.hpp for method */ |
---|
[1525] | 837 | COINLIBAPI int COINLINKAGE |
---|
[241] | 838 | Clp_primal(Clp_Simplex * model, int ifValuesPass) |
---|
| 839 | { |
---|
[1525] | 840 | return model->model_->primal(ifValuesPass); |
---|
[241] | 841 | } |
---|
| 842 | /* Sets or unsets scaling, 0 -off, 1 equilibrium, 2 geometric, 3, auto, 4 dynamic(later) */ |
---|
[1525] | 843 | COINLIBAPI void COINLINKAGE |
---|
[241] | 844 | Clp_scaling(Clp_Simplex * model, int mode) |
---|
| 845 | { |
---|
[1525] | 846 | model->model_->scaling(mode); |
---|
[241] | 847 | } |
---|
| 848 | /* Gets scalingFlag */ |
---|
[1525] | 849 | COINLIBAPI int COINLINKAGE |
---|
[241] | 850 | Clp_scalingFlag(Clp_Simplex * model) |
---|
| 851 | { |
---|
[1525] | 852 | return model->model_->scalingFlag(); |
---|
[241] | 853 | } |
---|
| 854 | /* Crash - at present just aimed at dual, returns |
---|
| 855 | -2 if dual preferred and crash basis created |
---|
| 856 | -1 if dual preferred and all slack basis preferred |
---|
| 857 | 0 if basis going in was not all slack |
---|
| 858 | 1 if primal preferred and all slack basis preferred |
---|
| 859 | 2 if primal preferred and crash basis created. |
---|
[1525] | 860 | |
---|
[241] | 861 | if gap between bounds <="gap" variables can be flipped |
---|
[1525] | 862 | |
---|
[241] | 863 | If "pivot" is |
---|
| 864 | 0 No pivoting (so will just be choice of algorithm) |
---|
| 865 | 1 Simple pivoting e.g. gub |
---|
| 866 | 2 Mini iterations |
---|
| 867 | */ |
---|
[1525] | 868 | COINLIBAPI int COINLINKAGE |
---|
| 869 | Clp_crash(Clp_Simplex * model, double gap, int pivot) |
---|
[241] | 870 | { |
---|
[1525] | 871 | return model->model_->crash(gap, pivot); |
---|
[241] | 872 | } |
---|
| 873 | /* If problem is primal feasible */ |
---|
[1525] | 874 | COINLIBAPI int COINLINKAGE |
---|
[241] | 875 | Clp_primalFeasible(Clp_Simplex * model) |
---|
| 876 | { |
---|
[1525] | 877 | return model->model_->primalFeasible() ? 1 : 0; |
---|
[241] | 878 | } |
---|
| 879 | /* If problem is dual feasible */ |
---|
[1525] | 880 | COINLIBAPI int COINLINKAGE |
---|
[241] | 881 | Clp_dualFeasible(Clp_Simplex * model) |
---|
| 882 | { |
---|
[1525] | 883 | return model->model_->dualFeasible() ? 1 : 0; |
---|
[241] | 884 | } |
---|
| 885 | /* Dual bound */ |
---|
[1525] | 886 | COINLIBAPI double COINLINKAGE |
---|
[241] | 887 | Clp_dualBound(Clp_Simplex * model) |
---|
| 888 | { |
---|
[1525] | 889 | return model->model_->dualBound(); |
---|
[241] | 890 | } |
---|
[1525] | 891 | COINLIBAPI void COINLINKAGE |
---|
[241] | 892 | Clp_setDualBound(Clp_Simplex * model, double value) |
---|
| 893 | { |
---|
[1525] | 894 | model->model_->setDualBound(value); |
---|
[241] | 895 | } |
---|
| 896 | /* Infeasibility cost */ |
---|
[1525] | 897 | COINLIBAPI double COINLINKAGE |
---|
[241] | 898 | Clp_infeasibilityCost(Clp_Simplex * model) |
---|
| 899 | { |
---|
[1525] | 900 | return model->model_->infeasibilityCost(); |
---|
[241] | 901 | } |
---|
[1525] | 902 | COINLIBAPI void COINLINKAGE |
---|
[241] | 903 | Clp_setInfeasibilityCost(Clp_Simplex * model, double value) |
---|
| 904 | { |
---|
[1525] | 905 | model->model_->setInfeasibilityCost(value); |
---|
[241] | 906 | } |
---|
| 907 | /* Perturbation: |
---|
| 908 | 50 - switch on perturbation |
---|
| 909 | 100 - auto perturb if takes too long (1.0e-6 largest nonzero) |
---|
| 910 | 101 - we are perturbed |
---|
| 911 | 102 - don't try perturbing again |
---|
| 912 | default is 100 |
---|
| 913 | others are for playing |
---|
| 914 | */ |
---|
[1525] | 915 | COINLIBAPI int COINLINKAGE |
---|
[241] | 916 | Clp_perturbation(Clp_Simplex * model) |
---|
| 917 | { |
---|
[1525] | 918 | return model->model_->perturbation(); |
---|
[241] | 919 | } |
---|
[1525] | 920 | COINLIBAPI void COINLINKAGE |
---|
[241] | 921 | Clp_setPerturbation(Clp_Simplex * model, int value) |
---|
| 922 | { |
---|
[1525] | 923 | model->model_->setPerturbation(value); |
---|
[241] | 924 | } |
---|
| 925 | /* Current (or last) algorithm */ |
---|
[1525] | 926 | COINLIBAPI int COINLINKAGE |
---|
[241] | 927 | Clp_algorithm(Clp_Simplex * model) |
---|
| 928 | { |
---|
[1525] | 929 | return model->model_->algorithm(); |
---|
[241] | 930 | } |
---|
| 931 | /* Set algorithm */ |
---|
[1525] | 932 | COINLIBAPI void COINLINKAGE |
---|
[241] | 933 | Clp_setAlgorithm(Clp_Simplex * model, int value) |
---|
| 934 | { |
---|
[1525] | 935 | model->model_->setAlgorithm(value); |
---|
[241] | 936 | } |
---|
| 937 | /* Sum of dual infeasibilities */ |
---|
[1525] | 938 | COINLIBAPI double COINLINKAGE |
---|
[241] | 939 | Clp_sumDualInfeasibilities(Clp_Simplex * model) |
---|
| 940 | { |
---|
[1525] | 941 | return model->model_->sumDualInfeasibilities(); |
---|
[241] | 942 | } |
---|
| 943 | /* Number of dual infeasibilities */ |
---|
[1525] | 944 | COINLIBAPI int COINLINKAGE |
---|
[241] | 945 | Clp_numberDualInfeasibilities(Clp_Simplex * model) |
---|
| 946 | { |
---|
[1525] | 947 | return model->model_->numberDualInfeasibilities(); |
---|
[241] | 948 | } |
---|
| 949 | /* Sum of primal infeasibilities */ |
---|
[1525] | 950 | COINLIBAPI double COINLINKAGE |
---|
[241] | 951 | Clp_sumPrimalInfeasibilities(Clp_Simplex * model) |
---|
| 952 | { |
---|
[1525] | 953 | return model->model_->sumPrimalInfeasibilities(); |
---|
[241] | 954 | } |
---|
| 955 | /* Number of primal infeasibilities */ |
---|
[1525] | 956 | COINLIBAPI int COINLINKAGE |
---|
[241] | 957 | Clp_numberPrimalInfeasibilities(Clp_Simplex * model) |
---|
| 958 | { |
---|
[1525] | 959 | return model->model_->numberPrimalInfeasibilities(); |
---|
[241] | 960 | } |
---|
| 961 | /* Save model to file, returns 0 if success. This is designed for |
---|
| 962 | use outside algorithms so does not save iterating arrays etc. |
---|
[1525] | 963 | It does not save any messaging information. |
---|
[241] | 964 | Does not save scaling values. |
---|
| 965 | It does not know about all types of virtual functions. |
---|
| 966 | */ |
---|
[1525] | 967 | COINLIBAPI int COINLINKAGE |
---|
[241] | 968 | Clp_saveModel(Clp_Simplex * model, const char * fileName) |
---|
| 969 | { |
---|
[1525] | 970 | return model->model_->saveModel(fileName); |
---|
[241] | 971 | } |
---|
| 972 | /* Restore model from file, returns 0 if success, |
---|
| 973 | deletes current model */ |
---|
[1525] | 974 | COINLIBAPI int COINLINKAGE |
---|
[241] | 975 | Clp_restoreModel(Clp_Simplex * model, const char * fileName) |
---|
| 976 | { |
---|
[1525] | 977 | return model->model_->restoreModel(fileName); |
---|
[241] | 978 | } |
---|
[1525] | 979 | |
---|
[241] | 980 | /* Just check solution (for external use) - sets sum of |
---|
| 981 | infeasibilities etc */ |
---|
[1525] | 982 | COINLIBAPI void COINLINKAGE |
---|
[241] | 983 | Clp_checkSolution(Clp_Simplex * model) |
---|
| 984 | { |
---|
[1525] | 985 | model->model_->checkSolution(); |
---|
[241] | 986 | } |
---|
| 987 | /* Number of rows */ |
---|
[1525] | 988 | COINLIBAPI int COINLINKAGE |
---|
[241] | 989 | Clp_getNumRows(Clp_Simplex * model) |
---|
| 990 | { |
---|
[1525] | 991 | return model->model_->getNumRows(); |
---|
[241] | 992 | } |
---|
| 993 | /* Number of columns */ |
---|
[1525] | 994 | COINLIBAPI int COINLINKAGE |
---|
[241] | 995 | Clp_getNumCols(Clp_Simplex * model) |
---|
| 996 | { |
---|
[1525] | 997 | return model->model_->getNumCols(); |
---|
[241] | 998 | } |
---|
| 999 | /* Number of iterations */ |
---|
[1525] | 1000 | COINLIBAPI int COINLINKAGE |
---|
[241] | 1001 | Clp_getIterationCount(Clp_Simplex * model) |
---|
| 1002 | { |
---|
[1525] | 1003 | return model->model_->getIterationCount(); |
---|
[241] | 1004 | } |
---|
| 1005 | /* Are there a numerical difficulties? */ |
---|
[1525] | 1006 | COINLIBAPI int COINLINKAGE |
---|
[241] | 1007 | Clp_isAbandoned(Clp_Simplex * model) |
---|
| 1008 | { |
---|
[1525] | 1009 | return model->model_->isAbandoned() ? 1 : 0; |
---|
[241] | 1010 | } |
---|
| 1011 | /* Is optimality proven? */ |
---|
[1525] | 1012 | COINLIBAPI int COINLINKAGE |
---|
[241] | 1013 | Clp_isProvenOptimal(Clp_Simplex * model) |
---|
| 1014 | { |
---|
[1525] | 1015 | return model->model_->isProvenOptimal() ? 1 : 0; |
---|
[241] | 1016 | } |
---|
| 1017 | /* Is primal infeasiblity proven? */ |
---|
[1525] | 1018 | COINLIBAPI int COINLINKAGE |
---|
[241] | 1019 | Clp_isProvenPrimalInfeasible(Clp_Simplex * model) |
---|
| 1020 | { |
---|
[1525] | 1021 | return model->model_->isProvenPrimalInfeasible() ? 1 : 0; |
---|
[241] | 1022 | } |
---|
| 1023 | /* Is dual infeasiblity proven? */ |
---|
[1525] | 1024 | COINLIBAPI int COINLINKAGE |
---|
[241] | 1025 | Clp_isProvenDualInfeasible(Clp_Simplex * model) |
---|
| 1026 | { |
---|
[1525] | 1027 | return model->model_->isProvenDualInfeasible() ? 1 : 0; |
---|
[241] | 1028 | } |
---|
| 1029 | /* Is the given primal objective limit reached? */ |
---|
[1525] | 1030 | COINLIBAPI int COINLINKAGE |
---|
| 1031 | Clp_isPrimalObjectiveLimitReached(Clp_Simplex * model) |
---|
[241] | 1032 | { |
---|
[1525] | 1033 | return model->model_->isPrimalObjectiveLimitReached() ? 1 : 0; |
---|
[241] | 1034 | } |
---|
| 1035 | /* Is the given dual objective limit reached? */ |
---|
[1525] | 1036 | COINLIBAPI int COINLINKAGE |
---|
| 1037 | Clp_isDualObjectiveLimitReached(Clp_Simplex * model) |
---|
[241] | 1038 | { |
---|
[1525] | 1039 | return model->model_->isDualObjectiveLimitReached() ? 1 : 0; |
---|
[241] | 1040 | } |
---|
| 1041 | /* Iteration limit reached? */ |
---|
[1525] | 1042 | COINLIBAPI int COINLINKAGE |
---|
[241] | 1043 | Clp_isIterationLimitReached(Clp_Simplex * model) |
---|
| 1044 | { |
---|
[1525] | 1045 | return model->model_->isIterationLimitReached() ? 1 : 0; |
---|
[241] | 1046 | } |
---|
| 1047 | /* Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore */ |
---|
[1525] | 1048 | COINLIBAPI double COINLINKAGE |
---|
[241] | 1049 | Clp_getObjSense(Clp_Simplex * model) |
---|
| 1050 | { |
---|
[1525] | 1051 | return model->model_->getObjSense(); |
---|
[241] | 1052 | } |
---|
[1480] | 1053 | /* Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore */ |
---|
[1525] | 1054 | COINLIBAPI void COINLINKAGE |
---|
[1480] | 1055 | Clp_setObjSense(Clp_Simplex * model, double objsen) |
---|
| 1056 | { |
---|
[1525] | 1057 | model->model_->setOptimizationDirection(objsen); |
---|
[1480] | 1058 | } |
---|
[241] | 1059 | /* Primal row solution */ |
---|
[1525] | 1060 | COINLIBAPI const double * COINLINKAGE |
---|
[241] | 1061 | Clp_getRowActivity(Clp_Simplex * model) |
---|
| 1062 | { |
---|
[1525] | 1063 | return model->model_->getRowActivity(); |
---|
[241] | 1064 | } |
---|
| 1065 | /* Primal column solution */ |
---|
[1525] | 1066 | COINLIBAPI const double * COINLINKAGE |
---|
[241] | 1067 | Clp_getColSolution(Clp_Simplex * model) |
---|
| 1068 | { |
---|
[1525] | 1069 | return model->model_->getColSolution(); |
---|
[241] | 1070 | } |
---|
[1525] | 1071 | COINLIBAPI void COINLINKAGE |
---|
[241] | 1072 | Clp_setColSolution(Clp_Simplex * model, const double * input) |
---|
| 1073 | { |
---|
[1525] | 1074 | model->model_->setColSolution(input); |
---|
[241] | 1075 | } |
---|
| 1076 | /* Dual row solution */ |
---|
[1525] | 1077 | COINLIBAPI const double * COINLINKAGE |
---|
[241] | 1078 | Clp_getRowPrice(Clp_Simplex * model) |
---|
| 1079 | { |
---|
[1525] | 1080 | return model->model_->getRowPrice(); |
---|
[241] | 1081 | } |
---|
| 1082 | /* Reduced costs */ |
---|
[1525] | 1083 | COINLIBAPI const double * COINLINKAGE |
---|
[241] | 1084 | Clp_getReducedCost(Clp_Simplex * model) |
---|
| 1085 | { |
---|
[1525] | 1086 | return model->model_->getReducedCost(); |
---|
[241] | 1087 | } |
---|
| 1088 | /* Row lower */ |
---|
[1525] | 1089 | COINLIBAPI const double* COINLINKAGE |
---|
[241] | 1090 | Clp_getRowLower(Clp_Simplex * model) |
---|
| 1091 | { |
---|
[1525] | 1092 | return model->model_->getRowLower(); |
---|
[241] | 1093 | } |
---|
| 1094 | /* Row upper */ |
---|
[1525] | 1095 | COINLIBAPI const double* COINLINKAGE |
---|
[241] | 1096 | Clp_getRowUpper(Clp_Simplex * model) |
---|
| 1097 | { |
---|
[1525] | 1098 | return model->model_->getRowUpper(); |
---|
[241] | 1099 | } |
---|
| 1100 | /* Objective */ |
---|
[1525] | 1101 | COINLIBAPI const double * COINLINKAGE |
---|
[241] | 1102 | Clp_getObjCoefficients(Clp_Simplex * model) |
---|
| 1103 | { |
---|
[1525] | 1104 | return model->model_->getObjCoefficients(); |
---|
[241] | 1105 | } |
---|
| 1106 | /* Column Lower */ |
---|
[1525] | 1107 | COINLIBAPI const double * COINLINKAGE |
---|
[241] | 1108 | Clp_getColLower(Clp_Simplex * model) |
---|
| 1109 | { |
---|
[1525] | 1110 | return model->model_->getColLower(); |
---|
[241] | 1111 | } |
---|
| 1112 | /* Column Upper */ |
---|
[1525] | 1113 | COINLIBAPI const double * COINLINKAGE |
---|
[241] | 1114 | Clp_getColUpper(Clp_Simplex * model) |
---|
| 1115 | { |
---|
[1525] | 1116 | return model->model_->getColUpper(); |
---|
[241] | 1117 | } |
---|
| 1118 | /* Objective value */ |
---|
[1525] | 1119 | COINLIBAPI double COINLINKAGE |
---|
[241] | 1120 | Clp_getObjValue(Clp_Simplex * model) |
---|
| 1121 | { |
---|
[1525] | 1122 | return model->model_->getObjValue(); |
---|
[241] | 1123 | } |
---|
[406] | 1124 | /* Get variable basis info */ |
---|
[1088] | 1125 | COINLIBAPI int COINLINKAGE |
---|
[1525] | 1126 | Clp_getColumnStatus(Clp_Simplex * model, int sequence) |
---|
[406] | 1127 | { |
---|
[1525] | 1128 | return (int) model->model_->getColumnStatus(sequence); |
---|
[406] | 1129 | } |
---|
| 1130 | /* Get row basis info */ |
---|
[1088] | 1131 | COINLIBAPI int COINLINKAGE |
---|
[1525] | 1132 | Clp_getRowStatus(Clp_Simplex * model, int sequence) |
---|
[406] | 1133 | { |
---|
[1525] | 1134 | return (int) model->model_->getRowStatus(sequence); |
---|
[406] | 1135 | } |
---|
[633] | 1136 | /* Set variable basis info */ |
---|
| 1137 | COINLIBAPI void COINLINKAGE |
---|
[1525] | 1138 | Clp_setColumnStatus(Clp_Simplex * model, int sequence, int value) |
---|
[633] | 1139 | { |
---|
[1525] | 1140 | if (value >= 0 && value <= 5) { |
---|
| 1141 | model->model_->setColumnStatus(sequence, (ClpSimplex::Status) value ); |
---|
| 1142 | if (value == 3 || value == 5) |
---|
| 1143 | model->model_->primalColumnSolution()[sequence] = |
---|
| 1144 | model->model_->columnLower()[sequence]; |
---|
| 1145 | else if (value == 2) |
---|
| 1146 | model->model_->primalColumnSolution()[sequence] = |
---|
| 1147 | model->model_->columnUpper()[sequence]; |
---|
| 1148 | } |
---|
[633] | 1149 | } |
---|
| 1150 | /* Set row basis info */ |
---|
| 1151 | COINLIBAPI void COINLINKAGE |
---|
[1525] | 1152 | Clp_setRowStatus(Clp_Simplex * model, int sequence, int value) |
---|
[633] | 1153 | { |
---|
[1525] | 1154 | if (value >= 0 && value <= 5) { |
---|
| 1155 | model->model_->setRowStatus(sequence, (ClpSimplex::Status) value ); |
---|
| 1156 | if (value == 3 || value == 5) |
---|
| 1157 | model->model_->primalRowSolution()[sequence] = |
---|
| 1158 | model->model_->rowLower()[sequence]; |
---|
| 1159 | else if (value == 2) |
---|
| 1160 | model->model_->primalRowSolution()[sequence] = |
---|
| 1161 | model->model_->rowUpper()[sequence]; |
---|
| 1162 | } |
---|
[633] | 1163 | } |
---|
[406] | 1164 | /* Small element value - elements less than this set to zero, |
---|
| 1165 | default is 1.0e-20 */ |
---|
[1525] | 1166 | COINLIBAPI double COINLINKAGE |
---|
[406] | 1167 | Clp_getSmallElementValue(Clp_Simplex * model) |
---|
| 1168 | { |
---|
[1525] | 1169 | return model->model_->getSmallElementValue(); |
---|
[406] | 1170 | } |
---|
[1525] | 1171 | COINLIBAPI void COINLINKAGE |
---|
| 1172 | Clp_setSmallElementValue(Clp_Simplex * model, double value) |
---|
[406] | 1173 | { |
---|
[1525] | 1174 | model->model_->setSmallElementValue(value); |
---|
[406] | 1175 | } |
---|
[429] | 1176 | /* Print model */ |
---|
[1525] | 1177 | COINLIBAPI void COINLINKAGE |
---|
[429] | 1178 | Clp_printModel(Clp_Simplex * model, const char * prefix) |
---|
| 1179 | { |
---|
[1525] | 1180 | ClpSimplex *clp_simplex = model->model_; |
---|
| 1181 | int numrows = clp_simplex->numberRows(); |
---|
| 1182 | int numcols = clp_simplex->numberColumns(); |
---|
| 1183 | int numelem = clp_simplex->getNumElements(); |
---|
| 1184 | const CoinBigIndex *start = clp_simplex->matrix()->getVectorStarts(); |
---|
| 1185 | const int *index = clp_simplex->matrix()->getIndices(); |
---|
| 1186 | const double *value = clp_simplex->matrix()->getElements(); |
---|
| 1187 | const double *collb = model->model_->columnLower(); |
---|
| 1188 | const double *colub = model->model_->columnUpper(); |
---|
| 1189 | const double *obj = model->model_->objective(); |
---|
| 1190 | const double *rowlb = model->model_->rowLower(); |
---|
| 1191 | const double *rowub = model->model_->rowUpper(); |
---|
| 1192 | printf("%s numcols = %i, numrows = %i, numelem = %i\n", |
---|
| 1193 | prefix, numcols, numrows, numelem); |
---|
| 1194 | printf("%s model = %p, start = %p, index = %p, value = %p\n", |
---|
| 1195 | prefix, reinterpret_cast<const void *>(model), reinterpret_cast<const void *>(start), reinterpret_cast<const void *>(index), reinterpret_cast<const void *>(value)); |
---|
| 1196 | clp_simplex->matrix()->dumpMatrix(NULL); |
---|
| 1197 | { |
---|
| 1198 | int i; |
---|
| 1199 | for (i = 0; i <= numcols; i++) |
---|
| 1200 | printf("%s start[%i] = %i\n", prefix, i, start[i]); |
---|
| 1201 | for (i = 0; i < numelem; i++) |
---|
| 1202 | printf("%s index[%i] = %i, value[%i] = %g\n", |
---|
| 1203 | prefix, i, index[i], i, value[i]); |
---|
| 1204 | } |
---|
| 1205 | |
---|
| 1206 | printf("%s collb = %p, colub = %p, obj = %p, rowlb = %p, rowub = %p\n", |
---|
| 1207 | prefix, reinterpret_cast<const void *>(collb), reinterpret_cast<const void *>(colub), reinterpret_cast<const void *>(obj), reinterpret_cast<const void *>(rowlb), reinterpret_cast<const void *>(rowub)); |
---|
| 1208 | printf("%s optimization direction = %g\n", prefix, Clp_optimizationDirection(model)); |
---|
| 1209 | printf(" (1 - minimize, -1 - maximize, 0 - ignore)\n"); |
---|
| 1210 | { |
---|
| 1211 | int i; |
---|
| 1212 | for (i = 0; i < numcols; i++) |
---|
| 1213 | printf("%s collb[%i] = %g, colub[%i] = %g, obj[%i] = %g\n", |
---|
| 1214 | prefix, i, collb[i], i, colub[i], i, obj[i]); |
---|
| 1215 | for (i = 0; i < numrows; i++) |
---|
| 1216 | printf("%s rowlb[%i] = %g, rowub[%i] = %g\n", |
---|
| 1217 | prefix, i, rowlb[i], i, rowub[i]); |
---|
| 1218 | } |
---|
[429] | 1219 | } |
---|
[1480] | 1220 | |
---|
| 1221 | #ifndef SLIM_CLP |
---|
| 1222 | /** Solve the problem with the idiot code */ |
---|
| 1223 | /* tryhard values: |
---|
| 1224 | tryhard & 7: |
---|
| 1225 | 0: NOT lightweight, 105 iterations within a pass (when mu stays fixed) |
---|
| 1226 | 1: lightweight, but focus more on optimality (mu is high) |
---|
| 1227 | (23 iters in a pass) |
---|
| 1228 | 2: lightweight, but focus more on feasibility (11 iters in a pass) |
---|
| 1229 | 3: lightweight, but focus more on feasibility (23 iters in a pass, so it |
---|
| 1230 | goes closer to opt than option 2) |
---|
| 1231 | tryhard >> 3: |
---|
| 1232 | number of passes, the larger the number the closer it gets to optimality |
---|
| 1233 | */ |
---|
| 1234 | COINLIBAPI void COINLINKAGE |
---|
| 1235 | Clp_idiot(Clp_Simplex * model, int tryhard) |
---|
| 1236 | { |
---|
[1525] | 1237 | ClpSimplex *clp = model->model_; |
---|
| 1238 | Idiot info(*clp); |
---|
| 1239 | int numberpass = tryhard >> 3; |
---|
| 1240 | int lightweight = tryhard & 7; |
---|
| 1241 | info.setLightweight(lightweight); |
---|
| 1242 | info.crash(numberpass, clp->messageHandler(), clp->messagesPointer(), false); |
---|
[1480] | 1243 | } |
---|
| 1244 | #endif |
---|
| 1245 | |
---|
[1902] | 1246 | COINLIBAPI Clp_Solve * COINLINKAGE |
---|
| 1247 | ClpSolve_new() |
---|
| 1248 | { |
---|
| 1249 | return new Clp_Solve(); |
---|
| 1250 | } |
---|
| 1251 | |
---|
| 1252 | COINLIBAPI void COINLINKAGE |
---|
| 1253 | ClpSolve_delete(Clp_Solve * solve) |
---|
| 1254 | { |
---|
| 1255 | delete solve; |
---|
| 1256 | } |
---|
| 1257 | |
---|
| 1258 | // space- and error-saving macros |
---|
| 1259 | #define ClpSolveGetIntProperty(prop) \ |
---|
| 1260 | COINLIBAPI int COINLINKAGE \ |
---|
| 1261 | ClpSolve_ ## prop (Clp_Solve *s) \ |
---|
| 1262 | { \ |
---|
| 1263 | return s->options.prop(); \ |
---|
| 1264 | } |
---|
| 1265 | |
---|
| 1266 | #define ClpSolveSetIntProperty(prop) \ |
---|
| 1267 | COINLIBAPI void COINLINKAGE \ |
---|
| 1268 | ClpSolve_ ## prop (Clp_Solve *s, int val) \ |
---|
| 1269 | { \ |
---|
| 1270 | s->options.prop(val); \ |
---|
| 1271 | } |
---|
| 1272 | |
---|
| 1273 | COINLIBAPI void COINLINKAGE |
---|
| 1274 | ClpSolve_setSpecialOption(Clp_Solve * s, int which, int value, int extraInfo) |
---|
| 1275 | { |
---|
| 1276 | s->options.setSpecialOption(which,value,extraInfo); |
---|
| 1277 | } |
---|
| 1278 | |
---|
| 1279 | COINLIBAPI int COINLINKAGE |
---|
| 1280 | ClpSolve_getSpecialOption(Clp_Solve * s, int which) |
---|
| 1281 | { |
---|
| 1282 | return s->options.getSpecialOption(which); |
---|
| 1283 | } |
---|
| 1284 | |
---|
| 1285 | COINLIBAPI void COINLINKAGE |
---|
| 1286 | ClpSolve_setSolveType(Clp_Solve * s, int method, int extraInfo) |
---|
| 1287 | { |
---|
| 1288 | s->options.setSolveType(static_cast<ClpSolve::SolveType>(method), extraInfo); |
---|
| 1289 | } |
---|
| 1290 | |
---|
| 1291 | ClpSolveGetIntProperty(getSolveType) |
---|
| 1292 | |
---|
| 1293 | COINLIBAPI void COINLINKAGE ClpSolve_setPresolveType(Clp_Solve * s, int amount, int extraInfo) |
---|
| 1294 | { |
---|
| 1295 | s->options.setPresolveType(static_cast<ClpSolve::PresolveType>(amount),extraInfo); |
---|
| 1296 | } |
---|
| 1297 | |
---|
| 1298 | ClpSolveGetIntProperty(getPresolveType) |
---|
| 1299 | |
---|
| 1300 | ClpSolveGetIntProperty(getPresolvePasses) |
---|
| 1301 | |
---|
| 1302 | |
---|
| 1303 | COINLIBAPI int COINLINKAGE |
---|
| 1304 | ClpSolve_getExtraInfo(Clp_Solve * s, int which) { |
---|
| 1305 | return s->options.getExtraInfo(which); |
---|
| 1306 | } |
---|
| 1307 | |
---|
| 1308 | ClpSolveSetIntProperty(setInfeasibleReturn) |
---|
| 1309 | ClpSolveGetIntProperty(infeasibleReturn) |
---|
| 1310 | |
---|
| 1311 | ClpSolveGetIntProperty(doDual) |
---|
| 1312 | ClpSolveSetIntProperty(setDoDual) |
---|
| 1313 | |
---|
| 1314 | ClpSolveGetIntProperty(doSingleton) |
---|
| 1315 | ClpSolveSetIntProperty(setDoSingleton) |
---|
| 1316 | |
---|
| 1317 | ClpSolveGetIntProperty(doDoubleton) |
---|
| 1318 | ClpSolveSetIntProperty(setDoDoubleton) |
---|
| 1319 | |
---|
| 1320 | ClpSolveGetIntProperty(doTripleton) |
---|
| 1321 | ClpSolveSetIntProperty(setDoTripleton) |
---|
| 1322 | |
---|
| 1323 | ClpSolveGetIntProperty(doTighten) |
---|
| 1324 | ClpSolveSetIntProperty(setDoTighten) |
---|
| 1325 | |
---|
| 1326 | ClpSolveGetIntProperty(doForcing) |
---|
| 1327 | ClpSolveSetIntProperty(setDoForcing) |
---|
| 1328 | |
---|
| 1329 | ClpSolveGetIntProperty(doImpliedFree) |
---|
| 1330 | ClpSolveSetIntProperty(setDoImpliedFree) |
---|
| 1331 | |
---|
| 1332 | ClpSolveGetIntProperty(doDupcol) |
---|
| 1333 | ClpSolveSetIntProperty(setDoDupcol) |
---|
| 1334 | |
---|
| 1335 | ClpSolveGetIntProperty(doDuprow) |
---|
| 1336 | ClpSolveSetIntProperty(setDoDuprow) |
---|
| 1337 | |
---|
| 1338 | ClpSolveGetIntProperty(doSingletonColumn) |
---|
| 1339 | ClpSolveSetIntProperty(setDoSingletonColumn) |
---|
| 1340 | |
---|
| 1341 | ClpSolveGetIntProperty(presolveActions) |
---|
| 1342 | ClpSolveSetIntProperty(setPresolveActions) |
---|
| 1343 | |
---|
| 1344 | ClpSolveGetIntProperty(substitution) |
---|
| 1345 | ClpSolveSetIntProperty(setSubstitution) |
---|
| 1346 | |
---|
[1525] | 1347 | #if defined(__MWERKS__) |
---|
[431] | 1348 | #pragma export off |
---|
| 1349 | #endif |
---|
[241] | 1350 | |
---|