|
|
Trees | Indices | Help |
|
|---|
| Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
| Class Variables | |
|
Inherited from |
| Method Details |
Creates a new DoubleAnnotationInterface. The double annotation interface is exposed by the top-level Cplex class as Cplex.double_annotations. This constructor is not meant to be used externally.
|
Returns the number of double annotations in the problem. Example usage: >>> import cplex >>> c = cplex.Cplex() >>> c.double_annotations.get_num() 0 >>> idx = c.double_annotations.add('ann1', 0.0) >>> c.double_annotations.get_num() 1 |
Adds an annotation to the problem. name: the name of the annotation. defval: the default value for annotation objects. Returns the index of the added annotation. Example usage: >>> import cplex >>> c = cplex.Cplex() >>> idx = c.double_annotations.add(name='ann1', defval=0.0) >>> c.double_annotations.get_num() 1 |
Deletes double annotations from the problem. There are four forms by which double_annotations.delete may be called.
See CPXdeldblannotations in the Callable Library Reference Manual for more detail. Example usage: >>> import cplex >>> c = cplex.Cplex() >>> idx = c.double_annotations.add('ann1', 0.0) >>> c.double_annotations.get_num() 1 >>> c.double_annotations.delete(idx) >>> c.double_annotations.get_num() 0 |
Returns the names of a set of double annotations. May be called by four forms.
Example usage: >>> import cplex >>> c = cplex.Cplex() >>> [c.double_annotations.add('ann{0}'.format(i), i) ... for i in range(1, 6)] [0, 1, 2, 3, 4] >>> c.double_annotations.get_names() ['ann1', 'ann2', 'ann3', 'ann4', 'ann5'] >>> c.double_annotations.get_names(0) 'ann1' >>> c.double_annotations.get_names([0, 2, 4]) ['ann1', 'ann3', 'ann5'] >>> c.double_annotations.get_names(1, 3) ['ann2', 'ann3', 'ann4'] |
Returns the default value of a set of double annotations. May be called by four forms.
Example usage: >>> import cplex >>> c = cplex.Cplex() >>> idx1 = c.double_annotations.add(name='ann1', defval=0.0) >>> idx2 = c.double_annotations.add(name='ann2', defval=1.0) >>> c.double_annotations.get_default_values() [0.0, 1.0] |
Sets the values for objects in the specified double annotation. idx: the double annotation index or name. objtype: the annotation object type. Can be called by two forms:
Example usage: >>> import cplex >>> c = cplex.Cplex() >>> idx = c.double_annotations.add('ann1', 0.0) >>> objtype = c.double_annotations.object_type.objective >>> c.double_annotations.set_values(idx, objtype, 0, 1.0) >>> c.double_annotations.get_values(idx, objtype, 0) 1.0 >>> indices = c.variables.add(names=['v1', 'v2', 'v3']) >>> objtype = c.double_annotations.object_type.variable >>> c.double_annotations.set_values(idx, objtype, ... [(i, 1.0) for i in indices]) >>> c.double_annotations.get_values(idx, objtype) [1.0, 1.0, 1.0] |
Returns the double annotation values for the specified objects. idx: the double annotation index or name. objtype: the annotation object type. Can be called by four forms:
Example usage: >>> import cplex >>> c = cplex.Cplex() >>> idx = c.double_annotations.add('ann1', 0.0) >>> objtype = c.double_annotations.object_type.objective >>> c.double_annotations.set_values(idx, objtype, 0, 1.0) >>> c.double_annotations.get_values(idx, objtype, 0) 1.0 >>> indices = c.variables.add(names=['v1', 'v2', 'v3']) >>> objtype = c.double_annotations.object_type.variable >>> c.double_annotations.set_values(idx, objtype, ... [(i, 1.0) for i in indices]) >>> c.double_annotations.get_values(idx, objtype, list(indices)) [1.0, 1.0, 1.0] |
|
|
Trees | Indices | Help |
|
|---|