Generated on for Gecode by doxygen 1.17.0
blackbox.hh
Go to the documentation of this file.
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Jip J. Dekker <jip.dekker@monash.edu>
5 *
6 * Contributing authors:
7 * Mikael Zayenz Lagerkvist <lagerkvist@gecode.dev>
8 *
9 * Copyright:
10 * Jip J. Dekker, 2026
11 *
12 * This file is part of Gecode, the generic constraint
13 * development environment:
14 * http://www.gecode.org
15 *
16 * Permission is hereby granted, free of charge, to any person obtaining
17 * a copy of this software and associated documentation files (the
18 * "Software"), to deal in the Software without restriction, including
19 * without limitation the rights to use, copy, modify, merge, publish,
20 * distribute, sublicense, and/or sell copies of the Software, and to
21 * permit persons to whom the Software is furnished to do so, subject to
22 * the following conditions:
23 *
24 * The above copyright notice and this permission notice shall be
25 * included in all copies or substantial portions of the Software.
26 *
27 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
31 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
32 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
33 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 *
35 */
36
37#ifndef GECODE_FLATZINC_BLACKBOX_HH
38#define GECODE_FLATZINC_BLACKBOX_HH
39
40#include <exception>
41#include <string>
42#include <vector>
43
44#include <gecode/flatzinc.hh>
45#include <gecode/kernel.hh>
46#ifdef GECODE_HAS_FLOAT_VARS
47#include <gecode/float.hh>
48#endif
49
50namespace Gecode {
51namespace FlatZinc {
52
53class BlackBoxContext;
54
57public:
62 return static_cast<BlackBoxContextHandle&>(
64 }
65
67 void init(void);
69 SharedHandle backendForConstraint(const std::string& mode,
70 const std::string& target,
71 const std::vector<std::string>& args) const;
73 void fail(std::exception_ptr e) const;
75 bool failed(void) const;
77 void rethrow(void) const;
78};
79
85
87 const IntVarArgs& int_in, const IntVarArgs& int_out,
88#ifdef GECODE_HAS_FLOAT_VARS
89 const FloatVarArgs& float_in, const FloatVarArgs& float_out,
90#endif
91 const std::string& mode, const std::string& target,
92 const std::vector<std::string>& args);
93
95 const IntVarArgs& ivar,
96#ifdef GECODE_HAS_FLOAT_VARS
97 const FloatVarArgs& fvar,
98#endif
99 const std::string& mode, const std::string& target,
100 const std::vector<std::string>& args,
101 const std::vector<int>& reason);
102
103} // namespace FlatZinc
104} // namespace Gecode
105
106#endif // GECODE_FLATZINC_BLACKBOX_HH
107
108// STATISTICS: flatzinc-prop
Access to the model-local blackbox context while posting and searching.
Definition blackbox.hh:81
static BlackBoxContextHandle & context(FlatZincSpace &s)
Model-local context shared by blackbox propagators and search support.
Definition blackbox.hh:56
void rethrow(void) const
Rethrow the first recorded propagation exception.
SharedHandle backendForConstraint(const std::string &mode, const std::string &target, const std::vector< std::string > &args) const
Return the backend selected for one constraint as an opaque handle.
BlackBoxContextHandle(const BlackBoxContextHandle &handle)
Definition blackbox.hh:59
void fail(std::exception_ptr e) const
Record the first exception raised during blackbox propagation.
BlackBoxContextHandle & operator=(const BlackBoxContextHandle &handle)
Definition blackbox.hh:61
bool failed(void) const
Whether blackbox propagation raised an exception.
void init(void)
Initialize this context if it is empty.
A space that can be initialized with a FlatZinc model.
Definition flatzinc.hh:424
Passing float variables.
Definition float.hh:982
Home class for posting propagators
Definition core.hpp:863
Passing integer variables.
Definition int.hh:680
SharedHandle & operator=(const SharedHandle &sh)
Assignment operator maintaining reference count.
SharedHandle(void)
Create shared handle with no object pointing to.
Interpreter for the FlatZinc language.
void blackbox_bounds(Home home, BlackBoxContextHandle &context, const IntVarArgs &ivar, const FloatVarArgs &fvar, const std::string &mode, const std::string &target, const std::vector< std::string > &args, const std::vector< int > &reason)
void blackbox(Home home, BlackBoxContextHandle &context, const IntVarArgs &int_in, const IntVarArgs &int_out, const FloatVarArgs &float_in, const FloatVarArgs &float_out, const std::string &mode, const std::string &target, const std::vector< std::string > &args)
Gecode toplevel namespace