| 1 |
/**************************************************************** |
| 2 |
Copyright (C) 1997-2000 Lucent Technologies |
| 3 |
Modifications for Coin - Copyright (C) 2006, International Business Machines Corporation and others. |
| 4 |
All Rights Reserved |
| 5 |
|
| 6 |
Permission to use, copy, modify, and distribute this software and |
| 7 |
its documentation for any purpose and without fee is hereby |
| 8 |
granted, provided that the above copyright notice appear in all |
| 9 |
copies and that both that the copyright notice and this |
| 10 |
permission notice and warranty disclaimer appear in supporting |
| 11 |
documentation, and that the name of Lucent or any of its entities |
| 12 |
not be used in advertising or publicity pertaining to |
| 13 |
distribution of the software without specific, written prior |
| 14 |
permission. |
| 15 |
|
| 16 |
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
| 17 |
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. |
| 18 |
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY |
| 19 |
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 20 |
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER |
| 21 |
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, |
| 22 |
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF |
| 23 |
THIS SOFTWARE. |
| 24 |
****************************************************************/ |
| 25 |
|
| 26 |
namespace ampl_utils |
| 27 |
{ |
| 28 |
void |
| 29 |
sos_kludge(int nsos, int *sosbeg, double *sosref) |
| 30 |
{ |
| 31 |
// Adjust sosref if necessary to make monotonic increasing |
| 32 |
int i, j, k; |
| 33 |
double t, t1; |
| 34 |
for(i = j = 0; i++ < nsos; ) { |
| 35 |
k = sosbeg[i]; |
| 36 |
t = sosref[j]; |
| 37 |
while(++j < k) { |
| 38 |
t1 = sosref[j]; |
| 39 |
t += 1e-10; |
| 40 |
if (t1 <= t) |
| 41 |
sosref[j] = t1 = t + 1e-10; |
| 42 |
t = t1; |
| 43 |
} |
| 44 |
} |
| 45 |
} |
| 46 |
} |