Skip to content
Snippets Groups Projects
Commit d2bf339d authored by Krishna Krishna Nikhil's avatar Krishna Krishna Nikhil
Browse files

Update 2 optimizer.py

parent fa0c217b
Branches
No related tags found
No related merge requests found
......@@ -72,7 +72,7 @@ class Optimizer(object):
total_length_loss = torch.mean(100.*torch.nn.ReLU()(detector_length - self.constraints['length'])**2)#constrain it to 25cm
if 'lower' in self.constraints:
lbound = (torch.ones(12) * self.constraints['lower']).to(self.device)
lower_loss = torch.mean(1000.*torch.nn.ReLU()(lbound- raw_detector_parameters)**2)
lower_loss = torch.mean(100.*torch.nn.ReLU()(lbound- raw_detector_parameters)**2)
if 'upper' in self.constraints:
ubound = (torch.ones(6) * self.constraints['upper']).to(self.device)
upper_loss = torch.mean(100.*torch.nn.ReLU()(material_parameters - ubound)**2)
......@@ -114,8 +114,7 @@ class Optimizer(object):
return total_length_loss +lower_loss + upper_loss + diff_loss + cost_loss
def clamp_parameters(self):
return
self.detector_parameters = self.detector_parameters.clamp(1e-3) #DEBUG, NE
self.detector_parameters.data = self.detector_parameters.data.clamp(1e-3) #DEBUG, NE
def adjust_generator_covariance(self, direction, min_scale=2.0):
#stretches the box_covariance of the generator in the directon specified as input
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment