@@ -2179,12 +2179,14 @@ namespace Gecode {
21792179 * @{
21802180 */
21812181namespace Gecode {
2182+
21822183 // / Construct linear expression as sum of \ref IntArgs \ref Slice elements
21832184 GECODE_MINIMODEL_EXPORT LinIntExpr
21842185 sum (const Slice<IntArgs>& slice);
21852186 // / Construct linear expression as sum of \ref IntArgs \ref Matrix elements
21862187 GECODE_MINIMODEL_EXPORT LinIntExpr
21872188 sum (const Matrix<IntArgs>& matrix);
2189+
21882190}
21892191/* * @}*/
21902192
@@ -2198,66 +2200,107 @@ namespace Gecode {
21982200 *
21992201 * \ingroup TaskModelMiniModel
22002202 */
2201- // @{
2202- namespace MiniModel {
2203-
2204- // / Baseclass for integer-based cost-based optimization
2205- template <IntRelType irt>
2206- class IntOptimizeSpace : public Space {
2207- public:
2208- // / Default constructor
2209- IntOptimizeSpace (void );
2210- // / Constructor for cloning
2211- IntOptimizeSpace (bool share, IntOptimizeSpace& s);
2212- // / Member function constraining according to cost
2213- virtual void constrain (const Space& best);
2214- // / Return variable with current cost
2215- virtual IntVar cost (void ) const = 0;
2216- };
2217-
2218- #ifdef GECODE_HAS_FLOAT_VARS
2219-
2220- // / Baseclass for float-based cost-based optimization
2221- template <FloatRelType frt>
2222- class FloatOptimizeSpace : public Space {
2223- protected:
2224- // / Step to increment for next better solution
2225- FloatNum step;
2226- public:
2227- // / Constructor with step \a s
2228- FloatOptimizeSpace (FloatNum s=0.0 );
2229- // / Constructor for cloning
2230- FloatOptimizeSpace (bool share, FloatOptimizeSpace& s);
2231- // / Member function constraining according to cost
2232- virtual void constrain (const Space& best);
2233- // / Return variable with current cost
2234- virtual FloatVar cost (void ) const = 0;
2235- };
22362203
2237- #endif
2204+ /* *
2205+ * \brief Class for minimizing integer cost
2206+ * \ingroup TaskModelMiniModelOptimize
2207+ */
2208+ class IntMinimizeSpace : public Space {
2209+ public:
2210+ // / Default constructor
2211+ IntMinimizeSpace (void );
2212+ // / Constructor for cloning
2213+ IntMinimizeSpace (bool share, IntMinimizeSpace& s);
2214+ // / Member function constraining according to decreasing cost
2215+ GECODE_MINIMODEL_EXPORT
2216+ virtual void constrain (const Space& best);
2217+ // / Return variable with current cost
2218+ virtual IntVar cost (void ) const = 0;
2219+ };
22382220
2239- }
2221+ /* *
2222+ * \brief Class for maximizing integer cost
2223+ * \ingroup TaskModelMiniModelOptimize
2224+ */
2225+ class IntMaximizeSpace : public Space {
2226+ public:
2227+ // / Default constructor
2228+ IntMaximizeSpace (void );
2229+ // / Constructor for cloning
2230+ IntMaximizeSpace (bool share, IntMaximizeSpace& s);
2231+ // / Member function constraining according to increasing cost
2232+ GECODE_MINIMODEL_EXPORT
2233+ virtual void constrain (const Space& best);
2234+ // / Return variable with current cost
2235+ virtual IntVar cost (void ) const = 0;
2236+ };
22402237
2241- // / Class for minimizing integer cost
2242- typedef MiniModel::IntOptimizeSpace<IRT_LE> MinimizeSpace;
2243- // / Class for maximizing integer cost
2244- typedef MiniModel::IntOptimizeSpace<IRT_GR> MaximizeSpace;
2245- // / Class for minimizing integer cost
2246- typedef MiniModel::IntOptimizeSpace<IRT_LE> IntMinimizeSpace;
2247- // / Class for maximizing integer cost
2248- typedef MiniModel::IntOptimizeSpace<IRT_GR> IntMaximizeSpace;
2238+ /* *
2239+ * \brief Class for minimizing integer cost
2240+ * \deprecated Use IntMinimizeSpace instead.
2241+ */
2242+ typedef IntMinimizeSpace MinimizeSpace;
2243+ /* *
2244+ * \brief Class for maximizing integer cost
2245+ * \deprecated Use IntMaximizeSpace instead.
2246+ */
2247+ typedef IntMaximizeSpace MaximizeSpace;
22492248
2249+
22502250#ifdef GECODE_HAS_FLOAT_VARS
22512251
2252- // / Class for minimizing float cost
2253- typedef MiniModel::FloatOptimizeSpace<FRT_LE> FloatMinimizeSpace;
2254- // / Class for maximizing float cost
2255- typedef MiniModel::FloatOptimizeSpace<FRT_GR> FloatMaximizeSpace;
2252+ /* *
2253+ * \brief Class for minimizing float cost
2254+ *
2255+ * The class supports using a step value \a step that will make sure
2256+ * that better solutions must be better by at least the value of
2257+ * \a step.
2258+ *
2259+ * \ingroup TaskModelMiniModelOptimize
2260+ */
2261+ class FloatMinimizeSpace : public Space {
2262+ protected:
2263+ // / Step by which a next solution has to have lower cost
2264+ FloatNum step;
2265+ public:
2266+ // / Constructor with step \a s
2267+ FloatMinimizeSpace (FloatNum s=0.0 );
2268+ // / Constructor for cloning
2269+ FloatMinimizeSpace (bool share, FloatMinimizeSpace& s);
2270+ // / Member function constraining according to cost
2271+ GECODE_MINIMODEL_EXPORT
2272+ virtual void constrain (const Space& best);
2273+ // / Return variable with current cost
2274+ virtual FloatVar cost (void ) const = 0;
2275+ };
2276+
2277+ /* *
2278+ * \brief Class for maximizing float cost
2279+ *
2280+ * The class supports using a step value \a step that will make sure
2281+ * that better solutions must be better by at least the value of
2282+ * \a step.
2283+ *
2284+ * \ingroup TaskModelMiniModelOptimize
2285+ */
2286+ class FloatMaximizeSpace : public Space {
2287+ protected:
2288+ // / Step by which a next solution has to have lower cost
2289+ FloatNum step;
2290+ public:
2291+ // / Constructor with step \a s
2292+ FloatMaximizeSpace (FloatNum s=0.0 );
2293+ // / Constructor for cloning
2294+ FloatMaximizeSpace (bool share, FloatMaximizeSpace& s);
2295+ // / Member function constraining according to cost
2296+ GECODE_MINIMODEL_EXPORT
2297+ virtual void constrain (const Space& best);
2298+ // / Return variable with current cost
2299+ virtual FloatVar cost (void ) const = 0;
2300+ };
22562301
22572302#endif
22582303
2259- // @}
2260-
22612304}
22622305
22632306#include < gecode/minimodel/optimize.hpp>
0 commit comments