# Objective¶

class amplpy.Objective(_impl)

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 getValues() and the DataFrame class.

__init__(_impl)
value()

Get the value of the objective.

astatus()

Return the AMPL status.

sstatus()

Return the solver status.

exitcode()

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

message()

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

result()

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

drop()

Drop this objective instance.

restore()

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

minimization()

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

__module__ = 'amplpy.objective'