Changeset 3081


Ignore:
Timestamp:
Oct 11, 2010 10:20:45 PM (11 years ago)
Author:
wehart
Message:

Adding logic to allow ASL solverss to be specified as:

--solver=asl:PICO

Misc bug fix in AMPL writer.

Location:
coopr.pyomo/trunk/coopr/pyomo
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • coopr.pyomo/trunk/coopr/pyomo/io/ampl.py

    r2882 r3081  
    464464            if isinstance(var.domain, BooleanSet):
    465465                print >>OUTPUT, "0 0 1",
    466                 print >>OUTPUT, " # v"+str(var_id[ndx])+"  "+vv.label
    467                 symbol_map["v"+str(var_id[ndx])] = vv.label
     466                print >>OUTPUT, " # v"+str(vv.ampl_var_id)+"  "+vv.label
     467                symbol_map["v"+str(vv.ampl_var_id)] = vv.label
    468468                continue
    469469            L = vv.lb
  • coopr.pyomo/trunk/coopr/pyomo/scripting/pyomo.py

    r3000 r3081  
    9999        action='store',
    100100        dest='solver',
    101         type='choice',
    102         choices=solver_list,
     101        type='string',
     102        #choices=solver_list,
    103103        default='glpk')
    104104    solverOpts.add_option('--solver-manager',
  • coopr.pyomo/trunk/coopr/pyomo/scripting/util.py

    r2930 r3081  
    254254    # is not assumed to be required by all solvers?
    255255    #
    256     if hasattr(options, 'solver') and options.solver == "asl":
     256    if hasattr(options, 'solver') and options.solver.startswith('asl'):
    257257        model.skip_canonical_repn = True
    258258   
     
    370370        solver, subsolver = solver.split(':')
    371371    opt = SolverFactory( solver )
     372    if opt is None:
     373        solver_list = SolverFactory.services()
     374        solver_list = sorted( filter(lambda x: '_' != x[0], solver_list) )
     375        raise ValueError, "Problem constructing solver `"+str(solver)+"' (choose from: %s)" % ", ".join(solver_list)
    372376
    373377    # let the model know of our chosen solver's capabilities
    374378    instance.has_capability = opt.has_capability
    375379
    376     if opt is None:
    377        raise ValueError, "Problem constructing solver `"+str(solver)+"'"
    378380    opt.keepFiles=options.keepfiles or options.log
    379381    if options.timelimit == 0:
     
    403405        raise ValueError, msg % str( options.smanager_type )
    404406
    405     results = solver_mngr.solve(
    406         instance, opt=opt, tee=options.tee, timelimit=options.timelimit )
     407    results = solver_mngr.solve( instance, opt=opt, tee=options.tee, timelimit=options.timelimit )
    407408
    408409    if results == None:
Note: See TracChangeset for help on using the changeset viewer.