Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. “error:passing 'const std::vector<int>' as 'this' argument discards qualifiers [-fpermissive]”

“error:passing 'const std::vector<int>' as 'this' argument discards qualifiers [-fpermissive]”

Scheduled Pinned Locked Moved Managed C++/CLI
helpc++graphicsperformancequestion
1 Posts 1 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    neuronphysics
    wrote on last edited by
    #1

    I am trying to apply DESPOT POMDP solver with using given examples to build my own decision making problem and I followed the documentation in the repository to build different relevant classes and functions in the header file

    class SimpleState: public State {
    public:
    int position;
    int context;
    int time;

            SimpleState();
            SimpleState(int \_position, int \_context, int \_time) :
            rat\_position(\_position),
            context(\_context),
            time(\_time) {
            }
            SimpleState(int \_state\_id);
            ~SimpleState();
    
            std::string text() const;
    };
        SimpleState::SimpleState() {
        }
    
    class StarMazeProblem : public DSPOMDP,
         public MDP {
    protected:
            std::vector > > transition\_probabilities\_; //state, action, \[state, weight\]
    
            mutable MemoryPool memory\_pool\_;
    
            std::vector states\_;
    
            mutable std::vector mdp\_policy\_;
    
    public:
            enum {CENTER = 0, RIGHT = 1, LEFT = 2};
            
    public:
          StarMazeProblem();
          int NumStates() const;
          void ComputeDefaultActions(std::string type)  const;
          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;
         }
    

    and in the `starmaze.cpp` file the relevant lines are

    int StarMazeProblem::NumStates() const {
    return CONTEXT * POSITIONS * TIME;
    }
    void StarMazeProblem::ComputeDefaultActions(string type) const {
    cerr << "Default action = " << type << endl;
    if (type == "MDP") {
    const_cast(this)->ComputeOptimalPolicyUsingVI();
    int num_states = NumStates();
    default_action_.resize(num_states);

    		double value = 0;
    		for (int s = 0; s < num\_states; s++) {
    			default\_action\_\[s\] = policy\_\[s\].action;
    			value += policy\_\[s\].value;
    		}
    	} else {
    		cerr << "Unsupported default action type " << type << endl;
    		exi
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups