Skip to main content
FRAMES NO FRAMES

Class IloExtractable

Definition file: ilconcert/iloextractable.h
Map of IloExtractableIloExtractableIloConversionIloCumulFunctionExprIloIntervalSequenceVarIloIntervalVarIloModelIloNumExprArgIloObjectiveIloPiecewiseFunctionExprIloStateFunctionIloStateFunctionExprIloExtractable
Base class of all extractable objects.

This class is the base class of all extractable objects (that is, instances of such classes as IloConstraint, IloNumVar, and so forth). Instances of subclasses of this class represent objects (such as constraints, constrained variables, objectives, and so forth) that can be extracted by Concert Technology from your model for use by your application in Concert Technology algorithms.

Not every algorithm can extract every extractable object of a model. For example, a model may include more than one objective, but you can extract only one objective for an instance of IloCplex.

Most member functions in this class contain assert statements. For an explanation of the macro NDEBUG (a way to turn on or turn off these assert statements), see the concept Assert and NDEBUG.

Adding Extractable Objects

Generally, for an extractable object to be taken into account by one of the algorithms in Concert Technology, you must add the extractable object to a model with the member function IloModel::add and extract the model for the algorithm with the member function IloAlgorithm::extract.

Environment and Extractable Objects

Every extractable object in your model must belong to one instance of IloEnv. An extractable object (that is, an instance of IloExtractable or one of its derived subclasses) is tied throughout its lifetime to the environment where it is created. It can be used only with extractable objects belonging to the same environment. It can be extracted only for an algorithm attached to the same environment.

Notification

When you change an extractable object, for example by removing it from a model, Concert Technology notifies algorithms that have extracted the model containing this extractable object about the change. Member functions that carry out such notification are noted in this documentation.

See Also:

Method Summary
public IloConstraintasConstraint() const
public IloIntExprArgasIntExpr() const
public IloModelasModel() const
public IloNumExprArgasNumExpr() const
public IloObjectiveasObjective() const
public IloNumVarasVariable() const
public voidend()
public IloEnvgetEnv() const
public IloIntgetId() const
public IloExtractableI *getImpl() const
public const char *getName() const
public IloAnygetObject() const
public IloExtractable(IloExtractableI * obj=0)
public IloBoolisConstraint() const
public IloBoolisIntExpr() const
public IloBoolisModel() const
public IloBoolisNumExpr() const
public IloBoolisObjective() const
public IloBoolisVariable() const
public voidremoveFromAll()
public voidsetLocation(const char * fileName, int lineNumber) const
public voidsetName(const char * name) const
public voidsetObject(IloAny obj) const
Method Detail

IloExtractable

public IloExtractable(IloExtractableI * obj=0)

This constructor creates a handle to the implementation object.


asConstraint

public IloConstraint asConstraint() const

This method returns the given extractable as a constraint or a null pointer

See IloExtractableVisitor if you want to introspect an expression

See Also:


asIntExpr

public IloIntExprArg asIntExpr() const

This method returns the given extractable as an integer expression or a null pointer

See IloExtractableVisitor if you want to introspect an expression

See Also:


asModel

public IloModel asModel() const

This method returns the given extractable as a model or a null pointer

See IloExtractableVisitor if you want to introspect an expression

See Also:


asNumExpr

public IloNumExprArg asNumExpr() const

This method returns the given extractable as a floating expression or a null pointer

See IloExtractableVisitor if you want to introspect an expression

See Also:


asObjective

public IloObjective asObjective() const

This method returns the given extractable as an objective or a null pointer

See IloExtractableVisitor if you want to introspect an expression

See Also:


asVariable

public IloNumVar asVariable() const

This method returns the given extractable as a variable or a null pointer

See IloExtractableVisitor if you want to introspect an expression

See Also:


end

public void end()

This member function first removes the invoking extractable object from all other extractable objects where it is used (such as a model, ranges, etc.) and then deletes the invoking extractable object. That is, it frees all the resources used by the invoking object. After a call to this member function, you can not use the invoking extractable object again.

Note
The member function end notifies Concert Technology algorithms about the destruction of this invoking object.

getEnv

public IloEnv getEnv() const

This member function returns the environment to which the invoking extractable object belongs. An extractable object belongs to exactly one environment; different environments can not share the same extractable object.


getId

public IloInt getId() const

This member function returns the ID of the invoking extractable object.


getImpl

public IloExtractableI * getImpl() const

This member function returns a pointer to the implementation object of the invoking extractable object. This member function is useful when you need to be sure that you are using the same copy of the invoking extractable object in more than one situation.


getName

public const char * getName() const

This member function returns a character string specifying the name of the invoking object (if there is one).


getObject

public IloAny getObject() const

This member function returns the object associated with the invoking object (if there is one). Normally, an associated object contains user data pertinent to the invoking object.


isConstraint

public IloBool isConstraint() const

This method tells you whether or not the given extractable is a constraint or not

See IloExtractableVisitor if you want to introspect an expression

See Also:


isIntExpr

public IloBool isIntExpr() const

This method tells you whether or not the given extractable is an integer expression or not

See IloExtractableVisitor if you want to introspect an expression

See Also:


isModel

public IloBool isModel() const

This method tells you whether ot not the given extractable is a model or not

See IloExtractableVisitor if you want to introspect an expression

See Also:


isNumExpr

public IloBool isNumExpr() const

This method tells you whether or not the given extractable is a floating expression or not

See IloExtractableVisitor if you want to introspect an expression

See Also:


isObjective

public IloBool isObjective() const

This method tells you whether or not the given extractable is an objective or not

See IloExtractableVisitor if you want to introspect an expression

See Also:


isVariable

public IloBool isVariable() const

This method tells you whether or not the given extractable is a variable or not

See IloExtractableVisitor if you want to introspect an expression

See Also:


removeFromAll

public void removeFromAll()

This member function removes the invoking extractable object from all other extractable objects where it is used. However, unlike the member function end, the member function removeFromAll does not destroy the invoking object. That is, the invoking extractable object remains available for later re-use in the model.


setLocation

public void setLocation(const char * fileName, int lineNumber) const

This member function stores the source code location (as a file name and line number) in the invoking object. Recommended arguments are the macros __FILE__ and __LINE__. The supplied location can be used for debugging. In particular CP Optimizer may include the location in error messages and in model dumps.

Note that the string pointed to by fileName argument is not copied. Therefore the pointer must be valid during the whole lifespan of the object.

Instead of using this function directly, it may be simpler to use macros ILOSETLOCATION and ILOADD.


setName

public void setName(const char * name) const

This member function assigns name to the invoking object.

When called on an already extracted extractable, notifications will be sent to the engine. When possible, this method should be called before the model is extracted.


setObject

public void setObject(IloAny obj) const

This member function associates obj with the invoking object. The member function getObject accesses this associated object afterward. Normally, obj contains user data pertinent to the invoking object.