Generated on Thu Apr 11 13:59:03 2019 for Gecode by doxygen 1.6.3

minus.hpp

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *     Vincent Barichard <Vincent.Barichard@univ-angers.fr>
00006  *
00007  *  Copyright:
00008  *     Christian Schulte, 2003
00009  *     Vincent Barichard, 2012
00010  *
00011  *  This file is part of Gecode, the generic constraint
00012  *  development environment:
00013  *     http://www.gecode.org
00014  *
00015  *  Permission is hereby granted, free of charge, to any person obtaining
00016  *  a copy of this software and associated documentation files (the
00017  *  "Software"), to deal in the Software without restriction, including
00018  *  without limitation the rights to use, copy, modify, merge, publish,
00019  *  distribute, sublicense, and/or sell copies of the Software, and to
00020  *  permit persons to whom the Software is furnished to do so, subject to
00021  *  the following conditions:
00022  *
00023  *  The above copyright notice and this permission notice shall be
00024  *  included in all copies or substantial portions of the Software.
00025  *
00026  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00027  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00028  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00029  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00030  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00031  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00032  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00033  *
00034  */
00035 
00036 namespace Gecode { namespace Float {
00037 
00038   /*
00039    * Constructors and initialization
00040    *
00041    */
00042   forceinline
00043   MinusView::MinusView(void) {}
00044   forceinline
00045   MinusView::MinusView(const FloatView& y)
00046     : DerivedView<FloatView>(y) {}
00047 
00048   /*
00049    * Value access
00050    *
00051    */
00052   forceinline FloatVal
00053   MinusView::domain(void) const {
00054     return -x.domain();
00055   }
00056   forceinline FloatNum
00057   MinusView::min(void) const {
00058     return -x.max();
00059   }
00060   forceinline FloatNum
00061   MinusView::max(void) const {
00062     return -x.min();
00063   }
00064   forceinline FloatNum
00065   MinusView::med(void) const {
00066     return -x.med();
00067   }
00068   forceinline FloatVal
00069   MinusView::val(void) const {
00070     return -x.val();
00071   }
00072 
00073   forceinline FloatNum
00074   MinusView::size(void) const {
00075     return x.size();
00076   }
00077 
00078 
00079   /*
00080    * Domain tests
00081    *
00082    */
00083   forceinline bool
00084   MinusView::zero_in(void) const {
00085     return x.zero_in();
00086   }
00087   forceinline bool
00088   MinusView::in(FloatNum n) const {
00089     return x.in(-n);
00090   }
00091   forceinline bool
00092   MinusView::in(const FloatVal& n) const {
00093     return x.in(-n);
00094   }
00095 
00096 
00097   /*
00098    * Domain update by value
00099    *
00100    */
00101   forceinline ModEvent
00102   MinusView::lq(Space& home, int n) {
00103     return x.gq(home,-n);
00104   }
00105   forceinline ModEvent
00106   MinusView::lq(Space& home, FloatNum n) {
00107     return x.gq(home,-n);
00108   }
00109   forceinline ModEvent
00110   MinusView::lq(Space& home, FloatVal n) {
00111     return x.gq(home,-n);
00112   }
00113 
00114   forceinline ModEvent
00115   MinusView::gq(Space& home, int n) {
00116     return x.lq(home,-n);
00117   }
00118   forceinline ModEvent
00119   MinusView::gq(Space& home, FloatNum n) {
00120     return x.lq(home,-n);
00121   }
00122   forceinline ModEvent
00123   MinusView::gq(Space& home, FloatVal n) {
00124     return x.lq(home,-n);
00125   }
00126 
00127   forceinline ModEvent
00128   MinusView::eq(Space& home, int n) {
00129     return x.eq(home,-n);
00130   }
00131   forceinline ModEvent
00132   MinusView::eq(Space& home, FloatNum n) {
00133     return x.eq(home,-n);
00134   }
00135   forceinline ModEvent
00136   MinusView::eq(Space& home, const FloatVal& n) {
00137     return x.eq(home,-n);
00138   }
00139 
00140 
00141   /*
00142    * Delta information for advisors
00143    *
00144    */
00145   forceinline FloatNum
00146   MinusView::min(const Delta& d) const {
00147     return -x.max(d);
00148   }
00149   forceinline FloatNum
00150   MinusView::max(const Delta& d) const {
00151     return -x.min(d);
00152   }
00153 
00154 
00155   forceinline ModEventDelta
00156   MinusView::med(ModEvent me) {
00157     return VarImpView<FloatVar>::med(me);
00158   }
00159 
00160   /*
00161    * View comparison
00162    *
00163    */
00164   forceinline bool
00165   operator ==(const MinusView& x, const MinusView& y) {
00166     return x.base() == y.base();
00167   }
00168   forceinline bool
00169   operator !=(const MinusView& x, const MinusView& y) {
00170     return !(x == y);
00171   }
00172 
00173 }}
00174 
00175 // STATISTICS: float-var
00176