Bi-Directional Dictionary

3 views
Skip to first unread message

Martin Albrecht

unread,
Sep 17, 2010, 7:02:30 AM9/17/10
to Sage Development
Hi there,

I'm working on a C interface to SCIP

http://scip.zib.de

and for that I need a bi-directional dictionary, that is a dictionary where
you can query in both directions X->Y and Y->X. Of course, a simple
implementation is quickly done using two dictionaries but I was wondering:
since this is a general data structure, maybe someone else already implemented
it nicely in Sage under a different name? ... building the car instead of re-
implementing bi-directional dictionaries.

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinr...@jabber.ccc.de

Nils Bruin

unread,
Sep 17, 2010, 10:54:18 AM9/17/10
to sage-devel
This might do what you want (but it's not in sage as far as I know):

http://pypi.python.org/pypi/bidict/

Nathann Cohen

unread,
Sep 17, 2010, 1:07:21 PM9/17/10
to sage-devel
> Hi there,
>
> I'm working on a C interface to SCIP

Hello Martin !!!

When you say C interface to SCIP, are you talking about a Cython
interface ? Are you talking about an interface between SCIP and Sage ?
I have just been finishing a patch using constraint generation, and I
was thinking about changing a lot of things in the
MixedIntegerLinearProgram constraint... I wanted to build a Cython
class (a backend) for each solver (CPLEX, Coin, GLPK, gurobi perhaps
too), so that it may be possible to use them directly through C calls,
and perhaps having one "natural" way to work on constraint/variable
generation through Sage.

If you think what you are doing and what I am -- just planning -- may
overlap, perhaps we should discuss it ?.... :-)

Nathann

Martin Albrecht

unread,
Sep 17, 2010, 8:37:27 PM9/17/10
to sage-...@googlegroups.com
Hi Nathann,

> When you say C interface to SCIP, are you talking about a Cython
> interface ?

Indeed, a Cython interface to SCIP.

> Are you talking about an interface between SCIP and Sage ?

So far my interface supports:
- linear, XOR and AND constraints (SCIP is a constraint integer programming
solver, supporting many different kinds of constraints)
- parameter getting/setting ("limits/time" etc.)
- conversion from MixedIntegerLinearProgram
- conversion from MPolynomialSystem_gf2 (using AND and XOR or linear
constraints)
- returning all solutions not just the optimal solution

the interface so far is very SCIP-y insofar as it isn't very natural Sage
style: no operator overloading etc.

> I have just been finishing a patch using constraint generation, and I
> was thinking about changing a lot of things in the
> MixedIntegerLinearProgram constraint... I wanted to build a Cython
> class (a backend) for each solver (CPLEX, Coin, GLPK, gurobi perhaps
> too), so that it may be possible to use them directly through C calls,
> and perhaps having one "natural" way to work on constraint/variable
> generation through Sage.

I think that would be a good idea, since they all seem to have specialised
features. For instance, IIRC Harald told me that Gurobi allows to return those
constraints which conflict in an infeasible problem.

Reply all
Reply to author
Forward
0 new messages