GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bug fixes · cbfinn/gps@9192ffd

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • python/gps
    • algorithm
      • algorithm.py
    • gui
      • config.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎python/gps/algorithm/algorithm.py‎

Copy file name to clipboardExpand all lines: python/gps/algorithm/algorithm.py
+10-4Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,16 @@ def __init__(self, hyperparams):
6262
self.traj_opt = hyperparams['traj_opt']['type'](
6363
hyperparams['traj_opt']
6464
)
65-
self.cost = [
66-
hyperparams['cost']['type'](hyperparams['cost'])
67-
for _ in range(self.M)
68-
]
65+
if type(hyperparams['cost']) == list:
66+
self.cost = [
67+
hyperparams['cost'][i]['type'](hyperparams['cost'][i])
68+
for i in range(self.M)
69+
]
70+
else:
71+
self.cost = [
72+
hyperparams['cost']['type'](hyperparams['cost'])
73+
for _ in range(self.M)
74+
]
6975
self.base_kl_step = self._hyperparams['kl_step']
7076

7177
@abc.abstractmethod
Collapse file

‎python/gps/gui/config.py‎

Copy file name to clipboardExpand all lines: python/gps/gui/config.py
+12-4Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,18 @@ def generate_experiment_info(config):
116116
common = config['common']
117117
algorithm = config['algorithm']
118118

119-
algorithm_cost_type = algorithm['cost']['type'].__name__
120-
if (algorithm_cost_type) == 'CostSum':
121-
algorithm_cost_type += '(%s)' % ', '.join(
122-
map(lambda cost: cost['type'].__name__, algorithm['cost']['costs']))
119+
if type(algorithm['cost']) == list:
120+
algorithm_cost_type = algorithm['cost'][0]['type'].__name__
121+
if (algorithm_cost_type) == 'CostSum':
122+
algorithm_cost_type += '(%s)' % ', '.join(
123+
map(lambda cost: cost['type'].__name__,
124+
algorithm['cost'][0]['costs']))
125+
else:
126+
algorithm_cost_type = algorithm['cost']['type'].__name__
127+
if (algorithm_cost_type) == 'CostSum':
128+
algorithm_cost_type += '(%s)' % ', '.join(
129+
map(lambda cost: cost['type'].__name__,
130+
algorithm['cost']['costs']))
123131
return (
124132
'exp_name: ' + str(common['experiment_name']) + '\n' +
125133
'alg_type: ' + str(algorithm['type'].__name__) + '\n' +

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.