# Objective Class¶

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 corresponding properties on the Objective itself. The properties have the same name of the corresponding AMPL suffixes. See http://www.ampl.com/NEW/suffbuiltin.html for a list of the available suffixes. An ArgumentException is thrown if one of such methods is called for a non-scalar objective. An ArgumentOutOfRangeException is thrown if any property of an entity which has been deleted from the underlying interpreter is accessed. The instances, represented by the class ampl.ObjectiveInstance can be accessed via the indexing operator, via the method ampl.Entities.Objective.Get or via the iterator provided. To gain access to all the values in an entity (for all instances and all suffixes for that entities), see ampl.Entities.Entity.GetValues and the ampl.DataFrame class.

Namespace
ampl.Entities
Assemblies
• AMPL

## Syntax¶

public class Objective : Entity<ObjectiveInstance>, IEnumerable<ObjectiveInstance>, IEnumerable

class ampl.Entities.Objective

## Properties¶

Astatus()

Return the AMPL status

Return type: System.String
public string Astatus { get; }

ExitCode()

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

Return type: System.Int32
public int ExitCode { get; }

IsMinimization()

Get the sense of this objective, true if minimization, false if maximization

Return type: System.Boolean
public bool IsMinimization { get; }

Message()

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

Return type: System.String
public string Message { get; }

Result()

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

Return type: System.String
public string Result { get; }

Sstatus()

Return the solver status

Return type: System.String
public string Sstatus { get; }

Value()

Get the value of this objective

Return type: System.Double
public double Value { get; }


## Methods¶

Drop()

Drop this objective

public void Drop()

Get(System.Object[])
Return type: ampl.ObjectiveInstance
public ObjectiveInstance Get(params object[] index)

Get(ampl.Tuple)
Return type: ampl.ObjectiveInstance
public override ObjectiveInstance Get(Tuple t = null)

GetEnumerator()
Return type: System.Collections.Generic.IEnumerator{ampl.ObjectiveInstance}
public override IEnumerator<ObjectiveInstance> GetEnumerator()

Restore()

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

public void Restore()