/home/coin/SVN-release/OS-2.0.0/Bonmin/src/Interfaces/Ampl/sos_kludge.cpp

Go to the documentation of this file.
00001 /****************************************************************
00002 Copyright (C) 1997-2000 Lucent Technologies
00003 Modifications for Coin -  Copyright (C) 2006, International Business Machines Corporation and others.
00004 All Rights Reserved
00005 
00006 Permission to use, copy, modify, and distribute this software and
00007 its documentation for any purpose and without fee is hereby
00008 granted, provided that the above copyright notice appear in all
00009 copies and that both that the copyright notice and this
00010 permission notice and warranty disclaimer appear in supporting
00011 documentation, and that the name of Lucent or any of its entities
00012 not be used in advertising or publicity pertaining to
00013 distribution of the software without specific, written prior
00014 permission.
00015 
00016 LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
00017 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
00018 IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
00019 SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00020 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
00021 IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
00022 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
00023 THIS SOFTWARE.
00024 ****************************************************************/
00025 
00026 namespace ampl_utils
00027 {
00028     void
00029 sos_kludge(int nsos, int *sosbeg, double *sosref)
00030 {
00031   // Adjust sosref if necessary to make monotonic increasing
00032   int i, j, k;
00033   double t, t1;
00034   for(i = j = 0; i++ < nsos; ) {
00035     k = sosbeg[i];
00036     t = sosref[j];
00037     while(++j < k) {
00038       t1 = sosref[j];
00039       t += 1e-10;
00040       if (t1 <= t)
00041         sosref[j] = t1 = t + 1e-10;
00042       t = t1;
00043     }
00044   }
00045 }
00046 }

Generated on Mon Aug 3 03:02:18 2009 by  doxygen 1.4.7