source: trunk/Bonmin/src/BonminAmplInterface/sos_kludge.cpp @ 1

Last change on this file since 1 was 1, checked in by andreasw, 13 years ago

imported initial code

  • Property svn:eol-style set to native
  • Property svn:keywords set to "Author Date Id Revision"
File size: 1.6 KB
RevLine 
[1]1/****************************************************************
2Copyright (C) 1997-2000 Lucent Technologies
3Modifications for Coin -  Copyright (C) 2006, International Business Machines Corporation and others.
4All Rights Reserved
5
6Permission to use, copy, modify, and distribute this software and
7its documentation for any purpose and without fee is hereby
8granted, provided that the above copyright notice appear in all
9copies and that both that the copyright notice and this
10permission notice and warranty disclaimer appear in supporting
11documentation, and that the name of Lucent or any of its entities
12not be used in advertising or publicity pertaining to
13distribution of the software without specific, written prior
14permission.
15
16LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
18IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
19SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
21IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
22ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
23THIS SOFTWARE.
24****************************************************************/
25
26namespace ampl_utils
27{
28    void
29sos_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}
Note: See TracBrowser for help on using the repository browser.