Ignore:
Timestamp:
Jun 11, 2007 12:52:40 PM (12 years ago)
Author:
andreasw
Message:

minor changes to make code compile with MSVC++; reran autotools

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Couenne/Couenne/src/convex/operators/conv-exprSinCos.cpp

    r559 r582  
    88
    99#include <math.h>
     10#ifndef M_PI
     11# define M_PI 3.14159265358979323846
     12#endif
     13#ifndef M_PI_2
     14# define M_PI_2 1.57079632679489661923
     15#endif
    1016
    1117#include <OsiSolverInterface.hpp>
     
    8793                 expression *arg) { // argument of cos/sin (should be a variable)
    8894
    89   unary_function fn = (tt == COU_SINE) ? sin : cos;
     95  // AW 2007-06-11: The following doesn't compile with MSVC++ because
     96  // sin and cos are ambiguous
     97  //unary_function fn = (tt == COU_SINE) ? sin : cos;
    9098
    9199  // retrieve argument bounds
     
    118126  // left
    119127  if (lb > -COUENNE_INFINITY) { // if not unbounded
    120     ncuts += cg -> createCut (cs, fn (lb) - lb, -1, w_ind, 1., x_ind, -1.); // up:  w-x <= f lb - lb
    121     ncuts += cg -> createCut (cs, fn (lb) + lb, +1, w_ind, 1., x_ind,  1.); // dn:  w+x >= f lb + lb
     128    if (tt == COU_SINE) {
     129      ncuts += cg -> createCut (cs, sin (lb) - lb, -1, w_ind, 1., x_ind, -1.); // up:  w-x <= f lb - lb
     130      ncuts += cg -> createCut (cs, sin (lb) + lb, +1, w_ind, 1., x_ind,  1.); // dn:  w+x >= f lb + lb
     131    }
     132    else {
     133      ncuts += cg -> createCut (cs, cos (lb) - lb, -1, w_ind, 1., x_ind, -1.); // up:  w-x <= f lb - lb
     134      ncuts += cg -> createCut (cs, cos (lb) + lb, +1, w_ind, 1., x_ind,  1.); // dn:  w+x >= f lb + lb
     135    }
    122136  }
    123137
    124138  // right
    125139  if (ub <  COUENNE_INFINITY) { // if not unbounded
    126     ncuts += cg -> createCut (cs, fn (ub) - ub, +1, w_ind, 1., x_ind, -1.); // dn: w - x >= f ub - ub
    127     ncuts += cg -> createCut (cs, fn (ub) + ub, -1, w_ind, 1., x_ind,  1.); // up: w + x <= f ub + ub
     140    if (tt == COU_SINE) {
     141      ncuts += cg -> createCut (cs, sin (ub) - ub, +1, w_ind, 1., x_ind, -1.); // dn: w - x >= f ub - ub
     142      ncuts += cg -> createCut (cs, sin (ub) + ub, -1, w_ind, 1., x_ind,  1.); // up: w + x <= f ub + ub
     143    }
     144    else {
     145      ncuts += cg -> createCut (cs, cos (ub) - ub, +1, w_ind, 1., x_ind, -1.); // dn: w - x >= f ub - ub
     146      ncuts += cg -> createCut (cs, cos (ub) + ub, -1, w_ind, 1., x_ind,  1.); // up: w + x <= f ub + ub
     147    }
    128148  }
    129149
Note: See TracChangeset for help on using the changeset viewer.