Objective#

class amplpy.Objective#

Bases: Entity.

Represents an AMPL objective. Note that, in case of a scalar objective, all the properties (corresponding to AMPL suffixes) of the objective instance can be accessed through methods like value(). The methods have the same name of the corresponding AMPL suffixes. See http://www.ampl.com/NEW/suffbuiltin.html for a list of the available suffixes.

All these methods throw a TypeError if called for a non scalar objective and an RuntimeError if called on an entity which has been deleted in the underlying intepreter.

To gain access to all the values in an entity (for all instances and all suffixes for that entities), see get_values() and the DataFrame class.

astatus(self)#

Return the AMPL status.

drop(self)#

Drop this objective instance.

exitcode(self)#

Exit code returned by solver after most recent solve with this objective.

message(self)#

Result message returned by solver after most recent solve with this objective.

minimization(self)#

Get the sense of this objective. Returns True if minimize, False if maximize.

restore(self)#

Restore this objective (if it had been dropped, no effect otherwise).

result(self)#

Result string returned by solver after most recent solve with this objective.

sstatus(self)#

Return the solver status.

value(self)#

Get the value of the objective.