Skip to content

Approximate Run time of the code #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
saxenam06 opened this issue Apr 28, 2022 · 7 comments
Open

Approximate Run time of the code #1

saxenam06 opened this issue Apr 28, 2022 · 7 comments

Comments

@saxenam06
Copy link

Hello, Many Thanks for your repository. I was trying to run merging_scenario_paper.py code. It displayed the following output in the console and then seems to have stucked since 4 hrs now. Does the code really takes time or something has gone wrong in my installation? Many Thanks for your help.

added constraint between 0 and 1 for 0
added constraint between 1 and 2 for 0
added constraint between 1 and 3 for 0
added constraint between 0 and 2 for 0
added constraint between 0 and 3 for 0
added constraint between 1 and 0 for 1
added constraint between 0 and 2 for 1
added constraint between 0 and 3 for 1
added constraint between 1 and 2 for 1
added constraint between 1 and 3 for 1

@brechtevens
Copy link
Owner

Hello,

Glad to hear you are trying out the simulator! The game starts in a 'paused' state, you just need to press the spacebar to start the game. I just added the instructions for interfacing with the simulator in the readme. I also packaged the src code now using flit, which is better practice than the weird implicit imports I did before.

Let me know how it goes!

Best,
Brecht

@saxenam06
Copy link
Author

Thanks a lot for your feedback. After pressing space bar I start getting the following message. Could you please have a quick glance below and give me a feedback again what could be going wrong. Many Thanks again for your help.

NEW GAME ITERATION__________
Traceback (most recent call last):

File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\examples\merging_

scenario_paper.py", line 126, in
vis.run()

File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\visualize.py", line 725, in run
pyglet.app.run()

File "C:\Users\pulom\anaconda3\lib\site-packages\pyglet\app_init_.py", line 107, in run
event_loop.run()

File "C:\Users\pulom\anaconda3\lib\site-packages\pyglet\app\base.py", line 167, in run
timeout = self.idle()

File "C:\Users\pulom\anaconda3\lib\site-packages\pyglet\app\base.py", line 237, in idle
redraw_all = self.clock.call_scheduled_functions(dt)

File "C:\Users\pulom\anaconda3\lib\site-packages\pyglet\clock.py", line 292, in call_scheduled_functions
item.func(now - item.last_ts, *item.args, **item.kwargs)

File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\visualize.py", line 304, in control_loop
vehicle.control(steer, gas)

File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\car.py", line 767, in control
self.initialize_solvers()

