-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Found this when I was playing with the skeleton of 'SyntheticModel'
In [31]: run robust/synthetic_model/synthetic_model.py
nominal cost = 3.356158
box uncertainty using Simple Conservative formulation:
cost : 3.904778
relative cost : 1.16346667827
number of constraints : 7
setup time : 0.171999931335
solve time : 0.0460000038147
elliptical uncertainty using Simple Conservative formulation:
cost : 3.904778
relative cost : 1.16346667827
number of constraints : 7
setup time : 0.161999940872
solve time : 0.0520000457764
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\synthetic_model\synthetic_model.py in <module>()
46 method_names[method_name]['boyd'],
47 method_names[method_name]['simpleModel'],
---> 48 uncertainty_set)
49 print_robust_results(robust_model, robust_model_solution, nominal_solution, method_name)
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\synthetic_model\synthetic_model.py in robustify_synthetic_model(the_model, is_two_term, is_boyd, is_simple_model, the_uncertainty_set, the_min_number_of_linear_sections, the_max_number_of_linear_sections, the_verbosity, the_linearization_tolerance)
16 linearizationTolerance=the_linearization_tolerance,
17 minNumOfLinearSections=the_min_number_of_linear_sections,
---> 18 maxNumOfLinearSections=the_max_number_of_linear_sections)
19 return the_robust_model, the_robust_model_solution
20
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\robust.py in robustsolve(self, verbosity, **options)
233 def robustsolve(self, verbosity=1, **options):
234 if self._robust_model is None:
--> 235 self.setup(verbosity, **options)
236 try:
237 sol = self._robust_model.solve(verbosity=verbosity)
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\robust.py in setup(self, verbosity, **options)
180 large_posynomials = self.large_gp_posynomials + large_sp_posynomials
181
--> 182 permutation_indices = self.new_permutation_indices(old_solution, large_posynomials)
183
184 two_term_data_posynomials = []
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\robust.py in new_permutation_indices(self, solution, large_posynomials)
446 permutation_indices = []
447 for two_term_approximation in large_posynomials:
--> 448 permutation_indices.append(self.find_permutation_with_minimum_value(two_term_approximation, solution))
449 return permutation_indices
450
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\robust.py in find_permutation_with_minimum_value(self, two_term_approximation, solution)
365 for i in range(len(two_term_approximation.list_of_permutations)):
366 temp_value = self. \
--> 367 calculate_value_of_two_term_approximated_posynomial(two_term_approximation, i, solution)
368 if temp_value < minimum_value:
369 minimum_value = temp_value
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\robust.py in calculate_value_of_two_term_approximated_posynomial(self, two_term_approximation, index_of_permutation, solution)
333 values = []
334
--> 335 mons = two_term_approximation.chop()
336
337 for i in range(number_of_two_terms):
AttributeError: 'TwoTermApproximation' object has no attribute 'chop'
In [32]: run robust/synthetic_model/synthetic_model.py
nominal cost = 3.356158
box uncertainty using Simple Conservative formulation:
cost : 3.904778
relative cost : 1.16346667827
number of constraints : 7
setup time : 0.203999996185
solve time : 0.0469999313354
elliptical uncertainty using Simple Conservative formulation:
cost : 3.904778
relative cost : 1.16346667827
number of constraints : 7
setup time : 0.204999923706
solve time : 0.0510001182556
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\synthetic_model\synthetic_model.py in <module>()
46 method_names[method_name]['boyd'],
47 method_names[method_name]['simpleModel'],
---> 48 uncertainty_set)
49 print_robust_results(robust_model, robust_model_solution, nominal_solution, method_name)
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\synthetic_model\synthetic_model.py in robustify_synthetic_model(the_model, is_two_term, is_boyd, is_simple_model, the_uncertainty_set, the_min_number_of_linear_sections, the_max_number_of_linear_sections, the_verbosity, the_linearization_tolerance)
16 linearizationTolerance=the_linearization_tolerance,
17 minNumOfLinearSections=the_min_number_of_linear_sections,
---> 18 maxNumOfLinearSections=the_max_number_of_linear_sections)
19 return the_robust_model, the_robust_model_solution
20
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\robust.py in robustsolve(self, verbosity, **options)
233 def robustsolve(self, verbosity=1, **options):
234 if self._robust_model is None:
--> 235 self.setup(verbosity, **options)
236 try:
237 sol = self._robust_model.solve(verbosity=verbosity)
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\robust.py in setup(self, verbosity, **options)
180 large_posynomials = self.large_gp_posynomials + large_sp_posynomials
181
--> 182 permutation_indices = self.new_permutation_indices(old_solution, large_posynomials)
183
184 two_term_data_posynomials = []
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\robust.py in new_permutation_indices(self, solution, large_posynomials)
446 def new_permutation_indices(self, solution, large_posynomials):
447 permutation_indices = []
--> 448 for two_term_approximation in large_posynomials:
449 permutation_indices.append(self.find_permutation_with_minimum_value(two_term_approximation, solution))
450 return permutation_indices
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\robust.py in find_permutation_with_minimum_value(self, two_term_approximation, solution)
365 minimum_index = len(two_term_approximation.list_of_permutations)
366 for i in range(len(two_term_approximation.list_of_permutations)):
--> 367 temp_value = self. \
368 calculate_value_of_two_term_approximated_posynomial(two_term_approximation, i, solution)
369 if temp_value < minimum_value:
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\robust.py in calculate_value_of_two_term_approximated_posynomial(self, two_term_approximation, index_of_permutation, solution)
333 values = []
334
--> 335 print two_term_approximation
336 mons = two_term_approximation.chop()
337
AttributeError: 'TwoTermApproximation' object has no attribute 'chop'
In [33]: quit()
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust>cd robust
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust>cd synthetic_model
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\synthetic_model>ipython2
Python 2.7.13 |Anaconda 2.4.1 (64-bit)| (default, May 11 2017, 13:17:26) [MSC v.1500 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.
IPython 4.0.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: run synthetic_model.py
File "c:\users\berk\dropbox (mit)\mit graduate school\code\robust\robust\robust.py", line 335
print two_term_approximation
^
SyntaxError: invalid syntax
In [2]: run synthetic_model.py
nominal cost = 3.356158
box uncertainty using Simple Conservative formulation:
cost : 3.904778
relative cost : 1.16346667827
number of constraints : 7
setup time : 0.18700003624
solve time : 0.0629999637604
elliptical uncertainty using Simple Conservative formulation:
cost : 3.904778
relative cost : 1.16346667827
number of constraints : 7
setup time : 0.171999931335
solve time : 0.0620000362396
TwoTermApproximation(a*x + a^-1*x + a^-2*x^2 + a^3*x^1.3)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\synthetic_model\synthetic_model.py in <module>()
46 method_names[method_name]['boyd'],
47 method_names[method_name]['simpleModel'],
---> 48 uncertainty_set)
49 print_robust_results(robust_model, robust_model_solution, nominal_solution, method_name)
C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\Code\robust\robust\synthetic_model\synthetic_model.py in robustify_synthetic_model(the_model, is_two_term, is_boyd, is_simple_model, the_uncertainty_set, the_min_number_of_linear_sections, the_max_number_of_linear_sections, the_verbosity, the_linearization_tolerance)
16 linearizationTolerance=the_linearization_tolerance,
17 minNumOfLinearSections=the_min_number_of_linear_sections,
---> 18 maxNumOfLinearSections=the_max_number_of_linear_sections)
19 return the_robust_model, the_robust_model_solution
20
c:\users\berk\dropbox (mit)\mit graduate school\code\robust\robust\robust.py in robustsolve(self, verbosity, **options)
233 def robustsolve(self, verbosity=1, **options):
234 if self._robust_model is None:
--> 235 self.setup(verbosity, **options)
236 try:
237 sol = self._robust_model.solve(verbosity=verbosity)
c:\users\berk\dropbox (mit)\mit graduate school\code\robust\robust\robust.py in setup(self, verbosity, **options)
180 large_posynomials = self.large_gp_posynomials + large_sp_posynomials
181
--> 182 permutation_indices = self.new_permutation_indices(old_solution, large_posynomials)
183
184 two_term_data_posynomials = []
c:\users\berk\dropbox (mit)\mit graduate school\code\robust\robust\robust.py in new_permutation_indices(self, solution, large_posynomials)
447 permutation_indices = []
448 for two_term_approximation in large_posynomials:
--> 449 permutation_indices.append(self.find_permutation_with_minimum_value(two_term_approximation, solution))
450 return permutation_indices
451
c:\users\berk\dropbox (mit)\mit graduate school\code\robust\robust\robust.py in find_permutation_with_minimum_value(self, two_term_approximation, solution)
366 for i in range(len(two_term_approximation.list_of_permutations)):
367 temp_value = self. \
--> 368 calculate_value_of_two_term_approximated_posynomial(two_term_approximation, i, solution)
369 if temp_value < minimum_value:
370 minimum_value = temp_value
c:\users\berk\dropbox (mit)\mit graduate school\code\robust\robust\robust.py in calculate_value_of_two_term_approximated_posynomial(self, two_term_approximation, index_of_permutation, solution)
334
335 print(two_term_approximation)
--> 336 mons = two_term_approximation.chop()
337
338 for i in range(number_of_two_terms):
AttributeError: 'TwoTermApproximation' object has no attribute 'chop'
Metadata
Metadata
Assignees
Labels
No labels