Changeset 2259


Ignore:
Timestamp:
Feb 4, 2010 10:58:44 AM (10 years ago)
Author:
wehart
Message:

Adding new termination conditions.

Fixing problem setting up testing utilities when YAML is not installed.

Location:
coopr.opt/trunk/coopr/opt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • coopr.opt/trunk/coopr/opt/results/solver.py

    r2257 r2259  
    3131    'locallyOptimal',       # Found a locally optimal solution
    3232    'optimal',              # Found an optimal solution
     33    'maxEvaluations',       # Exceeded maximum number of problem evaluations
    3334    # WARNING
    3435    'unbounded',            # Demonstrated that problem is unbounded
    3536    'infeasible',           # Demonstrated that the problem is infeasible
     37    'invalidProlem',        # The problem setup or characteristics are not valide for the solver
    3638    'other'                 # Other, uncategorized normal termination
    3739    # ERROR
  • coopr.opt/trunk/coopr/opt/testing/pyunit.py

    r2258 r2259  
    1919from StringIO import StringIO
    2020import math
    21 import yaml
     21try:
     22    import yaml
     23    using_yaml = True
     24except Exception:
     25    using_yaml = False
    2226
    2327
     
    6670   
    6771def compare_results(output_, baseline_, tolerance=1e-6):
     72    if not using_yaml:
     73        raise ValueError, "Cannot compare results without a YAML parser"
    6874    options = copy.copy(SolverResults.default_print_options)
    6975    options.ignore_defaults=True
     
    126132
    127133    def failIfCooprResultsDiffer(self, cmd, baseline, cwd=None):
     134        if not using_yaml:
     135            self.fail("Cannot compare Coopr results because PyYaml is not installed")
    128136        _failIfCooprresultsDiffer(self, cmd=cmd, baseline=baseline, cwd=cwd)
    129137
    130138    def add_coopr_results_test(name=None, cmd=None, fn=None, baseline=None):
     139        if not using_yaml:
     140            return
    131141        if cmd is None and fn is None:
    132142            print "ERROR: must specify either the 'cmd' or 'fn' option to define how the output file is generated"
Note: See TracChangeset for help on using the changeset viewer.