GeminiLight / virne

Virne is a simulator for resource allocation problems in network virtualization, mainly for virtual network embedding (VNE). It also is adaptable to VNE's variants, such as service function chain deployment (SFC Deployment), network slicing, etc.
https://virne.readthedocs.io
Apache License 2.0
100 stars 19 forks source link

关于learning类型的solver的环境设置 #7

Closed ychga closed 1 year ago

ychga commented 1 year ago

您好,我尝试在main.py中运行一些learning类型的solver,发现pg_cnn,pg_cnn2,pg_mlp会因为使用了它们对应的SubEnv而导致如下报错: image

似乎是因为使用它们时,程序都会在virne\base\scenario.py", line 52处: env = Env(p_net, v_net_simulator, controller, recorder, counter, **vars(config)) 将一个VirtualNetworkRequestSimulator类实例v_net_simulator传递给各自对应的SubEnv.init(),但它应该是接收VirtualNetwork类实例。

而使用a3c_gcn_seq2seq和pg_seq2seq两个solver时不会出现上述BUG,因为solver_info中指出了这两个solver直接使用了base.environment.SolutionStepEnvironment,而不是它们目录下的SubEnv。这是我打印的一些solver_info信息: {'solver': <class 'solver.learning.pg_cnn.pg_cnn_solver.PgCnnSolver'>, 'env': <class 'solver.learning.pg_cnn.sub_env.SubEnv'>, 'type': 'r_learning'} {'solver': <class 'solver.learning.pg_cnn2.solver.PgCnn2Solver'>, 'env': <class 'solver.learning.pg_cnn2.sub_env.SubEnv'>, 'type': 'r_learning'} {'solver': <class 'solver.learning.a3c_gcn_seq2seq.solver.A3CGcnSeq2SeqSolver'>, 'env': <class 'base.environment.SolutionStepEnvironment'>, 'type': 'r_learning'}

请问这个bug如何解决?是否是因为solver.REGISTRY注册了旧的环境设置?谢谢!

GeminiLight commented 1 year ago

Thanks for your feedback. The OnlineLevelEnvironment should be used to register the solvers rather than the InstanceLevelEnv. I will fix this bug.

GeminiLight commented 1 year ago

The bug has been fixed. Thanks.

ychga commented 1 year ago

The bug has been fixed. Thanks.

Thank you