Generated on for Gecode by doxygen 1.18.0
astar.hh
Go to the documentation of this file.
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
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
34
35#ifndef GECODE_SEARCH_SEQ_ASTAR_HH
36#define GECODE_SEARCH_SEQ_ASTAR_HH
37
38#include <gecode/search.hh>
41
42#ifdef GECODE_HAS_EXPERIMENTAL
43namespace Gecode { namespace Search { namespace Seq {
44
46 class AStar : public Worker {
47 private:
49 Options opt;
51 HeuristicGuidance guidance;
53 Queue queue;
55 unsigned long long int order;
57 ChoiceExpansion expansion;
59 SpaceStatus status;
61 unsigned long int depth;
63 unsigned long long int revision;
65 bool counted;
67 Incumbent best;
69 void enqueue(std::unique_ptr<Space> s, unsigned long int d);
71 Space* publish(std::unique_ptr<Space> s);
73 void initialize(Space* s, bool clone);
74 public:
76 AStar(Space* s, const Options& o);
78 Space* next(void);
82 void constrain(const Space& b);
84 void reset(Space* s);
87 };
88
89}}}
90
91#endif
92
93#endif
94
95// STATISTICS: search-seq
No-goods recorded from restarts.
Definition core.hpp:1606
Guidance for heuristic search engines (experimental).
Definition search.hh:1259
Best solution found so far.
Definition heuristic.hh:87
Search engine options
Definition search.hh:848
Priority queue of open nodes for A*.
Definition heuristic.hh:135
Space * next(void)
Return next better solution (nullptr if none or stopped).
NoGoods & nogoods(void)
Return no-goods (none).
Statistics statistics(void) const
Return statistics.
void constrain(const Space &b)
Constrain future solutions to be better than b.
void reset(Space *s)
Reset engine to restart at space s.
AStar(Space *s, const Options &o)
Initialize for space s with options o.
Node whose alternatives are expanded one at a time.
Statistics(void)
Initialize.
Worker(void)
Initialize.
Definition worker.hh:72
Computation spaces.
Definition core.hpp:1787
SpaceStatus
Space status
Definition core.hpp:1726
Search engines
Gecode toplevel namespace