Dip 0.95.0
Loading...
Searching...
No Matches
Functions
DippyPythonUtils.h File Reference
#include "Python.h"
#include "Decomp.h"
#include "DecompAlgo.h"
#include <map>
#include <vector>
+ Include dependency graph for DippyPythonUtils.h:

Go to the source code of this file.

Functions

PyObject * pyTupleList_FromDoubleArray (const double *values, PyObject *pList)
 Convert a double array to a Python tuple list.
 
PyObject * pyTupleList_FromNode (DecompAlgo *algo, DecompStatus decompStatus)
 Package a AlpsDecompTreeNode using a DecompAlgo into a Python list.
 
void pyColDict_AsPairedVector (PyObject *pColDict, vector< pair< int, double > > &vector, map< PyObject *, int > indices)
 Convert a column dictionary to a (int, double) vector.
 
int pyColDict_AsPackedArrays (PyObject *pColDict, map< PyObject *, int > indices, int **inds, double **vals)
 Convert a column dictionary to packed arrays.
 
int pyColDict_AsPackedArrays (PyObject *pColDict, map< PyObject *, int > indices, int **inds, double **vals, DecompVarType &varType)
 
CoinPackedMatrixpyConstraints_AsPackedMatrix (PyObject *pRowList, map< PyObject *, int > rowIndices, map< PyObject *, int > colIndices)
 Convert a list of Python constraints to a CoinPackedMatrix.
 
void addTupleToPyList (PyObject *pList, PyObject *key, PyObject *value)
 Creates a (key,value) tuple and appends to a Python list of tuples *.
 
void insertTupleToPyList (PyObject *pList, unsigned position, PyObject *key, PyObject *value)
 Creates a (key,value) tuple and inserts in a Python list of tuples *.
 

Function Documentation

◆ pyTupleList_FromDoubleArray()

PyObject * pyTupleList_FromDoubleArray ( const double * values,
PyObject * pList )

Convert a double array to a Python tuple list.

The list is (Python object, value) tuples

Returns Python tuple list with length = pList length

◆ pyTupleList_FromNode()

PyObject * pyTupleList_FromNode ( DecompAlgo * algo,
DecompStatus decompStatus )

Package a AlpsDecompTreeNode using a DecompAlgo into a Python list.

The list is (Python object, value) tuples

Returns Python tuple list

◆ pyColDict_AsPairedVector()

void pyColDict_AsPairedVector ( PyObject * pColDict,
vector< pair< int, double > > & vector,
map< PyObject *, int > indices )

Convert a column dictionary to a (int, double) vector.

The dictionary has columns as keys and coefficients as values

◆ pyColDict_AsPackedArrays() [1/2]

int pyColDict_AsPackedArrays ( PyObject * pColDict,
map< PyObject *, int > indices,
int ** inds,
double ** vals )

Convert a column dictionary to packed arrays.

The dictionary has columns as keys and coefficients as values

Returns length of index and value arrays

◆ pyColDict_AsPackedArrays() [2/2]

int pyColDict_AsPackedArrays ( PyObject * pColDict,
map< PyObject *, int > indices,
int ** inds,
double ** vals,
DecompVarType & varType )

◆ pyConstraints_AsPackedMatrix()

CoinPackedMatrix * pyConstraints_AsPackedMatrix ( PyObject * pRowList,
map< PyObject *, int > rowIndices,
map< PyObject *, int > colIndices )

Convert a list of Python constraints to a CoinPackedMatrix.

The format of each constraint is as a dictionary with variables as keys and coefficients as values

◆ addTupleToPyList()

void addTupleToPyList ( PyObject * pList,
PyObject * key,
PyObject * value )

Creates a (key,value) tuple and appends to a Python list of tuples *.

◆ insertTupleToPyList()

void insertTupleToPyList ( PyObject * pList,
unsigned position,
PyObject * key,
PyObject * value )

Creates a (key,value) tuple and inserts in a Python list of tuples *.