Generated on for Gecode by doxygen 1.18.0
worker-control.hh
Go to the documentation of this file.
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main author:
4 * Mikael Zayenz Lagerkvist <lagerkvist@gecode.dev>
5 *
6 * Copyright:
7 * Mikael Zayenz Lagerkvist, 2026
8 *
9 * This file is part of Gecode, the generic constraint
10 * development environment:
11 * http://www.gecode.dev
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining
14 * a copy of this software and associated documentation files (the
15 * "Software"), to deal in the Software without restriction, including
16 * without limitation the rights to use, copy, modify, merge, publish,
17 * distribute, sublicense, and/or sell copies of the Software, and to
18 * permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be
22 * included in all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 */
32
33#ifndef GECODE_SEARCH_WORKER_CONTROL_HH
34#define GECODE_SEARCH_WORKER_CONTROL_HH
35
36namespace Gecode { namespace Search {
37
40 public:
42 static void attach(WorkerControl& control, unsigned int capacity);
44 static void detach(WorkerControl& control);
54 static void prepare_reuse(WorkerControl& control);
56 static unsigned long long int generation(const WorkerControl& control);
58 static const std::atomic<bool>*
61 static void fast_admission(WorkerControl& control,
62 unsigned long long int generation);
64 static bool same_identity(const WorkerControl& x,
65 const WorkerControl& y);
67 static unsigned int requested(const WorkerControl& control);
69 static void snapshot(const WorkerControl& control, unsigned int& requested,
70 unsigned long long int& generation);
72 static void wait(WorkerControl& control, unsigned int worker);
74 static void signal(WorkerControl& control, unsigned int worker);
76 static void signal_all(WorkerControl& control);
77 };
78
79}}
80
81#endif
82
83// STATISTICS: search-other
Internal access to worker-control state.
static void prepare_reuse(WorkerControl &control)
Prepare control for another engine with the same capacity.
static void signal_all(WorkerControl &control)
Signal every worker event.
static void fast_admission(WorkerControl &control, unsigned long long int generation)
Publish fast admission after reconciling generation at capacity.
static void snapshot(const WorkerControl &control, unsigned int &requested, unsigned long long int &generation)
Return a consistent request and generation snapshot.
static void attach(WorkerControl &control, unsigned int capacity)
Attach control to a leaf engine with fixed capacity.
static unsigned int requested(const WorkerControl &control)
Return the current request.
static void signal(WorkerControl &control, unsigned int worker)
Signal the event belonging to worker worker.
static const std::atomic< bool > * fast_admission(const WorkerControl &control)
Return the unchanged-capacity fast-admission flag.
static unsigned long long int generation(const WorkerControl &control)
Return the request generation.
static void wait(WorkerControl &control, unsigned int worker)
Wait for the event belonging to worker worker.
static void detach(WorkerControl &control)
Detach control from its leaf engine.
static bool same_identity(const WorkerControl &x, const WorkerControl &y)
Return whether x and y share one control identity.
External control for the requested number of search workers.
Definition search.hh:773
Search engines
Gecode toplevel namespace
#define GECODE_SEARCH_EXPORT
Definition search.hh:75
const int capacity[n_warehouses]
Capacity of a single warehouse.