| 1 |
// Copyright (C) 2006, International Business Machines |
| 2 |
// Corporation and others. All Rights Reserved. |
| 3 |
#ifndef OsiOpbdpSolve_H |
| 4 |
#define OsiOpbdpSolve_H |
| 5 |
|
| 6 |
#include <string> |
| 7 |
|
| 8 |
#include "OsiSolverInterface.hpp" |
| 9 |
|
| 10 |
/** Solve pure 0-1 with integral coefficients etc (or can be made by scaling) using opdbp |
| 11 |
The solution will be set in model |
| 12 |
If no solution then returns 0, if not suitable returns -1 |
| 13 |
*/ |
| 14 |
int solveOpbdp(OsiSolverInterface * model); |
| 15 |
/** Find all solutions of a pure 0-1 with integral coefficients etc (or can be made by scaling) using opdbp |
| 16 |
Returns an array of bit solution vectors. |
| 17 |
i is 1 if bit set (see below) |
| 18 |
If no solution then numberFound will be 0, if not suitable -1 |
| 19 |
|
| 20 |
This needs the line at about 206 of EnumerateOpt.cpp |
| 21 |
|
| 22 |
local_maximum = value + 1; // try to reach that one! |
| 23 |
|
| 24 |
replaced by |
| 25 |
|
| 26 |
if (verbosity!=-1) { |
| 27 |
local_maximum = value + 1; // try to reach that one! |
| 28 |
} else { |
| 29 |
local_maximum = 0; |
| 30 |
void opbdp_save_solution(OrdInt & sol); |
| 31 |
OrdInt sol = last_solution.to_OrdInt(); |
| 32 |
opbdp_save_solution(sol); // save solution |
| 33 |
} |
| 34 |
*/ |
| 35 |
unsigned int ** solveOpbdp(const OsiSolverInterface * model,int & numberFound); |
| 36 |
|
| 37 |
inline bool atOne(int i,unsigned int * array) { |
| 38 |
return ((array[i>>5]>>(i&31))&1)!=0; |
| 39 |
} |
| 40 |
inline void setAtOne(int i,unsigned int * array,bool trueFalse) { |
| 41 |
unsigned int & value = array[i>>5]; |
| 42 |
int bit = i&31; |
| 43 |
if (trueFalse) |
| 44 |
value |= (1<<bit); |
| 45 |
else |
| 46 |
value &= ~(1<<bit); |
| 47 |
} |
| 48 |
#endif |