File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\car.py", line 747, in initialize_solvers
self.optimizer = lagrangiansolver.solver(self.id, self.players, self.shared_reward, self.g, self.h, self.v, self.lbv, self.ubv,

File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\lagrangiansolver.py", line 144, in init
self.solver = src.solvers.get_panocpy_solver(self.problem, self.solver_settings, self.bounds, self.id)

File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\solvers.py", line 186, in get_panocpy_solver
panocpy_prob = pa.generate_and_compile_casadi_problem_full(f_prob, g1_prob, g2_prob, name=name)

File "C:\Users\pulom\anaconda3\lib\site-packages\panocpy\casadi_problem.py", line 415, in generate_and_compile_casadi_problem_full
subprocess.run(configure_cmd, check=True)

File "C:\Users\pulom\anaconda3\lib\subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,

CalledProcessError: Command '['cmake', '-B', 'C:\Users\pulom\AppData\Local\Temp\panocpy\cache\build\build', '-S', 'C:\Users\pulom\AppData\Local\Temp\panocpy\cache\build']' returned non-zero exit status 1.

@brechtevens
Copy link
Owner

brechtevens commented May 2, 2022

That is strange, it seems like the provided 'panocpy' package is unable to build the quadratic penalty solver. Basically, as you probably have noticed, I am using a forked version of PANOC-ALM as my solver since the numerical experiments seem to perform better when using a quadratic penalty method instead of ALM.

Could you try the following things?

  • use ALM instead of quadratic penalty, by adding the following options to the merging scenario:
    • experiment.solver_settings.panoc_use_alm = True
    • experiment.learning_settings.panoc_use_alm = True
  • use OpEn instead of panocpy, by using
    • experiment.solver_settings.solver = 'OpEn'
    • experiment.learning_settings.solver = 'OpEn'

Finally, some additional questions:

  • What operating system are you using?
  • Are you using Python 3.9?

@saxenam06
Copy link
Author

saxenam06 commented May 3, 2022

Hello, Many Thanks again for your inputs and time. I am working on Windows 11 Home, with Anaconda and using Python 3.9.7 version.
Please also see this notebook to have a quick galnce of my installation procedure.
https://github.com/saxenam06/GPG-drive/blob/master/GPG_Drive_Installed.ipynb
By using the first proposal to use panoc_alm I get the same error as above mentioned.
By using the second proposal of using OpEn solver, I get some progress but then get the following error.
NEW GAME ITERATION
[INFO] Initialising builder
[INFO] Checking user parameters
[INFO] Creating necessary folders
[INFO] Copying icasadi interface to target directory
[INFO] Generating icasadi's Cargo.toml
[INFO] Generating Cargo.toml for target optimizer
[INFO] Generating icasadi Rust library file
Traceback (most recent call last):

File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\examples\merging_scenario_paper.py", line 129, in
vis.run()

File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\visualize.py", line 725, in run
pyglet.app.run()

File "C:\Users\pulom\anaconda3\lib\site-packages\pyglet\app_init_.py", line 107, in run
event_loop.run()

File "C:\Users\pulom\anaconda3\lib\site-packages\pyglet\app\base.py", line 167, in run
timeout = self.idle()

File "C:\Users\pulom\anaconda3\lib\site-packages\pyglet\app\base.py", line 237, in idle
redraw_all = self.clock.call_scheduled_functions(dt)

File "C:\Users\pulom\anaconda3\lib\site-packages\pyglet\clock.py", line 292, in call_scheduled_functions
item.func(now - item.last_ts, *item.args, **item.kwargs)

File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\visualize.py", line 304, in control_loop
vehicle.control(steer, gas)

File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\car.py", line 767, in control
self.initialize_solvers()

File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\car.py", line 747, in initialize_solvers
self.optimizer = lagrangiansolver.solver(self.id, self.players, self.shared_reward, self.g, self.h, self.v, self.lbv, self.ubv,

File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\lagrangiansolver.py", line 141, in init
self.solver = src.solvers.get_OpEn_solver(self.problem, self.solver_settings, self.bounds, self.id)

File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\solvers.py", line 120, in get_OpEn_solver
build_OpEn_problem(OpEn_problem, solver_settings, optimizers_dir, id, id2, name)

File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\solvers.py", line 73, in build_OpEn_problem
builder.build()

File "C:\Users\pulom\anaconda3\lib\site-packages\opengen\builder\optimizer_builder.py", line 632, in build
self.__generate_icasadi_lib() # generate icasadi lib.rs

File "C:\Users\pulom\anaconda3\lib\site-packages\opengen\builder\optimizer_builder.py", line 225, in __generate_icasadi_lib
icasadi_lib_output_template = icasadi_lib_template.render(meta=self.__meta,

File "C:\Users\pulom\anaconda3\lib\site-packages\jinja2\environment.py", line 1090, in render
self.environment.handle_exception()

File "C:\Users\pulom\anaconda3\lib\site-packages\jinja2\environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))

File "C:\Users\pulom\anaconda3\lib\site-packages\jinja2_compat.py", line 28, in reraise
raise value.with_traceback(tb)

File "C:\Users\pulom\anaconda3\lib\site-packages\opengen\templates\icasadi\icasadi_lib.rs", line 23, in top-level template code
const NUM_DECISION_VARIABLES: usize = {{ problem.dim_decision_variables() }};

File "C:\Users\pulom\anaconda3\lib\site-packages\opengen\builder\problem.py", line 118, in dim_decision_variables
return self.__u.size(1)

TypeError: 'int' object is not callable

@brechtevens
Copy link
Owner

Hmmm, I am quite surprised to see that. Doesn't cmake give an error? I guess panocpy is unable to find a C++ compiler. Do you have a C compiler installed, such as MSVC on Windows?

For the problem you encountered with OpEn, I encountered this as well a couple of days ago as well when packaging the repository and testing OpEn. This is due to OpEn not being compatible with casadi.tools. Commit 7a6b467 contains a fix to this. Basically, I think you just need to change these lines:

elif solver_settings.solver == 'OpEn':
OpEn_problem = self.problem.copy()
OpEn_problem['x'] = self.problem['x'].cat
OpEn_problem['g'] = self.problem['g'].cat
OpEn_problem['g1'] = self.problem['g1'].cat
OpEn_problem['g2'] = self.problem['g2'].cat
self.solver = solvers.get_OpEn_solver(OpEn_problem, self.solver_settings, self.bounds, self.id)
else:

@saxenam06
Copy link
Author

Let me check deeper about panocpy and then I will give you a feedback.

Regarding OpEn, I did as you proposed, I get some progress but then get the following error in Building Optimizer.
Could you please look through. Many Thanks for your help.
added constraint between 0 and 1 for 0
added constraint between 1 and 2 for 0
added constraint between 1 and 3 for 0
added constraint between 0 and 2 for 0
added constraint between 0 and 3 for 0
added constraint between 1 and 0 for 1
added constraint between 0 and 2 for 1
added constraint between 0 and 3 for 1
added constraint between 1 and 2 for 1
added constraint between 1 and 3 for 1
NEW GAME ITERATION
C:\Users\pulom\anaconda3\lib\site-packages\pyglet\image\codecs\wic.py:289: UserWarning: [WinError -2147417850] Cannot change thread mode after it is set
warnings.warn(str(err))
[INFO] Initialising builder
[INFO] Checking user parameters
[INFO] Creating necessary folders
[INFO] Copying icasadi interface to target directory
[INFO] Generating icasadi's Cargo.toml
[INFO] Generating Cargo.toml for target optimizer
[INFO] Generating icasadi Rust library file
[INFO] Defining CasADi functions and generating C code
[INFO] Defining function psi(u, xi, p) and its gradient
[INFO] Function psi and its gradient (C code)
[INFO] Defining function F1(u, p)
[INFO] Mapping F1 (C code)
[INFO] Defining function F2(u, p)
[INFO] Mapping F2 (C code)
[INFO] Generating casadi_memory.h
[INFO] Generating intercafe.c (C interface)
[INFO] Generating main code for target optimizer (lib.rs)
[INFO] Generating build.rs for target optimizer
[INFO] Generating YAML configuration file
[INFO] Building optimizer
Traceback (most recent call last):
File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\examples\merging_scenario_paper.py", line 129, in
vis.run()
File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\visualize.py", line 725, in run
pyglet.app.run()
File "C:\Users\pulom\anaconda3\lib\site-packages\pyglet\app_init_.py", line 107, in run
event_loop.run()
File "C:\Users\pulom\anaconda3\lib\site-packages\pyglet\app\base.py", line 167, in run
timeout = self.idle()
File "C:\Users\pulom\anaconda3\lib\site-packages\pyglet\app\base.py", line 237, in idle
redraw_all = self.clock.call_scheduled_functions(dt)
File "C:\Users\pulom\anaconda3\lib\site-packages\pyglet\clock.py", line 292, in call_scheduled_functions
item.func(now - item.last_ts, *item.args, **item.kwargs)
File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\visualize.py", line 304, in control_loop
vehicle.control(steer, gas)
File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\car.py", line 767, in control
self.initialize_solvers()
File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\car.py", line 747, in initialize_solvers
self.optimizer = lagrangiansolver.solver(self.id, self.players, self.shared_reward, self.g, self.h, self.v, self.lbv, self.ubv,
File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\lagrangiansolver.py", line 147, in init
self.solver = src.solvers.get_OpEn_solver(OpEn_problem, self.solver_settings, self.bounds, self.id)
File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\solvers.py", line 120, in get_OpEn_solver
build_OpEn_problem(OpEn_problem, solver_settings, optimizers_dir, id, id2, name)
File "C:\Users\pulom\Downloads\GPG-drive-master\GPG-drive-master\src\solvers.py", line 73, in build_OpEn_problem
builder.build()
File "C:\Users\pulom\anaconda3\lib\site-packages\opengen\builder\optimizer_builder.py", line 646, in build
self.__build_optimizer() # build overall project
File "C:\Users\pulom\anaconda3\lib\site-packages\opengen\builder\optimizer_builder.py", line 422, in __build_optimizer
p = subprocess.Popen(command, cwd=target_dir)
File "C:\Users\pulom\anaconda3\lib\subprocess.py", line 951, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\pulom\anaconda3\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

@mrayur
Copy link

mrayur commented Feb 25, 2025

I met the same problem when using desktop computer, but my laptop runs this repository successfully, I recall that the visual studio 2019 is pre-installed in my laptop, I am downloading the same version of visual studio in my desktop now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants