1 | // Copyright (C) 2000, International Business Machines |
---|
2 | // Corporation and others. All Rights Reserved. |
---|
3 | |
---|
4 | #ifndef OsiClpSolverInterface_H |
---|
5 | #define OsiClpSolverInterface_H |
---|
6 | |
---|
7 | #include <string> |
---|
8 | #include <cfloat> |
---|
9 | #include <map> |
---|
10 | |
---|
11 | #include "ClpSimplex.hpp" |
---|
12 | #include "ClpLinearObjective.hpp" |
---|
13 | #include "CoinPackedMatrix.hpp" |
---|
14 | #include "OsiSolverInterface.hpp" |
---|
15 | #include "CoinWarmStartBasis.hpp" |
---|
16 | #include "ClpEventHandler.hpp" |
---|
17 | #include "ClpNode.hpp" |
---|
18 | #include "CoinIndexedVector.hpp" |
---|
19 | |
---|
20 | class OsiRowCut; |
---|
21 | class OsiClpUserSolver; |
---|
22 | class OsiClpDisasterHandler; |
---|
23 | class CoinSet; |
---|
24 | #ifndef COIN_DBL_MAX |
---|
25 | static const double OsiClpInfinity = DBL_MAX; |
---|
26 | #else |
---|
27 | static const double OsiClpInfinity = COIN_DBL_MAX; |
---|
28 | #endif |
---|
29 | |
---|
30 | //############################################################################# |
---|
31 | |
---|
32 | /** Clp Solver Interface |
---|
33 | |
---|
34 | Instantiation of OsiClpSolverInterface for the Model Algorithm. |
---|
35 | |
---|
36 | */ |
---|
37 | |
---|
38 | class OsiClpSolverInterface : |
---|
39 | virtual public OsiSolverInterface { |
---|
40 | friend int OsiClpSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); |
---|
41 | |
---|
42 | public: |
---|
43 | //--------------------------------------------------------------------------- |
---|
44 | /**@name Solve methods */ |
---|
45 | //@{ |
---|
46 | /// Solve initial LP relaxation |
---|
47 | virtual void initialSolve(); |
---|
48 | |
---|
49 | /// Resolve an LP relaxation after problem modification |
---|
50 | virtual void resolve(); |
---|
51 | |
---|
52 | /// Invoke solver's built-in enumeration algorithm |
---|
53 | virtual void branchAndBound(); |
---|
54 | |
---|
55 | /** Solve when primal column and dual row solutions are near-optimal |
---|
56 | options - 0 no presolve (use primal and dual) |
---|
57 | 1 presolve (just use primal) |
---|
58 | 2 no presolve (just use primal) |
---|
59 | basis - 0 use all slack basis |
---|
60 | 1 try and put some in basis |
---|
61 | */ |
---|
62 | void crossover(int options,int basis); |
---|
63 | //@} |
---|
64 | |
---|
65 | /*! @name OsiSimplexInterface methods |
---|
66 | \brief Methods for the Osi Simplex API. |
---|
67 | |
---|
68 | The current implementation should work for both minimisation and |
---|
69 | maximisation in mode 1 (tableau access). In mode 2 (single pivot), only |
---|
70 | minimisation is supported as of 100907. |
---|
71 | */ |
---|
72 | //@{ |
---|
73 | /** \brief Simplex API capability. |
---|
74 | |
---|
75 | Returns |
---|
76 | - 0 if no simplex API |
---|
77 | - 1 if can just do getBInv etc |
---|
78 | - 2 if has all OsiSimplex methods |
---|
79 | */ |
---|
80 | virtual int canDoSimplexInterface() const; |
---|
81 | |
---|
82 | /*! \brief Enables simplex mode 1 (tableau access) |
---|
83 | |
---|
84 | Tells solver that calls to getBInv etc are about to take place. |
---|
85 | Underlying code may need mutable as this may be called from |
---|
86 | CglCut::generateCuts which is const. If that is too horrific then |
---|
87 | each solver e.g. BCP or CBC will have to do something outside |
---|
88 | main loop. |
---|
89 | */ |
---|
90 | virtual void enableFactorization() const; |
---|
91 | |
---|
92 | /*! \brief Undo any setting changes made by #enableFactorization */ |
---|
93 | virtual void disableFactorization() const; |
---|
94 | |
---|
95 | /** Returns true if a basis is available |
---|
96 | AND problem is optimal. This should be used to see if |
---|
97 | the BInvARow type operations are possible and meaningful. |
---|
98 | */ |
---|
99 | virtual bool basisIsAvailable() const; |
---|
100 | |
---|
101 | /** The following two methods may be replaced by the |
---|
102 | methods of OsiSolverInterface using OsiWarmStartBasis if: |
---|
103 | 1. OsiWarmStartBasis resize operation is implemented |
---|
104 | more efficiently and |
---|
105 | 2. It is ensured that effects on the solver are the same |
---|
106 | |
---|
107 | Returns a basis status of the structural/artificial variables |
---|
108 | At present as warm start i.e 0 free, 1 basic, 2 upper, 3 lower |
---|
109 | |
---|
110 | NOTE artificials are treated as +1 elements so for <= rhs |
---|
111 | artificial will be at lower bound if constraint is tight |
---|
112 | |
---|
113 | This means that Clpsimplex flips artificials as it works |
---|
114 | in terms of row activities |
---|
115 | */ |
---|
116 | virtual void getBasisStatus(int* cstat, int* rstat) const; |
---|
117 | |
---|
118 | /** Set the status of structural/artificial variables and |
---|
119 | factorize, update solution etc |
---|
120 | |
---|
121 | NOTE artificials are treated as +1 elements so for <= rhs |
---|
122 | artificial will be at lower bound if constraint is tight |
---|
123 | |
---|
124 | This means that Clpsimplex flips artificials as it works |
---|
125 | in terms of row activities |
---|
126 | Returns 0 if OK, 1 if problem is bad e.g. duplicate elements, too large ... |
---|
127 | */ |
---|
128 | virtual int setBasisStatus(const int* cstat, const int* rstat); |
---|
129 | |
---|
130 | ///Get the reduced gradient for the cost vector c |
---|
131 | virtual void getReducedGradient(double* columnReducedCosts, |
---|
132 | double * duals, |
---|
133 | const double * c) const ; |
---|
134 | |
---|
135 | ///Get a row of the tableau (slack part in slack if not NULL) |
---|
136 | virtual void getBInvARow(int row, double* z, double * slack=NULL) const; |
---|
137 | |
---|
138 | /** Get a row of the tableau (slack part in slack if not NULL) |
---|
139 | If keepScaled is true then scale factors not applied after so |
---|
140 | user has to use coding similar to what is in this method |
---|
141 | */ |
---|
142 | virtual void getBInvARow(int row, CoinIndexedVector * z, CoinIndexedVector * slack=NULL, |
---|
143 | bool keepScaled=false) const; |
---|
144 | |
---|
145 | ///Get a row of the basis inverse |
---|
146 | virtual void getBInvRow(int row, double* z) const; |
---|
147 | |
---|
148 | ///Get a column of the tableau |
---|
149 | virtual void getBInvACol(int col, double* vec) const ; |
---|
150 | |
---|
151 | ///Get a column of the tableau |
---|
152 | virtual void getBInvACol(int col, CoinIndexedVector * vec) const ; |
---|
153 | |
---|
154 | /** Update (i.e. ftran) the vector passed in. |
---|
155 | Unscaling is applied after - can't be applied before |
---|
156 | */ |
---|
157 | |
---|
158 | virtual void getBInvACol(CoinIndexedVector * vec) const ; |
---|
159 | |
---|
160 | ///Get a column of the basis inverse |
---|
161 | virtual void getBInvCol(int col, double* vec) const ; |
---|
162 | |
---|
163 | /** Get basic indices (order of indices corresponds to the |
---|
164 | order of elements in a vector retured by getBInvACol() and |
---|
165 | getBInvCol()). |
---|
166 | */ |
---|
167 | virtual void getBasics(int* index) const; |
---|
168 | |
---|
169 | /*! \brief Enables simplex mode 2 (individual pivot control) |
---|
170 | |
---|
171 | This method is supposed to ensure that all typical things (like |
---|
172 | reduced costs, etc.) are updated when individual pivots are executed |
---|
173 | and can be queried by other methods. |
---|
174 | */ |
---|
175 | virtual void enableSimplexInterface(bool doingPrimal); |
---|
176 | |
---|
177 | /*! \brief Undo setting changes made by #enableSimplexInterface */ |
---|
178 | virtual void disableSimplexInterface(); |
---|
179 | |
---|
180 | /** Perform a pivot by substituting a colIn for colOut in the basis. |
---|
181 | The status of the leaving variable is given in statOut. Where |
---|
182 | 1 is to upper bound, -1 to lower bound |
---|
183 | Return code is 0 for okay, |
---|
184 | 1 if inaccuracy forced re-factorization (should be okay) and |
---|
185 | -1 for singular factorization |
---|
186 | */ |
---|
187 | virtual int pivot(int colIn, int colOut, int outStatus); |
---|
188 | |
---|
189 | /** Obtain a result of the primal pivot |
---|
190 | Outputs: colOut -- leaving column, outStatus -- its status, |
---|
191 | t -- step size, and, if dx!=NULL, *dx -- primal ray direction. |
---|
192 | Inputs: colIn -- entering column, sign -- direction of its change (+/-1). |
---|
193 | Both for colIn and colOut, artificial variables are index by |
---|
194 | the negative of the row index minus 1. |
---|
195 | Return code (for now): 0 -- leaving variable found, |
---|
196 | -1 -- everything else? |
---|
197 | Clearly, more informative set of return values is required |
---|
198 | Primal and dual solutions are updated |
---|
199 | */ |
---|
200 | virtual int primalPivotResult(int colIn, int sign, |
---|
201 | int& colOut, int& outStatus, |
---|
202 | double& t, CoinPackedVector* dx); |
---|
203 | |
---|
204 | /** Obtain a result of the dual pivot (similar to the previous method) |
---|
205 | Differences: entering variable and a sign of its change are now |
---|
206 | the outputs, the leaving variable and its statuts -- the inputs |
---|
207 | If dx!=NULL, then *dx contains dual ray |
---|
208 | Return code: same |
---|
209 | */ |
---|
210 | virtual int dualPivotResult(int& colIn, int& sign, |
---|
211 | int colOut, int outStatus, |
---|
212 | double& t, CoinPackedVector* dx); |
---|
213 | |
---|
214 | |
---|
215 | //@} |
---|
216 | //--------------------------------------------------------------------------- |
---|
217 | /**@name Parameter set/get methods |
---|
218 | |
---|
219 | The set methods return true if the parameter was set to the given value, |
---|
220 | false otherwise. There can be various reasons for failure: the given |
---|
221 | parameter is not applicable for the solver (e.g., refactorization |
---|
222 | frequency for the clp algorithm), the parameter is not yet implemented |
---|
223 | for the solver or simply the value of the parameter is out of the range |
---|
224 | the solver accepts. If a parameter setting call returns false check the |
---|
225 | details of your solver. |
---|
226 | |
---|
227 | The get methods return true if the given parameter is applicable for the |
---|
228 | solver and is implemented. In this case the value of the parameter is |
---|
229 | returned in the second argument. Otherwise they return false. |
---|
230 | */ |
---|
231 | //@{ |
---|
232 | // Set an integer parameter |
---|
233 | bool setIntParam(OsiIntParam key, int value); |
---|
234 | // Set an double parameter |
---|
235 | bool setDblParam(OsiDblParam key, double value); |
---|
236 | // Set a string parameter |
---|
237 | bool setStrParam(OsiStrParam key, const std::string & value); |
---|
238 | // Get an integer parameter |
---|
239 | bool getIntParam(OsiIntParam key, int& value) const; |
---|
240 | // Get an double parameter |
---|
241 | bool getDblParam(OsiDblParam key, double& value) const; |
---|
242 | // Get a string parameter |
---|
243 | bool getStrParam(OsiStrParam key, std::string& value) const; |
---|
244 | // Set a hint parameter - overrides OsiSolverInterface |
---|
245 | virtual bool setHintParam(OsiHintParam key, bool yesNo=true, |
---|
246 | OsiHintStrength strength=OsiHintTry, |
---|
247 | void * otherInformation=NULL); |
---|
248 | //@} |
---|
249 | |
---|
250 | //--------------------------------------------------------------------------- |
---|
251 | ///@name Methods returning info on how the solution process terminated |
---|
252 | //@{ |
---|
253 | /// Are there a numerical difficulties? |
---|
254 | virtual bool isAbandoned() const; |
---|
255 | /// Is optimality proven? |
---|
256 | virtual bool isProvenOptimal() const; |
---|
257 | /// Is primal infeasiblity proven? |
---|
258 | virtual bool isProvenPrimalInfeasible() const; |
---|
259 | /// Is dual infeasiblity proven? |
---|
260 | virtual bool isProvenDualInfeasible() const; |
---|
261 | /// Is the given primal objective limit reached? |
---|
262 | virtual bool isPrimalObjectiveLimitReached() const; |
---|
263 | /// Is the given dual objective limit reached? |
---|
264 | virtual bool isDualObjectiveLimitReached() const; |
---|
265 | /// Iteration limit reached? |
---|
266 | virtual bool isIterationLimitReached() const; |
---|
267 | //@} |
---|
268 | |
---|
269 | //--------------------------------------------------------------------------- |
---|
270 | /**@name WarmStart related methods */ |
---|
271 | //@{ |
---|
272 | |
---|
273 | /*! \brief Get an empty warm start object |
---|
274 | |
---|
275 | This routine returns an empty CoinWarmStartBasis object. Its purpose is |
---|
276 | to provide a way to give a client a warm start basis object of the |
---|
277 | appropriate type, which can resized and modified as desired. |
---|
278 | */ |
---|
279 | |
---|
280 | virtual CoinWarmStart *getEmptyWarmStart () const; |
---|
281 | |
---|
282 | /// Get warmstarting information |
---|
283 | virtual CoinWarmStart* getWarmStart() const; |
---|
284 | /// Get warmstarting information |
---|
285 | inline CoinWarmStartBasis* getPointerToWarmStart() |
---|
286 | { return &basis_;} |
---|
287 | /// Get warmstarting information |
---|
288 | inline const CoinWarmStartBasis* getConstPointerToWarmStart() const |
---|
289 | { return &basis_;} |
---|
290 | /** Set warmstarting information. Return true/false depending on whether |
---|
291 | the warmstart information was accepted or not. */ |
---|
292 | virtual bool setWarmStart(const CoinWarmStart* warmstart); |
---|
293 | /** \brief Get warm start information. |
---|
294 | |
---|
295 | Return warm start information for the current state of the solver |
---|
296 | interface. If there is no valid warm start information, an empty warm |
---|
297 | start object wil be returned. This does not necessarily create an |
---|
298 | object - may just point to one. must Delete set true if user |
---|
299 | should delete returned object. |
---|
300 | OsiClp version always returns pointer and false. |
---|
301 | */ |
---|
302 | virtual CoinWarmStart* getPointerToWarmStart(bool & mustDelete) ; |
---|
303 | |
---|
304 | //@} |
---|
305 | |
---|
306 | //--------------------------------------------------------------------------- |
---|
307 | /**@name Hotstart related methods (primarily used in strong branching). |
---|
308 | The user can create a hotstart (a snapshot) of the optimization process |
---|
309 | then reoptimize over and over again always starting from there.<br> |
---|
310 | <strong>NOTE</strong>: between hotstarted optimizations only |
---|
311 | bound changes are allowed. */ |
---|
312 | //@{ |
---|
313 | /// Create a hotstart point of the optimization process |
---|
314 | virtual void markHotStart(); |
---|
315 | /// Optimize starting from the hotstart |
---|
316 | virtual void solveFromHotStart(); |
---|
317 | /// Delete the snapshot |
---|
318 | virtual void unmarkHotStart(); |
---|
319 | /** Start faster dual - returns negative if problems 1 if infeasible, |
---|
320 | Options to pass to solver |
---|
321 | 1 - create external reduced costs for columns |
---|
322 | 2 - create external reduced costs for rows |
---|
323 | 4 - create external row activity (columns always done) |
---|
324 | Above only done if feasible |
---|
325 | When set resolve does less work |
---|
326 | */ |
---|
327 | int startFastDual(int options); |
---|
328 | /// Stop fast dual |
---|
329 | void stopFastDual(); |
---|
330 | /// Sets integer tolerance and increment |
---|
331 | void setStuff(double tolerance,double increment); |
---|
332 | //@} |
---|
333 | |
---|
334 | //--------------------------------------------------------------------------- |
---|
335 | /**@name Problem information methods |
---|
336 | |
---|
337 | These methods call the solver's query routines to return |
---|
338 | information about the problem referred to by the current object. |
---|
339 | Querying a problem that has no data associated with it result in |
---|
340 | zeros for the number of rows and columns, and NULL pointers from |
---|
341 | the methods that return vectors. |
---|
342 | |
---|
343 | Const pointers returned from any data-query method are valid as |
---|
344 | long as the data is unchanged and the solver is not called. |
---|
345 | */ |
---|
346 | //@{ |
---|
347 | /**@name Methods related to querying the input data */ |
---|
348 | //@{ |
---|
349 | /// Get number of columns |
---|
350 | virtual int getNumCols() const { |
---|
351 | return modelPtr_->numberColumns(); } |
---|
352 | |
---|
353 | /// Get number of rows |
---|
354 | virtual int getNumRows() const { |
---|
355 | return modelPtr_->numberRows(); } |
---|
356 | |
---|
357 | /// Get number of nonzero elements |
---|
358 | virtual int getNumElements() const { |
---|
359 | int retVal = 0; |
---|
360 | const CoinPackedMatrix * matrix =modelPtr_->matrix(); |
---|
361 | if ( matrix != NULL ) retVal=matrix->getNumElements(); |
---|
362 | return retVal; } |
---|
363 | |
---|
364 | /// Return name of row if one exists or Rnnnnnnn |
---|
365 | /// maxLen is currently ignored and only there to match the signature from the base class! |
---|
366 | virtual std::string getRowName(int rowIndex, |
---|
367 | unsigned maxLen = std::string::npos) const; |
---|
368 | |
---|
369 | /// Return name of column if one exists or Cnnnnnnn |
---|
370 | /// maxLen is currently ignored and only there to match the signature from the base class! |
---|
371 | virtual std::string getColName(int colIndex, |
---|
372 | unsigned maxLen = std::string::npos) const; |
---|
373 | |
---|
374 | |
---|
375 | /// Get pointer to array[getNumCols()] of column lower bounds |
---|
376 | virtual const double * getColLower() const { return modelPtr_->columnLower(); } |
---|
377 | |
---|
378 | /// Get pointer to array[getNumCols()] of column upper bounds |
---|
379 | virtual const double * getColUpper() const { return modelPtr_->columnUpper(); } |
---|
380 | |
---|
381 | /** Get pointer to array[getNumRows()] of row constraint senses. |
---|
382 | <ul> |
---|
383 | <li>'L' <= constraint |
---|
384 | <li>'E' = constraint |
---|
385 | <li>'G' >= constraint |
---|
386 | <li>'R' ranged constraint |
---|
387 | <li>'N' free constraint |
---|
388 | </ul> |
---|
389 | */ |
---|
390 | virtual const char * getRowSense() const; |
---|
391 | |
---|
392 | /** Get pointer to array[getNumRows()] of rows right-hand sides |
---|
393 | <ul> |
---|
394 | <li> if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i] |
---|
395 | <li> if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i] |
---|
396 | <li> if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i] |
---|
397 | <li> if rowsense()[i] == 'N' then rhs()[i] == 0.0 |
---|
398 | </ul> |
---|
399 | */ |
---|
400 | virtual const double * getRightHandSide() const ; |
---|
401 | |
---|
402 | /** Get pointer to array[getNumRows()] of row ranges. |
---|
403 | <ul> |
---|
404 | <li> if rowsense()[i] == 'R' then |
---|
405 | rowrange()[i] == rowupper()[i] - rowlower()[i] |
---|
406 | <li> if rowsense()[i] != 'R' then |
---|
407 | rowrange()[i] is undefined |
---|
408 | </ul> |
---|
409 | */ |
---|
410 | virtual const double * getRowRange() const ; |
---|
411 | |
---|
412 | /// Get pointer to array[getNumRows()] of row lower bounds |
---|
413 | virtual const double * getRowLower() const { return modelPtr_->rowLower(); } |
---|
414 | |
---|
415 | /// Get pointer to array[getNumRows()] of row upper bounds |
---|
416 | virtual const double * getRowUpper() const { return modelPtr_->rowUpper(); } |
---|
417 | |
---|
418 | /// Get pointer to array[getNumCols()] of objective function coefficients |
---|
419 | virtual const double * getObjCoefficients() const |
---|
420 | { if (fakeMinInSimplex_) |
---|
421 | return linearObjective_ ; |
---|
422 | else |
---|
423 | return modelPtr_->objective(); } |
---|
424 | |
---|
425 | /// Get objective function sense (1 for min (default), -1 for max) |
---|
426 | virtual double getObjSense() const |
---|
427 | { return ((fakeMinInSimplex_)?-modelPtr_->optimizationDirection(): |
---|
428 | modelPtr_->optimizationDirection()); } |
---|
429 | |
---|
430 | /// Return true if column is continuous |
---|
431 | virtual bool isContinuous(int colNumber) const; |
---|
432 | /// Return true if variable is binary |
---|
433 | virtual bool isBinary(int colIndex) const; |
---|
434 | |
---|
435 | /** Return true if column is integer. |
---|
436 | Note: This function returns true if the the column |
---|
437 | is binary or a general integer. |
---|
438 | */ |
---|
439 | virtual bool isInteger(int colIndex) const; |
---|
440 | |
---|
441 | /// Return true if variable is general integer |
---|
442 | virtual bool isIntegerNonBinary(int colIndex) const; |
---|
443 | |
---|
444 | /// Return true if variable is binary and not fixed at either bound |
---|
445 | virtual bool isFreeBinary(int colIndex) const; |
---|
446 | /** Return array of column length |
---|
447 | 0 - continuous |
---|
448 | 1 - binary (may get fixed later) |
---|
449 | 2 - general integer (may get fixed later) |
---|
450 | */ |
---|
451 | virtual const char * getColType(bool refresh=false) const; |
---|
452 | |
---|
453 | /** Return true if column is integer but does not have to |
---|
454 | be declared as such. |
---|
455 | Note: This function returns true if the the column |
---|
456 | is binary or a general integer. |
---|
457 | */ |
---|
458 | bool isOptionalInteger(int colIndex) const; |
---|
459 | /** Set the index-th variable to be an optional integer variable */ |
---|
460 | void setOptionalInteger(int index); |
---|
461 | |
---|
462 | /// Get pointer to row-wise copy of matrix |
---|
463 | virtual const CoinPackedMatrix * getMatrixByRow() const; |
---|
464 | |
---|
465 | /// Get pointer to column-wise copy of matrix |
---|
466 | virtual const CoinPackedMatrix * getMatrixByCol() const; |
---|
467 | |
---|
468 | /// Get pointer to mutable column-wise copy of matrix |
---|
469 | virtual CoinPackedMatrix * getMutableMatrixByCol() const; |
---|
470 | |
---|
471 | /// Get solver's value for infinity |
---|
472 | virtual double getInfinity() const { return OsiClpInfinity; } |
---|
473 | //@} |
---|
474 | |
---|
475 | /**@name Methods related to querying the solution */ |
---|
476 | //@{ |
---|
477 | /// Get pointer to array[getNumCols()] of primal solution vector |
---|
478 | virtual const double * getColSolution() const; |
---|
479 | |
---|
480 | /// Get pointer to array[getNumRows()] of dual prices |
---|
481 | virtual const double * getRowPrice() const; |
---|
482 | |
---|
483 | /// Get a pointer to array[getNumCols()] of reduced costs |
---|
484 | virtual const double * getReducedCost() const; |
---|
485 | |
---|
486 | /** Get pointer to array[getNumRows()] of row activity levels (constraint |
---|
487 | matrix times the solution vector */ |
---|
488 | virtual const double * getRowActivity() const; |
---|
489 | |
---|
490 | /// Get objective function value |
---|
491 | virtual double getObjValue() const; |
---|
492 | |
---|
493 | /** Get how many iterations it took to solve the problem (whatever |
---|
494 | "iteration" mean to the solver. */ |
---|
495 | virtual int getIterationCount() const |
---|
496 | { return modelPtr_->numberIterations(); } |
---|
497 | |
---|
498 | /** Get as many dual rays as the solver can provide. (In case of proven |
---|
499 | primal infeasibility there should be at least one.) |
---|
500 | |
---|
501 | The first getNumRows() ray components will always be associated with |
---|
502 | the row duals (as returned by getRowPrice()). If \c fullRay is true, |
---|
503 | the final getNumCols() entries will correspond to the ray components |
---|
504 | associated with the nonbasic variables. If the full ray is requested |
---|
505 | and the method cannot provide it, it will throw an exception. |
---|
506 | |
---|
507 | <strong>NOTE for implementers of solver interfaces:</strong> <br> |
---|
508 | The double pointers in the vector should point to arrays of length |
---|
509 | getNumRows() and they should be allocated via new[]. <br> |
---|
510 | |
---|
511 | <strong>NOTE for users of solver interfaces:</strong> <br> |
---|
512 | It is the user's responsibility to free the double pointers in the |
---|
513 | vector using delete[]. |
---|
514 | */ |
---|
515 | virtual std::vector<double*> getDualRays(int maxNumRays, |
---|
516 | bool fullRay = false) const; |
---|
517 | /** Get as many primal rays as the solver can provide. (In case of proven |
---|
518 | dual infeasibility there should be at least one.) |
---|
519 | |
---|
520 | <strong>NOTE for implementers of solver interfaces:</strong> <br> |
---|
521 | The double pointers in the vector should point to arrays of length |
---|
522 | getNumCols() and they should be allocated via new[]. <br> |
---|
523 | |
---|
524 | <strong>NOTE for users of solver interfaces:</strong> <br> |
---|
525 | It is the user's responsibility to free the double pointers in the |
---|
526 | vector using delete[]. |
---|
527 | */ |
---|
528 | virtual std::vector<double*> getPrimalRays(int maxNumRays) const; |
---|
529 | |
---|
530 | //@} |
---|
531 | //@} |
---|
532 | |
---|
533 | //--------------------------------------------------------------------------- |
---|
534 | |
---|
535 | /**@name Problem modifying methods */ |
---|
536 | //@{ |
---|
537 | //------------------------------------------------------------------------- |
---|
538 | /**@name Changing bounds on variables and constraints */ |
---|
539 | //@{ |
---|
540 | /** Set an objective function coefficient */ |
---|
541 | virtual void setObjCoeff( int elementIndex, double elementValue ); |
---|
542 | |
---|
543 | /** Set a single column lower bound<br> |
---|
544 | Use -DBL_MAX for -infinity. */ |
---|
545 | virtual void setColLower( int elementIndex, double elementValue ); |
---|
546 | |
---|
547 | /** Set a single column upper bound<br> |
---|
548 | Use DBL_MAX for infinity. */ |
---|
549 | virtual void setColUpper( int elementIndex, double elementValue ); |
---|
550 | |
---|
551 | /** Set a single column lower and upper bound */ |
---|
552 | virtual void setColBounds( int elementIndex, |
---|
553 | double lower, double upper ); |
---|
554 | |
---|
555 | /** Set the bounds on a number of columns simultaneously<br> |
---|
556 | The default implementation just invokes setColLower() and |
---|
557 | setColUpper() over and over again. |
---|
558 | @param indexFirst,indexLast pointers to the beginning and after the |
---|
559 | end of the array of the indices of the variables whose |
---|
560 | <em>either</em> bound changes |
---|
561 | @param boundList the new lower/upper bound pairs for the variables |
---|
562 | */ |
---|
563 | virtual void setColSetBounds(const int* indexFirst, |
---|
564 | const int* indexLast, |
---|
565 | const double* boundList); |
---|
566 | |
---|
567 | /** Set a single row lower bound<br> |
---|
568 | Use -DBL_MAX for -infinity. */ |
---|
569 | virtual void setRowLower( int elementIndex, double elementValue ); |
---|
570 | |
---|
571 | /** Set a single row upper bound<br> |
---|
572 | Use DBL_MAX for infinity. */ |
---|
573 | virtual void setRowUpper( int elementIndex, double elementValue ) ; |
---|
574 | |
---|
575 | /** Set a single row lower and upper bound */ |
---|
576 | virtual void setRowBounds( int elementIndex, |
---|
577 | double lower, double upper ) ; |
---|
578 | |
---|
579 | /** Set the type of a single row<br> */ |
---|
580 | virtual void setRowType(int index, char sense, double rightHandSide, |
---|
581 | double range); |
---|
582 | |
---|
583 | /** Set the bounds on a number of rows simultaneously<br> |
---|
584 | The default implementation just invokes setRowLower() and |
---|
585 | setRowUpper() over and over again. |
---|
586 | @param indexFirst,indexLast pointers to the beginning and after the |
---|
587 | end of the array of the indices of the constraints whose |
---|
588 | <em>either</em> bound changes |
---|
589 | @param boundList the new lower/upper bound pairs for the constraints |
---|
590 | */ |
---|
591 | virtual void setRowSetBounds(const int* indexFirst, |
---|
592 | const int* indexLast, |
---|
593 | const double* boundList); |
---|
594 | |
---|
595 | /** Set the type of a number of rows simultaneously<br> |
---|
596 | The default implementation just invokes setRowType() |
---|
597 | over and over again. |
---|
598 | @param indexFirst,indexLast pointers to the beginning and after the |
---|
599 | end of the array of the indices of the constraints whose |
---|
600 | <em>any</em> characteristics changes |
---|
601 | @param senseList the new senses |
---|
602 | @param rhsList the new right hand sides |
---|
603 | @param rangeList the new ranges |
---|
604 | */ |
---|
605 | virtual void setRowSetTypes(const int* indexFirst, |
---|
606 | const int* indexLast, |
---|
607 | const char* senseList, |
---|
608 | const double* rhsList, |
---|
609 | const double* rangeList); |
---|
610 | /** Set the objective coefficients for all columns |
---|
611 | array [getNumCols()] is an array of values for the objective. |
---|
612 | This defaults to a series of set operations and is here for speed. |
---|
613 | */ |
---|
614 | virtual void setObjective(const double * array); |
---|
615 | |
---|
616 | /** Set the lower bounds for all columns |
---|
617 | array [getNumCols()] is an array of values for the objective. |
---|
618 | This defaults to a series of set operations and is here for speed. |
---|
619 | */ |
---|
620 | virtual void setColLower(const double * array); |
---|
621 | |
---|
622 | /** Set the upper bounds for all columns |
---|
623 | array [getNumCols()] is an array of values for the objective. |
---|
624 | This defaults to a series of set operations and is here for speed. |
---|
625 | */ |
---|
626 | virtual void setColUpper(const double * array); |
---|
627 | |
---|
628 | // using OsiSolverInterface::setRowName ; |
---|
629 | /// Set name of row |
---|
630 | // virtual void setRowName(int rowIndex, std::string & name) ; |
---|
631 | virtual void setRowName(int rowIndex, std::string name) ; |
---|
632 | |
---|
633 | // using OsiSolverInterface::setColName ; |
---|
634 | /// Set name of column |
---|
635 | // virtual void setColName(int colIndex, std::string & name) ; |
---|
636 | virtual void setColName(int colIndex, std::string name) ; |
---|
637 | |
---|
638 | //@} |
---|
639 | |
---|
640 | //------------------------------------------------------------------------- |
---|
641 | /**@name Integrality related changing methods */ |
---|
642 | //@{ |
---|
643 | /** Set the index-th variable to be a continuous variable */ |
---|
644 | virtual void setContinuous(int index); |
---|
645 | /** Set the index-th variable to be an integer variable */ |
---|
646 | virtual void setInteger(int index); |
---|
647 | /** Set the variables listed in indices (which is of length len) to be |
---|
648 | continuous variables */ |
---|
649 | virtual void setContinuous(const int* indices, int len); |
---|
650 | /** Set the variables listed in indices (which is of length len) to be |
---|
651 | integer variables */ |
---|
652 | virtual void setInteger(const int* indices, int len); |
---|
653 | /// Number of SOS sets |
---|
654 | inline int numberSOS() const |
---|
655 | { return numberSOS_;} |
---|
656 | /// SOS set info |
---|
657 | inline const CoinSet * setInfo() const |
---|
658 | { return setInfo_;} |
---|
659 | /** \brief Identify integer variables and SOS and create corresponding objects. |
---|
660 | |
---|
661 | Record integer variables and create an OsiSimpleInteger object for each |
---|
662 | one. All existing OsiSimpleInteger objects will be destroyed. |
---|
663 | If the solver supports SOS then do the same for SOS. |
---|
664 | If justCount then no objects created and we just store numberIntegers_ |
---|
665 | Returns number of SOS |
---|
666 | */ |
---|
667 | |
---|
668 | virtual int findIntegersAndSOS(bool justCount); |
---|
669 | //@} |
---|
670 | |
---|
671 | //------------------------------------------------------------------------- |
---|
672 | /// Set objective function sense (1 for min (default), -1 for max,) |
---|
673 | virtual void setObjSense(double s ) |
---|
674 | { modelPtr_->setOptimizationDirection( s < 0 ? -1 : 1); } |
---|
675 | |
---|
676 | /** Set the primal solution column values |
---|
677 | |
---|
678 | colsol[numcols()] is an array of values of the problem column |
---|
679 | variables. These values are copied to memory owned by the |
---|
680 | solver object or the solver. They will be returned as the |
---|
681 | result of colsol() until changed by another call to |
---|
682 | setColsol() or by a call to any solver routine. Whether the |
---|
683 | solver makes use of the solution in any way is |
---|
684 | solver-dependent. |
---|
685 | */ |
---|
686 | virtual void setColSolution(const double * colsol); |
---|
687 | |
---|
688 | /** Set dual solution vector |
---|
689 | |
---|
690 | rowprice[numrows()] is an array of values of the problem row |
---|
691 | dual variables. These values are copied to memory owned by the |
---|
692 | solver object or the solver. They will be returned as the |
---|
693 | result of rowprice() until changed by another call to |
---|
694 | setRowprice() or by a call to any solver routine. Whether the |
---|
695 | solver makes use of the solution in any way is |
---|
696 | solver-dependent. |
---|
697 | */ |
---|
698 | virtual void setRowPrice(const double * rowprice); |
---|
699 | |
---|
700 | //------------------------------------------------------------------------- |
---|
701 | /**@name Methods to expand a problem.<br> |
---|
702 | Note that if a column is added then by default it will correspond to a |
---|
703 | continuous variable. */ |
---|
704 | //@{ |
---|
705 | |
---|
706 | //using OsiSolverInterface::addCol ; |
---|
707 | /** */ |
---|
708 | virtual void addCol(const CoinPackedVectorBase& vec, |
---|
709 | const double collb, const double colub, |
---|
710 | const double obj); |
---|
711 | /*! \brief Add a named column (primal variable) to the problem. |
---|
712 | */ |
---|
713 | virtual void addCol(const CoinPackedVectorBase& vec, |
---|
714 | const double collb, const double colub, |
---|
715 | const double obj, std::string name) ; |
---|
716 | /** Add a column (primal variable) to the problem. */ |
---|
717 | virtual void addCol(int numberElements, const int * rows, const double * elements, |
---|
718 | const double collb, const double colub, |
---|
719 | const double obj) ; |
---|
720 | /*! \brief Add a named column (primal variable) to the problem. |
---|
721 | */ |
---|
722 | virtual void addCol(int numberElements, |
---|
723 | const int* rows, const double* elements, |
---|
724 | const double collb, const double colub, |
---|
725 | const double obj, std::string name) ; |
---|
726 | /** */ |
---|
727 | virtual void addCols(const int numcols, |
---|
728 | const CoinPackedVectorBase * const * cols, |
---|
729 | const double* collb, const double* colub, |
---|
730 | const double* obj); |
---|
731 | /** */ |
---|
732 | virtual void addCols(const int numcols, |
---|
733 | const int * columnStarts, const int * rows, const double * elements, |
---|
734 | const double* collb, const double* colub, |
---|
735 | const double* obj); |
---|
736 | /** */ |
---|
737 | virtual void deleteCols(const int num, const int * colIndices); |
---|
738 | |
---|
739 | /** */ |
---|
740 | virtual void addRow(const CoinPackedVectorBase& vec, |
---|
741 | const double rowlb, const double rowub); |
---|
742 | /** */ |
---|
743 | /*! \brief Add a named row (constraint) to the problem. |
---|
744 | |
---|
745 | The default implementation adds the row, then changes the name. This |
---|
746 | can surely be made more efficient within an OsiXXX class. |
---|
747 | */ |
---|
748 | virtual void addRow(const CoinPackedVectorBase& vec, |
---|
749 | const double rowlb, const double rowub, |
---|
750 | std::string name) ; |
---|
751 | virtual void addRow(const CoinPackedVectorBase& vec, |
---|
752 | const char rowsen, const double rowrhs, |
---|
753 | const double rowrng); |
---|
754 | /** Add a row (constraint) to the problem. */ |
---|
755 | virtual void addRow(int numberElements, const int * columns, const double * element, |
---|
756 | const double rowlb, const double rowub) ; |
---|
757 | /*! \brief Add a named row (constraint) to the problem. |
---|
758 | */ |
---|
759 | virtual void addRow(const CoinPackedVectorBase& vec, |
---|
760 | const char rowsen, const double rowrhs, |
---|
761 | const double rowrng, std::string name) ; |
---|
762 | /** */ |
---|
763 | virtual void addRows(const int numrows, |
---|
764 | const CoinPackedVectorBase * const * rows, |
---|
765 | const double* rowlb, const double* rowub); |
---|
766 | /** */ |
---|
767 | virtual void addRows(const int numrows, |
---|
768 | const CoinPackedVectorBase * const * rows, |
---|
769 | const char* rowsen, const double* rowrhs, |
---|
770 | const double* rowrng); |
---|
771 | |
---|
772 | /** */ |
---|
773 | virtual void addRows(const int numrows, |
---|
774 | const int * rowStarts, const int * columns, const double * element, |
---|
775 | const double* rowlb, const double* rowub); |
---|
776 | /// |
---|
777 | void modifyCoefficient(int row, int column, double newElement, |
---|
778 | bool keepZero=false) |
---|
779 | {modelPtr_->modifyCoefficient(row,column,newElement, keepZero);} |
---|
780 | |
---|
781 | /** */ |
---|
782 | virtual void deleteRows(const int num, const int * rowIndices); |
---|
783 | /** If solver wants it can save a copy of "base" (continuous) model here |
---|
784 | */ |
---|
785 | virtual void saveBaseModel() ; |
---|
786 | /** Strip off rows to get to this number of rows. |
---|
787 | If solver wants it can restore a copy of "base" (continuous) model here |
---|
788 | */ |
---|
789 | virtual void restoreBaseModel(int numberRows); |
---|
790 | |
---|
791 | //----------------------------------------------------------------------- |
---|
792 | /** Apply a collection of row cuts which are all effective. |
---|
793 | applyCuts seems to do one at a time which seems inefficient. |
---|
794 | */ |
---|
795 | virtual void applyRowCuts(int numberCuts, const OsiRowCut * cuts); |
---|
796 | /** Apply a collection of row cuts which are all effective. |
---|
797 | applyCuts seems to do one at a time which seems inefficient. |
---|
798 | This uses array of pointers |
---|
799 | */ |
---|
800 | virtual void applyRowCuts(int numberCuts, const OsiRowCut ** cuts); |
---|
801 | /** Apply a collection of cuts. |
---|
802 | |
---|
803 | Only cuts which have an <code>effectiveness >= effectivenessLb</code> |
---|
804 | are applied. |
---|
805 | <ul> |
---|
806 | <li> ReturnCode.getNumineffective() -- number of cuts which were |
---|
807 | not applied because they had an |
---|
808 | <code>effectiveness < effectivenessLb</code> |
---|
809 | <li> ReturnCode.getNuminconsistent() -- number of invalid cuts |
---|
810 | <li> ReturnCode.getNuminconsistentWrtIntegerModel() -- number of |
---|
811 | cuts that are invalid with respect to this integer model |
---|
812 | <li> ReturnCode.getNuminfeasible() -- number of cuts that would |
---|
813 | make this integer model infeasible |
---|
814 | <li> ReturnCode.getNumApplied() -- number of integer cuts which |
---|
815 | were applied to the integer model |
---|
816 | <li> cs.size() == getNumineffective() + |
---|
817 | getNuminconsistent() + |
---|
818 | getNuminconsistentWrtIntegerModel() + |
---|
819 | getNuminfeasible() + |
---|
820 | getNumApplied() |
---|
821 | </ul> |
---|
822 | */ |
---|
823 | virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs, |
---|
824 | double effectivenessLb = 0.0); |
---|
825 | |
---|
826 | //@} |
---|
827 | //@} |
---|
828 | |
---|
829 | //--------------------------------------------------------------------------- |
---|
830 | |
---|
831 | public: |
---|
832 | |
---|
833 | /**@name Methods to input a problem */ |
---|
834 | //@{ |
---|
835 | /** Load in an problem by copying the arguments (the constraints on the |
---|
836 | rows are given by lower and upper bounds). If a pointer is NULL then the |
---|
837 | following values are the default: |
---|
838 | <ul> |
---|
839 | <li> <code>colub</code>: all columns have upper bound infinity |
---|
840 | <li> <code>collb</code>: all columns have lower bound 0 |
---|
841 | <li> <code>rowub</code>: all rows have upper bound infinity |
---|
842 | <li> <code>rowlb</code>: all rows have lower bound -infinity |
---|
843 | <li> <code>obj</code>: all variables have 0 objective coefficient |
---|
844 | </ul> |
---|
845 | */ |
---|
846 | virtual void loadProblem(const CoinPackedMatrix& matrix, |
---|
847 | const double* collb, const double* colub, |
---|
848 | const double* obj, |
---|
849 | const double* rowlb, const double* rowub); |
---|
850 | |
---|
851 | /** Load in an problem by assuming ownership of the arguments (the |
---|
852 | constraints on the rows are given by lower and upper bounds). For |
---|
853 | default values see the previous method. <br> |
---|
854 | <strong>WARNING</strong>: The arguments passed to this method will be |
---|
855 | freed using the C++ <code>delete</code> and <code>delete[]</code> |
---|
856 | functions. |
---|
857 | */ |
---|
858 | virtual void assignProblem(CoinPackedMatrix*& matrix, |
---|
859 | double*& collb, double*& colub, double*& obj, |
---|
860 | double*& rowlb, double*& rowub); |
---|
861 | |
---|
862 | /** Load in an problem by copying the arguments (the constraints on the |
---|
863 | rows are given by sense/rhs/range triplets). If a pointer is NULL then the |
---|
864 | following values are the default: |
---|
865 | <ul> |
---|
866 | <li> <code>colub</code>: all columns have upper bound infinity |
---|
867 | <li> <code>collb</code>: all columns have lower bound 0 |
---|
868 | <li> <code>obj</code>: all variables have 0 objective coefficient |
---|
869 | <li> <code>rowsen</code>: all rows are >= |
---|
870 | <li> <code>rowrhs</code>: all right hand sides are 0 |
---|
871 | <li> <code>rowrng</code>: 0 for the ranged rows |
---|
872 | </ul> |
---|
873 | */ |
---|
874 | virtual void loadProblem(const CoinPackedMatrix& matrix, |
---|
875 | const double* collb, const double* colub, |
---|
876 | const double* obj, |
---|
877 | const char* rowsen, const double* rowrhs, |
---|
878 | const double* rowrng); |
---|
879 | |
---|
880 | /** Load in an problem by assuming ownership of the arguments (the |
---|
881 | constraints on the rows are given by sense/rhs/range triplets). For |
---|
882 | default values see the previous method. <br> |
---|
883 | <strong>WARNING</strong>: The arguments passed to this method will be |
---|
884 | freed using the C++ <code>delete</code> and <code>delete[]</code> |
---|
885 | functions. |
---|
886 | */ |
---|
887 | virtual void assignProblem(CoinPackedMatrix*& matrix, |
---|
888 | double*& collb, double*& colub, double*& obj, |
---|
889 | char*& rowsen, double*& rowrhs, |
---|
890 | double*& rowrng); |
---|
891 | |
---|
892 | /** Just like the other loadProblem() methods except that the matrix is |
---|
893 | given in a standard column major ordered format (without gaps). */ |
---|
894 | virtual void loadProblem(const int numcols, const int numrows, |
---|
895 | const CoinBigIndex * start, const int* index, |
---|
896 | const double* value, |
---|
897 | const double* collb, const double* colub, |
---|
898 | const double* obj, |
---|
899 | const double* rowlb, const double* rowub); |
---|
900 | |
---|
901 | /** Just like the other loadProblem() methods except that the matrix is |
---|
902 | given in a standard column major ordered format (without gaps). */ |
---|
903 | virtual void loadProblem(const int numcols, const int numrows, |
---|
904 | const CoinBigIndex * start, const int* index, |
---|
905 | const double* value, |
---|
906 | const double* collb, const double* colub, |
---|
907 | const double* obj, |
---|
908 | const char* rowsen, const double* rowrhs, |
---|
909 | const double* rowrng); |
---|
910 | /// This loads a model from a coinModel object - returns number of errors |
---|
911 | virtual int loadFromCoinModel ( CoinModel & modelObject, bool keepSolution=false); |
---|
912 | |
---|
913 | using OsiSolverInterface::readMps ; |
---|
914 | /** Read an mps file from the given filename (defaults to Osi reader) - returns |
---|
915 | number of errors (see OsiMpsReader class) */ |
---|
916 | virtual int readMps(const char *filename, |
---|
917 | const char *extension = "mps") ; |
---|
918 | /** Read an mps file from the given filename returns |
---|
919 | number of errors (see OsiMpsReader class) */ |
---|
920 | int readMps(const char *filename,bool keepNames,bool allowErrors); |
---|
921 | /// Read an mps file |
---|
922 | virtual int readMps (const char *filename, const char*extension, |
---|
923 | int & numberSets, CoinSet ** & sets); |
---|
924 | |
---|
925 | /** Write the problem into an mps file of the given filename. |
---|
926 | If objSense is non zero then -1.0 forces the code to write a |
---|
927 | maximization objective and +1.0 to write a minimization one. |
---|
928 | If 0.0 then solver can do what it wants */ |
---|
929 | virtual void writeMps(const char *filename, |
---|
930 | const char *extension = "mps", |
---|
931 | double objSense=0.0) const; |
---|
932 | /** Write the problem into an mps file of the given filename, |
---|
933 | names may be null. formatType is |
---|
934 | 0 - normal |
---|
935 | 1 - extra accuracy |
---|
936 | 2 - IEEE hex (later) |
---|
937 | |
---|
938 | Returns non-zero on I/O error |
---|
939 | */ |
---|
940 | virtual int writeMpsNative(const char *filename, |
---|
941 | const char ** rowNames, const char ** columnNames, |
---|
942 | int formatType=0,int numberAcross=2, |
---|
943 | double objSense=0.0) const ; |
---|
944 | /// Read file in LP format (with names) |
---|
945 | virtual int readLp(const char *filename, const double epsilon = 1e-5); |
---|
946 | /** Write the problem into an Lp file of the given filename. |
---|
947 | If objSense is non zero then -1.0 forces the code to write a |
---|
948 | maximization objective and +1.0 to write a minimization one. |
---|
949 | If 0.0 then solver can do what it wants. |
---|
950 | This version calls writeLpNative with names */ |
---|
951 | virtual void writeLp(const char *filename, |
---|
952 | const char *extension = "lp", |
---|
953 | double epsilon = 1e-5, |
---|
954 | int numberAcross = 10, |
---|
955 | int decimals = 5, |
---|
956 | double objSense = 0.0, |
---|
957 | bool useRowNames = true) const; |
---|
958 | /** Write the problem into the file pointed to by the parameter fp. |
---|
959 | Other parameters are similar to |
---|
960 | those of writeLp() with first parameter filename. |
---|
961 | */ |
---|
962 | virtual void writeLp(FILE *fp, |
---|
963 | double epsilon = 1e-5, |
---|
964 | int numberAcross = 10, |
---|
965 | int decimals = 5, |
---|
966 | double objSense = 0.0, |
---|
967 | bool useRowNames = true) const; |
---|
968 | /** |
---|
969 | I (JJF) am getting annoyed because I can't just replace a matrix. |
---|
970 | The default behavior of this is do nothing so only use where that would not matter |
---|
971 | e.g. strengthening a matrix for MIP |
---|
972 | */ |
---|
973 | virtual void replaceMatrixOptional(const CoinPackedMatrix & matrix); |
---|
974 | /// And if it does matter (not used at present) |
---|
975 | virtual void replaceMatrix(const CoinPackedMatrix & matrix) ; |
---|
976 | //@} |
---|
977 | |
---|
978 | /**@name Message handling (extra for Clp messages). |
---|
979 | Normally I presume you would want the same language. |
---|
980 | If not then you could use underlying model pointer */ |
---|
981 | //@{ |
---|
982 | /** Pass in a message handler |
---|
983 | |
---|
984 | It is the client's responsibility to destroy a message handler installed |
---|
985 | by this routine; it will not be destroyed when the solver interface is |
---|
986 | destroyed. |
---|
987 | */ |
---|
988 | virtual void passInMessageHandler(CoinMessageHandler * handler); |
---|
989 | /// Set language |
---|
990 | void newLanguage(CoinMessages::Language language); |
---|
991 | void setLanguage(CoinMessages::Language language) |
---|
992 | {newLanguage(language);} |
---|
993 | /// Set log level (will also set underlying solver's log level) |
---|
994 | void setLogLevel(int value); |
---|
995 | /// Create C++ lines to get to current state |
---|
996 | void generateCpp( FILE * fp); |
---|
997 | //@} |
---|
998 | //--------------------------------------------------------------------------- |
---|
999 | |
---|
1000 | /**@name Clp specific public interfaces */ |
---|
1001 | //@{ |
---|
1002 | /// Get pointer to Clp model |
---|
1003 | ClpSimplex * getModelPtr() const ; |
---|
1004 | /// Set pointer to Clp model and return old |
---|
1005 | inline ClpSimplex * swapModelPtr(ClpSimplex * newModel) |
---|
1006 | { ClpSimplex * model = modelPtr_; modelPtr_=newModel;return model;} |
---|
1007 | /// Get special options |
---|
1008 | inline unsigned int specialOptions() const |
---|
1009 | { return specialOptions_;} |
---|
1010 | void setSpecialOptions(unsigned int value); |
---|
1011 | /// Last algorithm used , 1 = primal, 2 = dual |
---|
1012 | inline int lastAlgorithm() const |
---|
1013 | { return lastAlgorithm_;} |
---|
1014 | /// Get scaling action option |
---|
1015 | inline int cleanupScaling() const |
---|
1016 | { return cleanupScaling_;} |
---|
1017 | /** Set Scaling option |
---|
1018 | When scaling is on it is possible that the scaled problem |
---|
1019 | is feasible but the unscaled is not. Clp returns a secondary |
---|
1020 | status code to that effect. This option allows for a cleanup. |
---|
1021 | If you use it I would suggest 1. |
---|
1022 | This only affects actions when scaled optimal |
---|
1023 | 0 - no action |
---|
1024 | 1 - clean up using dual if primal infeasibility |
---|
1025 | 2 - clean up using dual if dual infeasibility |
---|
1026 | 3 - clean up using dual if primal or dual infeasibility |
---|
1027 | 11,12,13 - as 1,2,3 but use primal |
---|
1028 | */ |
---|
1029 | inline void setCleanupScaling(int value) |
---|
1030 | { cleanupScaling_=value;} |
---|
1031 | /** Get smallest allowed element in cut. |
---|
1032 | If smaller than this then ignored */ |
---|
1033 | inline double smallestElementInCut() const |
---|
1034 | { return smallestElementInCut_;} |
---|
1035 | /** Set smallest allowed element in cut. |
---|
1036 | If smaller than this then ignored */ |
---|
1037 | inline void setSmallestElementInCut(double value) |
---|
1038 | { smallestElementInCut_=value;} |
---|
1039 | /** Get smallest change in cut. |
---|
1040 | If (upper-lower)*element < this then element is |
---|
1041 | taken out and cut relaxed. |
---|
1042 | (upper-lower) is taken to be at least 1.0 and |
---|
1043 | this is assumed >= smallestElementInCut_ |
---|
1044 | */ |
---|
1045 | inline double smallestChangeInCut() const |
---|
1046 | { return smallestChangeInCut_;} |
---|
1047 | /** Set smallest change in cut. |
---|
1048 | If (upper-lower)*element < this then element is |
---|
1049 | taken out and cut relaxed. |
---|
1050 | (upper-lower) is taken to be at least 1.0 and |
---|
1051 | this is assumed >= smallestElementInCut_ |
---|
1052 | */ |
---|
1053 | inline void setSmallestChangeInCut(double value) |
---|
1054 | { smallestChangeInCut_=value;} |
---|
1055 | /// Pass in initial solve options |
---|
1056 | inline void setSolveOptions(const ClpSolve & options) |
---|
1057 | { solveOptions_ = options;} |
---|
1058 | /** Tighten bounds - lightweight or very lightweight |
---|
1059 | 0 - normal, 1 lightweight but just integers, 2 lightweight and all |
---|
1060 | */ |
---|
1061 | virtual int tightenBounds(int lightweight=0); |
---|
1062 | /// Return number of entries in L part of current factorization |
---|
1063 | virtual CoinBigIndex getSizeL() const; |
---|
1064 | /// Return number of entries in U part of current factorization |
---|
1065 | virtual CoinBigIndex getSizeU() const; |
---|
1066 | /// Get disaster handler |
---|
1067 | const OsiClpDisasterHandler * disasterHandler() const |
---|
1068 | { return disasterHandler_;} |
---|
1069 | /// Pass in disaster handler |
---|
1070 | void passInDisasterHandler(OsiClpDisasterHandler * handler); |
---|
1071 | /// Get fake objective |
---|
1072 | ClpLinearObjective * fakeObjective() const |
---|
1073 | { return fakeObjective_;} |
---|
1074 | /// Set fake objective (and take ownership) |
---|
1075 | void setFakeObjective(ClpLinearObjective * fakeObjective); |
---|
1076 | /// Set fake objective |
---|
1077 | void setFakeObjective(double * fakeObjective); |
---|
1078 | /*! \brief Set up solver for repeated use by Osi interface. |
---|
1079 | |
---|
1080 | The normal usage does things like keeping factorization around so can be |
---|
1081 | used. Will also do things like keep scaling and row copy of matrix if |
---|
1082 | matrix does not change. |
---|
1083 | |
---|
1084 | \p senseOfAdventure: |
---|
1085 | - 0 - safe stuff as above |
---|
1086 | - 1 - will take more risks - if it does not work then bug which will be |
---|
1087 | fixed |
---|
1088 | - 2 - don't bother doing most extreme termination checks e.g. don't bother |
---|
1089 | re-factorizing if less than 20 iterations. |
---|
1090 | - 3 - Actually safer than 1 (mainly just keeps factorization) |
---|
1091 | |
---|
1092 | \p printOut |
---|
1093 | - -1 always skip round common messages instead of doing some work |
---|
1094 | - 0 skip if normal defaults |
---|
1095 | - 1 leaves |
---|
1096 | */ |
---|
1097 | void setupForRepeatedUse(int senseOfAdventure=0, int printOut=0); |
---|
1098 | /// Synchronize model (really if no cuts in tree) |
---|
1099 | virtual void synchronizeModel(); |
---|
1100 | /*! \brief Set special options in underlying clp solver. |
---|
1101 | |
---|
1102 | Safe as const because #modelPtr_ is mutable. |
---|
1103 | */ |
---|
1104 | void setSpecialOptionsMutable(unsigned int value) const; |
---|
1105 | |
---|
1106 | //@} |
---|
1107 | |
---|
1108 | //--------------------------------------------------------------------------- |
---|
1109 | |
---|
1110 | /**@name Constructors and destructors */ |
---|
1111 | //@{ |
---|
1112 | /// Default Constructor |
---|
1113 | OsiClpSolverInterface (); |
---|
1114 | |
---|
1115 | /// Clone |
---|
1116 | virtual OsiSolverInterface * clone(bool copyData = true) const; |
---|
1117 | |
---|
1118 | /// Copy constructor |
---|
1119 | OsiClpSolverInterface (const OsiClpSolverInterface &); |
---|
1120 | |
---|
1121 | /// Borrow constructor - only delete one copy |
---|
1122 | OsiClpSolverInterface (ClpSimplex * rhs, bool reallyOwn=false); |
---|
1123 | |
---|
1124 | /// Releases so won't error |
---|
1125 | void releaseClp(); |
---|
1126 | |
---|
1127 | /// Assignment operator |
---|
1128 | OsiClpSolverInterface & operator=(const OsiClpSolverInterface& rhs); |
---|
1129 | |
---|
1130 | /// Destructor |
---|
1131 | virtual ~OsiClpSolverInterface (); |
---|
1132 | |
---|
1133 | /// Resets as if default constructor |
---|
1134 | virtual void reset(); |
---|
1135 | //@} |
---|
1136 | |
---|
1137 | //--------------------------------------------------------------------------- |
---|
1138 | |
---|
1139 | protected: |
---|
1140 | ///@name Protected methods |
---|
1141 | //@{ |
---|
1142 | /** Apply a row cut (append to constraint matrix). */ |
---|
1143 | virtual void applyRowCut(const OsiRowCut& rc); |
---|
1144 | |
---|
1145 | /** Apply a column cut (adjust one or more bounds). */ |
---|
1146 | virtual void applyColCut(const OsiColCut& cc); |
---|
1147 | //@} |
---|
1148 | |
---|
1149 | //--------------------------------------------------------------------------- |
---|
1150 | |
---|
1151 | protected: |
---|
1152 | /**@name Protected methods */ |
---|
1153 | //@{ |
---|
1154 | /// The real work of a copy constructor (used by copy and assignment) |
---|
1155 | void gutsOfDestructor(); |
---|
1156 | |
---|
1157 | /// Deletes all mutable stuff |
---|
1158 | void freeCachedResults() const; |
---|
1159 | |
---|
1160 | /// Deletes all mutable stuff for row ranges etc |
---|
1161 | void freeCachedResults0() const; |
---|
1162 | |
---|
1163 | /// Deletes all mutable stuff for matrix etc |
---|
1164 | void freeCachedResults1() const; |
---|
1165 | |
---|
1166 | /// A method that fills up the rowsense_, rhs_ and rowrange_ arrays |
---|
1167 | void extractSenseRhsRange() const; |
---|
1168 | |
---|
1169 | /// |
---|
1170 | void fillParamMaps(); |
---|
1171 | /** Warm start |
---|
1172 | |
---|
1173 | NOTE artificials are treated as +1 elements so for <= rhs |
---|
1174 | artificial will be at lower bound if constraint is tight |
---|
1175 | |
---|
1176 | This means that Clpsimplex flips artificials as it works |
---|
1177 | in terms of row activities |
---|
1178 | */ |
---|
1179 | CoinWarmStartBasis getBasis(ClpSimplex * model) const; |
---|
1180 | /** Sets up working basis as a copy of input |
---|
1181 | |
---|
1182 | NOTE artificials are treated as +1 elements so for <= rhs |
---|
1183 | artificial will be at lower bound if constraint is tight |
---|
1184 | |
---|
1185 | This means that Clpsimplex flips artificials as it works |
---|
1186 | in terms of row activities |
---|
1187 | */ |
---|
1188 | void setBasis( const CoinWarmStartBasis & basis, ClpSimplex * model); |
---|
1189 | /// Crunch down problem a bit |
---|
1190 | void crunch(); |
---|
1191 | /// Extend scale factors |
---|
1192 | void redoScaleFactors(int numberRows,const CoinBigIndex * starts, |
---|
1193 | const int * indices, const double * elements); |
---|
1194 | public: |
---|
1195 | /** Sets up working basis as a copy of input and puts in as basis |
---|
1196 | */ |
---|
1197 | void setBasis( const CoinWarmStartBasis & basis); |
---|
1198 | /// Just puts current basis_ into ClpSimplex model |
---|
1199 | inline void setBasis( ) |
---|
1200 | { setBasis(basis_,modelPtr_);} |
---|
1201 | /// Warm start difference from basis_ to statusArray |
---|
1202 | CoinWarmStartDiff * getBasisDiff(const unsigned char * statusArray) const ; |
---|
1203 | /// Warm start from statusArray |
---|
1204 | CoinWarmStartBasis * getBasis(const unsigned char * statusArray) const ; |
---|
1205 | /// Delete all scale factor stuff and reset option |
---|
1206 | void deleteScaleFactors(); |
---|
1207 | /// If doing fast hot start then ranges are computed |
---|
1208 | inline const double * upRange() const |
---|
1209 | { return rowActivity_;} |
---|
1210 | inline const double * downRange() const |
---|
1211 | { return columnActivity_;} |
---|
1212 | /// Pass in range array |
---|
1213 | inline void passInRanges(int * array) |
---|
1214 | { whichRange_=array;} |
---|
1215 | /// Pass in sos stuff from AMPl |
---|
1216 | void setSOSData(int numberSOS,const char * type, |
---|
1217 | const int * start,const int * indices, const double * weights=NULL); |
---|
1218 | /// Compute largest amount any at continuous away from bound |
---|
1219 | void computeLargestAway(); |
---|
1220 | /// Get largest amount continuous away from bound |
---|
1221 | inline double largestAway() const |
---|
1222 | { return largestAway_;} |
---|
1223 | /// Set largest amount continuous away from bound |
---|
1224 | inline void setLargestAway(double value) |
---|
1225 | { largestAway_ = value;} |
---|
1226 | /// Sort of lexicographic resolve |
---|
1227 | void lexSolve(); |
---|
1228 | //@} |
---|
1229 | |
---|
1230 | protected: |
---|
1231 | /**@name Protected member data */ |
---|
1232 | //@{ |
---|
1233 | /// Clp model represented by this class instance |
---|
1234 | mutable ClpSimplex * modelPtr_; |
---|
1235 | //@} |
---|
1236 | /**@name Cached information derived from the OSL model */ |
---|
1237 | //@{ |
---|
1238 | /// Pointer to dense vector of row sense indicators |
---|
1239 | mutable char *rowsense_; |
---|
1240 | |
---|
1241 | /// Pointer to dense vector of row right-hand side values |
---|
1242 | mutable double *rhs_; |
---|
1243 | |
---|
1244 | /** Pointer to dense vector of slack upper bounds for range |
---|
1245 | constraints (undefined for non-range rows) |
---|
1246 | */ |
---|
1247 | mutable double *rowrange_; |
---|
1248 | |
---|
1249 | /** A pointer to the warmstart information to be used in the hotstarts. |
---|
1250 | This is NOT efficient and more thought should be given to it... */ |
---|
1251 | mutable CoinWarmStartBasis* ws_; |
---|
1252 | /** also save row and column information for hot starts |
---|
1253 | only used in hotstarts so can be casual */ |
---|
1254 | mutable double * rowActivity_; |
---|
1255 | mutable double * columnActivity_; |
---|
1256 | /// Stuff for fast dual |
---|
1257 | ClpNodeStuff stuff_; |
---|
1258 | /// Number of SOS sets |
---|
1259 | int numberSOS_; |
---|
1260 | /// SOS set info |
---|
1261 | CoinSet * setInfo_; |
---|
1262 | /// Alternate model (hot starts) - but also could be permanent and used for crunch |
---|
1263 | ClpSimplex * smallModel_; |
---|
1264 | /// factorization for hot starts |
---|
1265 | ClpFactorization * factorization_; |
---|
1266 | /** Smallest allowed element in cut. |
---|
1267 | If smaller than this then ignored */ |
---|
1268 | double smallestElementInCut_; |
---|
1269 | /** Smallest change in cut. |
---|
1270 | If (upper-lower)*element < this then element is |
---|
1271 | taken out and cut relaxed. */ |
---|
1272 | double smallestChangeInCut_; |
---|
1273 | /// Largest amount continuous away from bound |
---|
1274 | double largestAway_; |
---|
1275 | /// Arrays for hot starts |
---|
1276 | char * spareArrays_; |
---|
1277 | /** Warmstart information to be used in resolves. */ |
---|
1278 | CoinWarmStartBasis basis_; |
---|
1279 | /** The original iteration limit before hotstarts started. */ |
---|
1280 | int itlimOrig_; |
---|
1281 | |
---|
1282 | /*! \brief Last algorithm used |
---|
1283 | |
---|
1284 | Coded as |
---|
1285 | - 0 invalid |
---|
1286 | - 1 primal |
---|
1287 | - 2 dual |
---|
1288 | - -911 disaster in the algorithm that was attempted |
---|
1289 | - 999 current solution no longer optimal due to change in problem or |
---|
1290 | basis |
---|
1291 | */ |
---|
1292 | mutable int lastAlgorithm_; |
---|
1293 | |
---|
1294 | /// To say if destructor should delete underlying model |
---|
1295 | bool notOwned_; |
---|
1296 | |
---|
1297 | /// Pointer to row-wise copy of problem matrix coefficients. |
---|
1298 | mutable CoinPackedMatrix *matrixByRow_; |
---|
1299 | |
---|
1300 | /// Pointer to row-wise copy of continuous problem matrix coefficients. |
---|
1301 | CoinPackedMatrix *matrixByRowAtContinuous_; |
---|
1302 | |
---|
1303 | /// Pointer to integer information |
---|
1304 | char * integerInformation_; |
---|
1305 | |
---|
1306 | /** Pointer to variables for which we want range information |
---|
1307 | The number is in [0] |
---|
1308 | memory is not owned by OsiClp |
---|
1309 | */ |
---|
1310 | int * whichRange_; |
---|
1311 | |
---|
1312 | //std::map<OsiIntParam, ClpIntParam> intParamMap_; |
---|
1313 | //std::map<OsiDblParam, ClpDblParam> dblParamMap_; |
---|
1314 | //std::map<OsiStrParam, ClpStrParam> strParamMap_; |
---|
1315 | |
---|
1316 | /*! \brief Faking min to get proper dual solution signs in simplex API */ |
---|
1317 | mutable bool fakeMinInSimplex_ ; |
---|
1318 | /*! \brief Linear objective |
---|
1319 | |
---|
1320 | Normally a pointer to the linear coefficient array in the clp objective. |
---|
1321 | An independent copy when #fakeMinInSimplex_ is true, because we need |
---|
1322 | something permanent to point to when #getObjCoefficients is called. |
---|
1323 | */ |
---|
1324 | mutable double *linearObjective_; |
---|
1325 | |
---|
1326 | /// To save data in OsiSimplex stuff |
---|
1327 | mutable ClpDataSave saveData_; |
---|
1328 | /// Options for initialSolve |
---|
1329 | ClpSolve solveOptions_; |
---|
1330 | /** Scaling option |
---|
1331 | When scaling is on it is possible that the scaled problem |
---|
1332 | is feasible but the unscaled is not. Clp returns a secondary |
---|
1333 | status code to that effect. This option allows for a cleanup. |
---|
1334 | If you use it I would suggest 1. |
---|
1335 | This only affects actions when scaled optimal |
---|
1336 | 0 - no action |
---|
1337 | 1 - clean up using dual if primal infeasibility |
---|
1338 | 2 - clean up using dual if dual infeasibility |
---|
1339 | 3 - clean up using dual if primal or dual infeasibility |
---|
1340 | 11,12,13 - as 1,2,3 but use primal |
---|
1341 | */ |
---|
1342 | int cleanupScaling_; |
---|
1343 | /** Special options |
---|
1344 | 0x80000000 off |
---|
1345 | 0 simple stuff for branch and bound |
---|
1346 | 1 try and keep work regions as much as possible |
---|
1347 | 2 do not use any perturbation |
---|
1348 | 4 allow exit before re-factorization |
---|
1349 | 8 try and re-use factorization if no cuts |
---|
1350 | 16 use standard strong branching rather than clp's |
---|
1351 | 32 Just go to first factorization in fast dual |
---|
1352 | 64 try and tighten bounds in crunch |
---|
1353 | 128 Model will only change in column bounds |
---|
1354 | 256 Clean up model before hot start |
---|
1355 | 512 Give user direct access to Clp regions in getBInvARow etc (i.e., |
---|
1356 | do not unscale, and do not return result in getBInv parameters; |
---|
1357 | you have to know where to look for the answer) |
---|
1358 | 1024 Don't "borrow" model in initialSolve |
---|
1359 | 2048 Don't crunch |
---|
1360 | 4096 quick check for optimality |
---|
1361 | Bits above 8192 give where called from in Cbc |
---|
1362 | At present 0 is normal, 1 doing fast hotstarts, 2 is can do quick check |
---|
1363 | 65536 Keep simple i.e. no crunch etc |
---|
1364 | 131072 Try and keep scaling factors around |
---|
1365 | 262144 Don't try and tighten bounds (funny global cuts) |
---|
1366 | 524288 Fake objective and 0-1 |
---|
1367 | 1048576 Don't recompute ray after crunch |
---|
1368 | */ |
---|
1369 | mutable unsigned int specialOptions_; |
---|
1370 | /// Copy of model when option 131072 set |
---|
1371 | ClpSimplex * baseModel_; |
---|
1372 | /// Number of rows when last "scaled" |
---|
1373 | int lastNumberRows_; |
---|
1374 | /// Continuous model |
---|
1375 | ClpSimplex * continuousModel_; |
---|
1376 | /// Possible disaster handler |
---|
1377 | OsiClpDisasterHandler * disasterHandler_ ; |
---|
1378 | /// Fake objective |
---|
1379 | ClpLinearObjective * fakeObjective_; |
---|
1380 | /// Row scale factors (has inverse at end) |
---|
1381 | CoinDoubleArrayWithLength rowScale_; |
---|
1382 | /// Column scale factors (has inverse at end) |
---|
1383 | CoinDoubleArrayWithLength columnScale_; |
---|
1384 | //@} |
---|
1385 | }; |
---|
1386 | |
---|
1387 | class OsiClpDisasterHandler : public ClpDisasterHandler { |
---|
1388 | public: |
---|
1389 | /**@name Virtual methods that the derived classe should provide. |
---|
1390 | */ |
---|
1391 | //@{ |
---|
1392 | /// Into simplex |
---|
1393 | virtual void intoSimplex(); |
---|
1394 | /// Checks if disaster |
---|
1395 | virtual bool check() const ; |
---|
1396 | /// saves information for next attempt |
---|
1397 | virtual void saveInfo(); |
---|
1398 | /// Type of disaster 0 can fix, 1 abort |
---|
1399 | virtual int typeOfDisaster(); |
---|
1400 | //@} |
---|
1401 | |
---|
1402 | |
---|
1403 | /**@name Constructors, destructor */ |
---|
1404 | |
---|
1405 | //@{ |
---|
1406 | /** Default constructor. */ |
---|
1407 | OsiClpDisasterHandler(OsiClpSolverInterface * model = NULL); |
---|
1408 | /** Destructor */ |
---|
1409 | virtual ~OsiClpDisasterHandler(); |
---|
1410 | // Copy |
---|
1411 | OsiClpDisasterHandler(const OsiClpDisasterHandler&); |
---|
1412 | // Assignment |
---|
1413 | OsiClpDisasterHandler& operator=(const OsiClpDisasterHandler&); |
---|
1414 | /// Clone |
---|
1415 | virtual ClpDisasterHandler * clone() const; |
---|
1416 | |
---|
1417 | //@} |
---|
1418 | |
---|
1419 | /**@name Sets/gets */ |
---|
1420 | |
---|
1421 | //@{ |
---|
1422 | /** set model. */ |
---|
1423 | void setOsiModel(OsiClpSolverInterface * model); |
---|
1424 | /// Get model |
---|
1425 | inline OsiClpSolverInterface * osiModel() const |
---|
1426 | { return osiModel_;} |
---|
1427 | /// Set where from |
---|
1428 | inline void setWhereFrom(int value) |
---|
1429 | { whereFrom_=value;} |
---|
1430 | /// Get where from |
---|
1431 | inline int whereFrom() const |
---|
1432 | { return whereFrom_;} |
---|
1433 | /// Set phase |
---|
1434 | inline void setPhase(int value) |
---|
1435 | { phase_=value;} |
---|
1436 | /// Get phase |
---|
1437 | inline int phase() const |
---|
1438 | { return phase_;} |
---|
1439 | /// are we in trouble |
---|
1440 | inline bool inTrouble() const |
---|
1441 | { return inTrouble_;} |
---|
1442 | |
---|
1443 | //@} |
---|
1444 | |
---|
1445 | |
---|
1446 | protected: |
---|
1447 | /**@name Data members |
---|
1448 | The data members are protected to allow access for derived classes. */ |
---|
1449 | //@{ |
---|
1450 | /// Pointer to model |
---|
1451 | OsiClpSolverInterface * osiModel_; |
---|
1452 | /** Where from |
---|
1453 | 0 dual (resolve) |
---|
1454 | 1 crunch |
---|
1455 | 2 primal (resolve) |
---|
1456 | 4 dual (initialSolve) |
---|
1457 | 6 primal (initialSolve) |
---|
1458 | */ |
---|
1459 | int whereFrom_; |
---|
1460 | /** phase |
---|
1461 | 0 initial |
---|
1462 | 1 trying continuing with back in and maybe different perturb |
---|
1463 | 2 trying continuing with back in and different scaling |
---|
1464 | 3 trying dual from all slack |
---|
1465 | 4 trying primal from previous stored basis |
---|
1466 | */ |
---|
1467 | int phase_; |
---|
1468 | /// Are we in trouble |
---|
1469 | bool inTrouble_; |
---|
1470 | //@} |
---|
1471 | }; |
---|
1472 | // So unit test can find out if NDEBUG set |
---|
1473 | bool OsiClpHasNDEBUG(); |
---|
1474 | //############################################################################# |
---|
1475 | /** A function that tests the methods in the OsiClpSolverInterface class. The |
---|
1476 | only reason for it not to be a member method is that this way it doesn't |
---|
1477 | have to be compiled into the library. And that's a gain, because the |
---|
1478 | library should be compiled with optimization on, but this method should be |
---|
1479 | compiled with debugging. Also, if this method is compiled with |
---|
1480 | optimization, the compilation takes 10-15 minutes and the machine pages |
---|
1481 | (has 256M core memory!)... */ |
---|
1482 | int |
---|
1483 | OsiClpSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir); |
---|
1484 | #endif |
---|