error: no matching function for call to

I am trying to apply [this POMDP solver with a given example][1] to my decision making problem and I followed the documentation in the repository to build different relevant classes and functions

ParticleUpperBound* StarMazeProblem::CreateParticleUpperBound(string name) const {
if (name == "TRIVIAL" || name == "DEFAULT") {
return new TrivialParticleUpperBound(this);
} else if (name == "MDP") {
return new MDPUpperBound(this, *this);
} else {
cerr << "Unsupported particle lower bound: " << name << endl;
exit(1);
}
}
ScenarioUpperBound* StarMazeProblem::CreateScenarioUpperBound(string name,
string particle_bound_name) const {
ScenarioUpperBound* bound = NULL;
if (name == "TRIVIAL" || name == "DEFAULT") {
bound = new TrivialParticleUpperBound(this);
} else if (name == "LOOKAHEAD") {
return new LookaheadUpperBound(this, *this,
CreateParticleUpperBound(particle_bound_name));

} else if (name == "MDP") {
return new MDPUpperBound(this, *this);
} else {
cerr << "Unsupported base upper bound: " << name << endl;
exit(0);
}
return bound;
}

here I got the following error for the above code:

src/starmaze.cpp:369:49: error: no matching function for call to 'despot::MDPUpperBound::MDPUpperBound(const despot::StarMazeProblem*, const despot::StarMazeProblem&)'
return new MDPUpperBound(this, *this);
^
In file included from src/starmaze.cpp:6:0:
../../../include/despot/core/builtin_upper_bounds.h:70:2: note: candidate: despot::MDPUpperBound::MDPUpperBound(const despot::MDP*, const despot::StateIndexer&)
MDPUpperBound(const MDP* model, const StateIndexer& indexer);
^~~~~~~~~~~~~
../../../include/despot/core/builtin_upper_bounds.h:70:2: note: no known conversion for argument 2 from 'const despot::StarMazeProblem' to 'const despot::StateIndexer&'
../../../include/despot/core/builtin_upper_bounds.h:63:7: note: candidate: despot::MDPUpperBound::MDPUpperBound(const despot::MDPUpperBound&)
class MDPUpperBound: public ParticleUpperBound, public BeliefUpperBound {
^~~~~~~~~~~~~
../../../include/despot/core/builtin_upper_bounds.h:63:7: note: candidate expects 1 argument, 2 provided
../../../include/despot/core/builtin_upper_bounds.h:63:7: note: candidate: despot::MDPUpperBound::MDPUpperBound(despot::MDPUpperBound&&)
../../../include/despot/core/builtin_upper_bounds.h:63:7: note: candidate expects 1 argument, 2 provided
src/starmaze.cpp: In member function 'virtual despot::ScenarioUpperBound* despot::StarMazeProblem::CreateScenarioUpperBound(std::__cxx11::string, std::__cxx11::string) const':
src/starmaze.cpp:382:63: error: no matching function for call to 'despot::LookaheadUpperBound::LookaheadUpperBound(const despot::StarMazeProblem*, const despot::StarMazeProblem&, despot::ParticleUpperBound*)'
CreateParticleUpperBound(particle_bound_name));
^
In file included from src/starmaze.cpp:6:0:
../../../include/despot/core/builtin_upper_bounds.h:37:2: note: candidate: despot::LookaheadUpperBound::LookaheadUpperBound(const despot::DSPOMDP*, const despot::StateIndexer&, despot::ParticleUpperBound*)
LookaheadUpperBound(const DSPOMDP* model, const StateIndexer& indexer,
^~~~~~~~~~~~~~~~~~~
../../../include/despot/core/builtin_upper_bounds.h:37:2: note: no known conversion for argument 2 from 'const despot::StarMazeProblem' to 'const despot::StateIndexer&'
../../../include/despot/core/builtin_upper_bounds.h:29:7: note: candidate: despot::LookaheadUpperBound::LookaheadUpperBound(const despot::LookaheadUpperBound&)
class LookaheadUpperBound: public ScenarioUpperBound {
^~~~~~~~~~~~~~~~~~~
../../../include/despot/core/builtin_upper_bounds.h:29:7: note: candidate expects 1 argument, 3 provided
../../../include/despot/core/builtin_upper_bounds.h:29:7: note: candidate: despot::LookaheadUpperBound::LookaheadUpperBound(despot::LookaheadUpperBound&&)
../../../include/despot/core/builtin_upper_bounds.h:29:7: note: candidate expects 1 argument, 3 provided
src/starmaze.cpp:385:49: error: no matching function for call to 'despot::MDPUpperBound::MDPUpperBound(const despot::StarMazeProblem*, const despot::StarMazeProblem&)'
return new MDPUpperBound(this, *this);
^
In file included from src/starmaze.cpp:6:0:
../../../include/despot/core/builtin_upper_bounds.h:70:2: note: candidate: despot::MDPUpperBound::MDPUpperBound(const despot::MDP*, const despot::StateIndexer&)
MDPUpperBound(const MDP* model, const StateIndexer& indexer);
^~~~~~~~~~~~~
../../../include/despot/core/builtin_upper_bounds.h:70:2: note: no known conversion for argument 2 from 'const despot::StarMazeProblem' to 'const despot::StateIndexer&'
../../../include/despot/core/builtin_upper_bounds.h:63:7: note: candidate: despot::MDPUpperBound::MDPUpperBound(const despot::MDPUpperBound&)
class MDPUpperBound: public ParticleUpperBound, public BeliefUpperBound {
^~~~~~~~~~~~~
../../../include/despot/core/builtin_upper_bounds.h:63:7: note: candidate expects 1 argument, 2 provided
../../../include/despot/core/builtin_upper_bounds.h:63:7: note: candidate: despot::MDPUpperBound::MDPUpperBound(despot::MDPUpperBound&&)
../../../include/despot/core/builtin_upper_bounds.h:63:7: note: candidate expects 1 argument, 2 provided
src/starmaze.cpp: At global scope:

**Update**
Part of my class is defined as

class StarMazeProblem : public DSPOMDP,
public MDP {
private:
std::vector<std::vector<std::vector<State> > > transition_probabilities_; //state, action, [state, weight]
public:
ParticleUpperBound* CreateParticleUpperBound(std::string name = "DEFAULT") const;//?
ScenarioUpperBound* CreateScenarioUpperBound(std::string name = "DEFAULT",
std::string particle_bound_name = "DEFAULT") const;

ScenarioLowerBound* CreateScenarioLowerBound(std::string name = "DEFAULT",
std::string particle_bound_name = "DEFAULT") const;

I tried to follow the examples and [instructions][2]. I can't figure out why I got these error messages.


[1]: https://github.com/AdaCompNUS/despot/blob/API_redesign/examples/cpp_models/navigation/src/navigation.cpp
[2]: https://github.com/AdaCompNUS/despot/blob/API_redesign/doc/cpp_model_doc/Tutorial%20on%20Using%20DESPOT%20with%20cpp%20model.md
Last edited on
Did you clone the entire repo?

Because it works for me.

$ git clone https://github.com/AdaCompNUS/despot.git
Cloning into 'despot'...
remote: Enumerating objects: 2882, done.
remote: Total 2882 (delta 0), reused 0 (delta 0), pack-reused 2882
Receiving objects: 100% (2882/2882), 5.14 MiB | 869.00 KiB/s, done.
Resolving deltas: 100% (1788/1788), done.
Checking connectivity... done.
$ cd despot/
$ make
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/core/builtin_upper_bounds.cpp -o build/builtin_upper_bounds.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/core/mdp.cpp -o build/mdp.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/core/builtin_policy.cpp -o build/builtin_policy.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/core/builtin_lower_bounds.cpp -o build/builtin_lower_bounds.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/core/pomdp_world.cpp -o build/pomdp_world.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/core/particle_belief.cpp -o build/particle_belief.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/core/globals.cpp -o build/globals.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/core/node.cpp -o build/node.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/core/solver.cpp -o build/solver.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/logger.cpp -o build/logger.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/plannerbase.cpp -o build/plannerbase.o 
In file included from include/despot/plannerbase.h:9:0,
                 from src/plannerbase.cpp:2:
include/despot/util/optionparser.h: In static member function ‘static bool despot::option::Parser::workhorse(bool, const despot::option::Descriptor*, int, const char**, despot::option::Parser::Action&, bool, bool, int)’:
include/despot/util/optionparser.h:1644:40: warning: ‘optarg’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      if (optarg != 0 && have_more_args && optarg == args[1]) {
                                        ^
include/despot/util/optionparser.h:1561:8: warning: ‘idx’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    int idx;
        ^
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/evaluator.cpp -o build/evaluator.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/util/gamma.cpp -o build/gamma.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/util/seeds.cpp -o build/seeds.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/util/dirichlet.cpp -o build/dirichlet.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/util/util.cpp -o build/util.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/util/random.cpp -o build/random.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/util/exec_tracker.cpp -o build/exec_tracker.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/util/floor.cpp -o build/floor.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/util/tinyxml/tinyxmlerror.cpp -o build/tinyxmlerror.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/util/tinyxml/tinyxml.cpp -o build/tinyxml.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/util/tinyxml/tinyxmlparser.cpp -o build/tinyxmlparser.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/util/tinyxml/tinystr.cpp -o build/tinystr.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/util/logging.cpp -o build/logging.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/util/coord.cpp -o build/coord.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/planner.cpp -o build/planner.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/pomdpx/pomdpx.cpp -o build/pomdpx.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/pomdpx/parser/parser.cpp -o build/parser.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/pomdpx/parser/variable.cpp -o build/variable.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/pomdpx/parser/function.cpp -o build/function.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/interface/lower_bound.cpp -o build/lower_bound.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/interface/belief.cpp -o build/belief.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/interface/world.cpp -o build/world.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/interface/upper_bound.cpp -o build/upper_bound.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/interface/default_policy.cpp -o build/default_policy.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/interface/pomdp.cpp -o build/pomdp.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/random_streams.cpp -o build/random_streams.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/solver/despot.cpp -o build/despot.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/solver/baseline_solver.cpp -o build/baseline_solver.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/solver/pomcp.cpp -o build/pomcp.o 
g++ -O3 -c -Wall -Wno-sign-compare -fpic -I include -I include/despot/util -I src  src/solver/aems.cpp -o build/aems.o 
$ git status
On branch API_redesign
Your branch is up-to-date with 'origin/API_redesign'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

	.deps/
	build/

nothing added to commit but untracked files present (use "git add" to track)

$ cd examples/cpp_models/navigation/
$ make
make[1]: Entering directory '/external/cppForum/t5/despot'
make[1]: Leaving directory '/external/cppForum/t5/despot'
g++ -O3 -Wall -Wno-sign-compare  src/navigation.cpp src/main.cpp -I ../../../include ../../../build/*.o -o navigation 


Since there is no starmaze.cpp in the repo, the problem is entirely in your code.

Are you using git to regularly track your changes to your code?

Has your code ever worked?
If so, the best place to start is with a diff between your last success and what you have now.


src/starmaze.cpp:369:49: error: no matching function for call to 'despot::MDPUpperBound::MDPUpperBound(const despot::StarMazeProblem*, const despot::StarMazeProblem&)
return new MDPUpperBound(this, *this);

Your return statement is calling a constructor for MDPUpperBound() which takes two arguments. You're passing const StarMazeProblem* and const StarMazeProblem& both in namespace despot. Are you sure such a constructor exists?
The compiler is telling you that it can't find such a constructor.
It lists several possibilities. The closest of which is:

../../../include/despot/core/builtin_upper_bounds.h:37:2: note: no known conversion for argument 2 from 'const despot::StarMazeProblem' to 'const despot::StateIndexer&

which is expecting a StateIndexer reference.

PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Last edited on
Topic archived. No new replies allowed.