ECLiPSe Programming FAQ 0.5

Frequently asked Questions about programming in the ECLiPSe Constraint Logic Programming Sustem (under construction)

FAQ Revised: Tuesday 01 April 2008 18:38:31


Table of Contents

1. General
2. License
3. ECLiPSe
4. tkeclipse
5. General programming
6. Loops and conditionals
7. Constraints
8. Search
9. Output
10. Error messages
11. Debugging
12. Visualisation
13. ic library
14. eplex library
15. SBDS library
16. Embedding and Interfacing

1. General

1.1. What is this FAQ about?

Programming in the ECLiPSe Constraint Logic Programming System

1.2. What is the ECLiPSe Constraint Logic Programming System?

ECLiPSe is a software system for the development and deployment of constraint programming and Constraint logic programming applications. It contains several constraint solver libraries, a high-level modelling and control language, interfaces to third-party solvers, a development environment and interfaces for embedding into host environments.

1.3. Is that the Eclipse development environment originated from IBM?

No, that's the open-source ECLiPSe CLP system; originated from ECRC in Germany; there is no link between the two. [note however that Saros, a plug-in for the Eclipse development platform, provides an IDE for ECLiPSe CLP platform, is now available]

1.4. Who is this FAQ for?

ECLiPSe programmers who have some experience of Prolog and constraint logic programming. For background, see the book "Programming with Constraints: An Introduction" by K. Marriott and P. J. Stuckey (MIT Press, 1998), and the book "Constraint Logic Programming using ECLiPSe" by K. P. Apt and M. Wallace (Cambridge University Press, 2006).

1.5. Who contributed to this FAQ?

This FAQ was started and originally maintained by Karen E. Petrie and Neil Yorke-Smith, with contributions from Christian Cleber Masdeval Braz, Warwick Harvey, Joachim Schimpf, Kish Shen, before ECLiPSe was made open-source.

1.6. Why haven't you answered...?

We welcome submission of FAQ items that should be included.


2. License

2.1. What is the license for ECLiPSe?

ECLiPSe is licensed under the Cisco-style Mozilla Public License 1.1.

This license is based on the Mozilla Public License 1.1. The main change is that "Cisco" replaces "Mozilla" and "Netscape".

This is an open-source license, meaning that the source, as well as the binaries, is available for download without cost. There is also no restrictions on use.

2.2. Can I get hold of older versions of ECLiPSe, before the open-sourcing?

No, unless you already have a license for these older versions of ECLiPSe.

Before ECLiPSe was open-sourced (version 5.9 and earlier), it was available in binary form under the ECLiPSe academic license, issued by IC-Parc. The terms of this license still applies, but as IC-Parc no longer exists, new licenses under these terms can no longer be issued. Note also that sources for ECLiPSe are not available under this license.


3. ECLiPSe

3.1. Where can I obtain ECLiPSe?

ECLiPSe is open-source, and can be downloaded in source and binary forms from ECLiPSe's Source Forge project page (http://sourceforge.net/projects/eclipse-clp), and from ECLiPSe's web site (http://www.eclipse-clp.org).

3.2. What platforms does ECLiPSe run on?

The current version of ECLiPSe is regularly built and tested on x86 Linux, Sparc Solaris, 32-bit x86 Windows, and x86-64 (also known as AMD64 and Intel 64) Linux; it is also built less frequently on MacOS X (Intel and PPC), and the binaries can be downloaded from Source Forge.

You can also compile the source yourself. In addition to the distributed binaries, the ECLiPSe source should compile `out-of-the-box' for several platforms that it was built on in the recent past, e.g. x86 Solaris and Alpha Linux. In addition, it should be possible to compile ECLiPSe on most Unix(like) platforms (32 and 64 bits) with a little effort, although you would probably need some knowledge about Unix application development to do this. More details for compiling ECLiPSe can be found in the Setup guide, which is included in the source distribution (in documents/internals subdirectory).

3.3. Where can I find documentation?

If you have ECLiPSe installed, start tkeclipse, and from the Help menu select Full Documentation (in command line eclipse, type "help."). You can also access online versions of the documentation.

3.4. Where can I find sample code?

  • In the ECLiPSe tutorial.
  • On the ECLiPSe web site.
  • In your ECLiPSe installation: in [ECLiPSeDir]/doc/examples (general examples), and in [ECLiPSeDir]/lib_tcl (various examples of using the Tcl embedding).


3.5. How do I write an ECLiPSe program?

You need to use an editor to write your programs. You can either use your own favourite text editor, or you can use the Saros IDE for ECLiPSe, which comes with an editor.

You can use any editor that can save plain text files. However, special support for ECLiPSe (e.g. syntax highlighting) is provided for some editors, e.g. emacs and vi. Save your program as a plain text file, and you can then compile the program into ECLiPSe and run it.

For more instructions on how to get started with ECLiPSe, including how to run programs, please see the first chapters of the User Manual.

With tkeclipse, you can specify the editor you want to use, and this editor will be started by tkeclipse, e.g. when you select a file in the "Edit" option under the File menu. The default values are the value of the VISUAL environment variable under Unix, or Wordpad under Windows. This can be changed with the Preference Editor under the Tools menu.

In tkeclipse, if you just want to test out some small amount of code, you can use the `Compile scratch-pad' tool, instead of an editor. In eclipse, you can type in "[user]." as a query, and eclipse will compile what you type next as ECLiPSe code. In both cases, however, you cannot save your code.

3.6. Is there an IDE for ECLiPSe?

Yes, Saros, a plug-in for the Eclipse development platform originally from IBM, that provides an IDE for ECLiPSe, is now available as a prototype, and can be downloaded.

In addition. tkeclipse provides some of the features of an IDE, but a separate programming editor is recommended; for instance, emacs.

A package containing extra support for several text editors is available on ECLiPSe's SourceForge download page.

3.7. Does ECLiPSe run standard Prolog code?

Yes, ECLiPSe is largely compatible with standard Prolog, and in addition, has libraries which provide almost full compliance with ISO Prolog and other Prolog dialects, such as SICStus Prolog, on a per-module basis. ECLiPSe implements some extensions (primarily to support constraints and program-in-the-large, but also others too), which are documented in chapter 5 of the User Manual.

3.8. What does this predicate do?

There are three ways of finding out:

  • In eclipse, type "help(foo)." (if the predicate you want help on has foo as part of its name)
  • In tkeclipse, use the online help: from the Tools menu select ECLiPSe Library Browser and Help. In the left panel of the Help Browser, you see all the libraries; double-click any one to expand it. In the right panel, you see information about a specific predicate: either the one you select in the left panel. You can search for a predicate by name or partial name by typing in the search box in the right panel.
  • In your web browser, open the HTML documentation you installed with ECLiPSe, and look in the Reference Manual. You can do this automatically from tkeclipse selecting Full Documentation by from the Help menu. Otherwise, to see where it's installed, open the Help Browser as above. The location of HTML documentation is given at the bottom of the window.


3.9. Where can I find an alphabetical list of predicates?

In the reference manual. If you open the HTML documentation installed with ECLiPSe, you will find a link to "Alphabetical Predicate Index".

3.10. I'm still stuck. Where can I find more help?



3.11. I've found a bug in ECLiPSe!

It does happen! First, though, check your code carefully. If it is a genuine bug, second, download the latest patch release of ECLiPSe to see if the problem has been fixed. If not, third, isolate a code fragment that reproduces the problem. Fourth, submit a bug report.

3.12. How do I deliver an ECLiPSe application as an executable?

The concept of "standalone executable" doesn't really exist anymore these days. Almost every application now needs to be installed in some way, because of the dependencies on other resources, in particular shared libraries. The way to deploy an ECLiPSe application is to provide three components:

  • the ECLiPSe runtime package (contained in eclipse_rt.tgz)
  • the ECLiPSe code of your application, either in source form or in precompiled .eco format (see library(fcompile))
  • the "host" program, which nowadays is often a Java program that calls ECLiPSe as a library, but in the simplest case it can just be a one-line shell script which invokes eclipse and tells it to load and run your application code, e.g. eclipse -b my_application.eco -e my_top_goal



4. tkeclipse

4.1. What's the difference between eclipse and tkeclipse?

tkeclipse is a graphical front-end for ECLiPSe. It provides easy access to the system, and many additional tools, including visualisation. In this FAQ, we write "ECLiPSe" for the overall system, "eclipse" for the command line version, and "tkeclipse" for the graphical version.

4.2. Can I use tkeclipse with my embedded ECLiPSe applications?

Like eclipse, tkeclipse itself is designed for interactive use, i.e. you load your ECLiPSe program into it and run it. However, the graphical tool set, e.g. the tracer, can be linked with an ECLiPSe application that is embedded into a host language, e.g. C, Java. To use the tools, you need to attach tktools to your application. See the manual description of tktools for more details. In fact, tktools can be attached to and use by any ECLiPSe code, as long as you are running in an environment that can display graphics. For example, you can use tktools when you are running ECLiPSe from within emacs using the ECLiPSe mode, which provides support to make this easier - you can start tktools from the ECLiPSe-Process menu.

4.3. Why won't tkeclipse run?

tkeclipse is written in Tcl/Tk, and should run on any platform that supports Tcl/Tk. Do you have the required version installed? Do you have the paths set correctly? Under Windows, did you follow the platform-specific ECLiPSe installation instructions?

4.4. I changed my program but ECLiPSe hasn't noticed!

When you change your program and save it, you must click "Make" in tkeclipse (in eclipse, type "make."). Then re-run your query.

4.5. How do I clear the output windows?

First, left-click in the "Results" window to move the focus there. In ECLiPSe 5.7 and later, right click to bring up the context menu, and select "Clear this window". Do the same for the "Output and Error Messages" window. In earlier versions, instead select the text you want to remove from the "Results" window using the right mouse button (triple-click to select everything), and press delete on your keyboard.

4.6. How do I copy text from the output windows to the clipboard?

First, left-click in the "Output and Error Messages" window and select the text you want with the left mouse button. In ECLiPSe 5.7 and later, right click to bring up the context menu, and select "Copy selection to clipboard".

4.7. Why is tkeclipse not responding?

If your program is running, tkeclipse may respond slowly during heavy computation. However, the "interrupt" button always works: you can then choose to continue or abort execution. A second reason tkeclipse may not respond is if you have the Tracer open. In that case, during execution, the Tracer has focus; the main tkeclipse window will not respond (apart from "interrupt"). Finally, if tkeclipse really has locked up, under Linux hold down Control and Shift and click "interrupt" to kill tkeclipse.

4.8. How do I get help in tkeclipse?

Information about how to use tkeclipse is found in the User Manual, and also from the Help menu in tkeclipse. Information about ECLiPSe is available using the "ECLiPSe Library Browser and Help" from the Tools menu. Finally, the ECLiPSe Tutorial has a chapter on debugging with tkeclipse.


5. General programming

5.1. How do I structure an ECLiPSe program?

General advice is to decompose your program into model, search, and results-reporting sections. Keep separate predicates for the modelling section, constraints (i.e. where you define any new constraints), and search sections; with a control section to link all the predicates together. This will help with debugging your programs and understanding them at a later date. See the example codes on the ECLiPSe web site for examples.

5.2. What is the difference between =, ==, =:= and #=?

The semantics (meaning) of these operators are different:

  • = is unification
  • == is syntactic term equality
  • =:= is arithmetic equality
  • #= is a constraint (integer-valued equality constraint)

See the pages in the Reference Manual for examples. Specific libraries introduce other forms of equality: for example ic introduces real-valued constraint equality $=.

5.3. How do I convert a real number (e.g. 1.0) to an integer (1) format?

Integer is fix(Real)

Often you'll want to round the real number appropriately first (round/2, floor/2, ceiling/2) rather than relying on fix's truncation. See the documentation for is/2 and fix/2.

5.4. How do I improve the performance of my program?

This is a large topic! The best way is to consider the data structures and algorithms you are using. However, there are some ECLiPSe-specific performance considerations: see section 6.9 of the User Manual. You can use ECLiPSe's debugging and profiling tools to find where your program is spending its time. Finally, you can remove debugging code.

For a constraints program, you can try improve your labelling heuristic to reduce the amount of search to find the solution, and visualising how the existing search is behaving may help guide you in this. You can also try adding more powerful constraints to your problem (e.g. global constraints), which you may need to write yourself.

5.5. How do I invoke an ECLiPSe goal from the command line?

eclipse -b my_file.pl -e 'my_predicate(X,Y)'


6. Loops and conditionals

6.1. What are logical loops?

Logical loops are a compact way of writing iteration in ECLiPSe. The simulate the loop facilities of an imperative language (such as Java) in a declarative language. For example, you can write

    ( for(I, 1, N) do
          writeln(I)
    ),
    

Loops let you write more compact ECLiPSe code. Without them, you would have to code the loop explicitly as a recursive predicate, in standard Prolog fashion. Internally, ECLiPSe rewrites your loop statement automatically in this way; this is why loops appear as calls to a predicate do_n in the Tracer. To find out what kind of loops are possible in ECLiPSe see section 5.2 of the User Manual.

6.2. Where do I put the brackets in a loop?

Put them outside the loop, like this:

    ( loop declaration,
      param(...) do
         loop statements
    ),
    
Note that no brackets are needed about the loop declarations (for example, for(I, 1, N)) themselves. Note also that the last line of the loop statements should not end in a comma (nor a full-stop), because the whole loop statement is seen by ECLiPSe as one unit: (... do ... ). The usual rules for comma/full-stop apply to the whole loop statement.

6.3. How does param work?

The param term of a logical loop links variables outside a loop with variables inside. Without param(X), variable X is not visible inside the loop; X inside the loop is a new variable, unrelated with X outside. With param(X), variable X is visible inside the loop; X inside the loop is the same as X outside. Note that variables in the loop declaration (for example, N in for(I, 1, N)) are automatically those visible outside the loop; you don't need a param for these variables.

6.4. Why is my for loop failing?

The target value in a for statement cannot be an unbound variable: it must be a known, ground value at execution time. If TotalIterations is unbound, you cannot write for(I,1,TotalIterations); use a count loop if you want to do this.

6.5. How do I trace a loop statement?

ECLiPSe translates loop statements into predicates called do__n, where n is a unique integer. There is no general way of determining which number each loop statement corresponds with: use the Tracer. However, when the do statement number has been determined it can be traced with spy do__n.

In ECLiPSe 5.6 and later, you can choose a name for a loop, which will then be used instead of the generated name, for instance:

    ( loop_name(first_write_loop),
      for(I, 1, N) do
         writeln(I)
    ),
    

In ECLiPSe 5.11 and later, code compiled by the new compiler can be source-traced, and the execution of the loop can be seen directly via the source-tracing.

6.6. Where do I put the brackets in a conditional statement?

Put them outside the conditional statement, like this:

    ( condition ->
        if_true_do_this
    ;
        if_false_do_this
    ),
Note that no brackets are needed (in general) about the condition itself. Note also that the last line of the if_true_do_this and if_false_do_this statements should not end in a comma (nor a full-stop), because the whole conditional statement is seen by ECLiPSe as one unit: ( ... ->; ... ; ... ). The usual rules for comma/full-stop apply to the whole conditional statement.

6.7. Why is my conditional statement failing?

In ECLiPSe, every conditional should have an else clause. If you only want to execute something if a condition holds (and do nothing otherwise), you must code this explicitly:

    ( condition ->
        ...
    ;    
        true
    )


6.8. What can I put in the condition?

The conditional must have a truth value known at modelling time (i.e. when you compile your program): it can not be a constraint. For example #= should not be used in the condition.

6.9. When should I use ;?

When you want to express a logical disjunction, such as between two truth-known terms in a condition. Do not use ; to express search choices; instead use constraints and generic search routines. See section 12.2.1 of the ECLiPSe tutorial.


7. Constraints

7.1. How do I remove a posted constraint?

The simplest way to remove a posted constraint is to backtrack over the posting of the constraint. This is the logical way of removing the constraint.

There is no logical way of selectively `removing' a constraint, i.e. `undo' the effect of one posted constraint but not others that are posted after it. However, if you use lib(tentative)<\code>, you can post constraints which are only monitored for violation, so you can just ignore ignore them if they are violated. Note that in this case the constraint is only monitored, and no propagation is done by posting it, and that resources are still consumed until it is backtracked over.


8. Search

8.1. Why do I need search?

Constraint propagation is in general not enough to find solutions. This is one reason you might see delayed goals.

8.2. What search facilities does ECLiPSe have?

Extensive search algorithms are provided in the ic (search/6) and branch_and_bound libraries.

8.3. How do I write my own search predicate?

The simplest search predicate tries to allocate variables to values in chronological order. This can be done using the build in labeling predicate and search/6. If you want to implement your own variable or value ordering heuristics, the simplest way is to write your own search predicates based on the labeling. More complex search predicates can also be implemented. See section 12 and 13 of the ECLiPSe Tutorial for more details.

8.4. What is a backtrack?



8.5. How do I count backtracks?



8.6. What does "search did not instantiate cost variable" mean?

The documentation for minimize(Goal, Cost) refers you to bb_min/2, and the second sentence in the description for that predicate says:

"Cost should be a variable that is affected, and eventually instantiated, by Goal."

That is, Goal is expected to completely solve the problem, and once the problem is solved, Cost should be known (fixed, and not a variable). The error message indicates that Cost had not been fixed when Goal completed; you should find out why Goal did not instantiate the cost, and modify it appropriately to correct the problem.


9. Output

9.1. How do I see more of terms I print? How do I see more in the Tracer?

Increase the print depth. In tkeclipse, choose "Global Settings" from the Tools menu; in the Tracer, choose "Change print options" from the Options menu. You can also print individual items at their full depth by using the "D" modifier in printf. For example, printf("%Dw",[Term]). Finally, you can query the print depth for all output in your program using get_flag(print_depth,Depth) and change it using set_flag(print_depth, Depth).

With the Tracer, consider using the Inspector tool instead of printing out more of the term; the Inspector makes it easier to visually parse a long term, and enables you to explore its structure.

9.2. Why isn't my output being printed?

Are you sure execution reaches your write/printf statement? If so, it might be that a failure occurs afterwards, before the stream is flushed, and so your output never appears. A stream is flushed when a newline is printed, but you can also ask for it explicitly. For example, printf("%w%b",[Term]).

9.3. How do write and printf differ in buffering?




10. Error messages

10.1. I'm getting a strange error message when compiling, even though everything is correct.

Especially if you've used different modules, ECLiPSe might need a clean start. In tkeclipse, choose "Clear toplevel module" from the File menu. Now reload your program.

10.2. ECLiPSe says "syntax error: postfix/infix operator expected"

The most likely cause is that you've misplaced a comma (,) or full-stop (.) at the end of a line. As a rough guide, each line must end in a comma, expect the last line of a clause, which must end in a full-stop.

10.3. ECLiPSe says "trying to redefine a built-in predicate: (',') / 2"

If you were not meaning to redefine a built-in predicate, most likely you put a full-stop where you meant to put a comma. When you have a full-stop instead of a comma, the above message appears because the rest of the clause is taken as a fact for ,/2.

Alternatively, you may get the messages "trying to redefine a built-in predicate: ..." for some other built-in you have used, or "WARNING: Hiding imported predicate ..." for some library predicate you have used. In the unlikely case that you really did want to redefine a built-in, read the documentation for the module system and the local/1 declaration.

10.4. ECLiPSe says "syntax error: bracket necessary"

Perhaps you do need brackets, but perhaps you just omitted a full-stop at the end of a clause.

10.5. ECLiPSe says "Singleton variables in clause ... of ..."

A singleton variable is a variable you have referred to only once. This warning often indicates a programming error, especially in loops. Even if your code does what you intended, singleton variables are considered bad form: replace them with _.

10.6. ECLiPSe says "Singleton local variable ... in do-loop, maybe param(...) missing?"

Almost certainly, you forgot a param(...) in your loop.

10.7. ECLiPSe says "syntax error : unexpected closing bracket"

You may have a spurious closing bracket where indicated. However, another possible cause is that the line finishes with a comma when it should not. For example, the last statement before a closing bracket of a loop should not be followed with a comma.

10.8. How do I remove warning output?

The best way is to change what is causing the warning so that you don't get the warning. However, warning output during program execution is not always helpful. To remove it: set_stream(warning_output,null). Warning: this will remove all warnings, including ones that might alert you to real problems with your code.

10.9. How do I increase my global stack?

Memory-intensive computation can exhaust ECLiPSe's working space, typically the global stack. The default limit is 128MB, but this can be set to a larger amount before ECLiPSe is started. In both command-line eclipse and tkeclipse, use for example the command line option -g 512M for a 512MB stack.

The absolute limit on a 32 bit machine is between 2GB and almost 4GB, depending on the operating system. The maximum global stack you can request for ECLiPSe on 32-bit Linux is about 1900M; on Solaris you can allocate close to 4GB. On 64-bit, of course this limit doesn't exist.

It is inadvisable to choose a value larger than the physical memory on your machine, because your program will spend most of the time swapping pages.

In tkeclipse, the preference editor tool allows you to set the default sizes of the various stacks. After you enter the new size, save it using the `Save Preferences' button, and restart tkeclipse.


11. Debugging

11.1. How do I debug my ECLiPSe program?

Use the Tracer. In tkeclipse, choose "Tracer" from the Tools menu. See the chapter on "Debugging" in the User Manual; and the worked example in chapter 5 of the ECLiPSe Tutorial.

11.2. How do I visualise constraint propagation and variable domains?

The Tracer is designed to let you step through the execution of your program. The visualisation tools are designed to let you see the effects on constraints on your variables's domains. The two can be used together.

11.3. Where is my program spending its time?

Use the profiling tools in libraries profile, port_profile, instprofile, and coverage. In tkeclipse 5.7 and later, "Time Profile" and "Port Profile" can be invoked from the Run menu.

11.4. My program is now bug-free: how do I remove debugging code?

By default, ECLiPSe produces debuggable (traceable) code. Because it includes tracing information, this code is slower. You can ask instead for optimised (non-traceable) code with the directive: :- pragma(nodebug).


12. Visualisation

12.1. Why won't the visualisation client start?

The visualisation client does not start automatically: you must invoke it from the Tools menu in tkeclipse. The most common reason it won't start is a problem with Java on your computer. Check the Java version and installation (Java should be installed before ECLiPSe). Check the CLASSPATH environment variable. Check paths and access permissions. Consult your local ECLiPSe expert and the Visualisation Tools manual.

12.2. How do I look at the changes for one variable?

In the visualisation client, right-click on the variable that you are interested in and choose "Hold on updates".

12.3. How do I get an `animation' of my program's activity?

Use the "Auto resume" option:

  1. Open the visualisation client.
  2. Run your ECLiPSe program. Control is transferred to the visualisation client.
  3. Select the items you want to animate.
  4. Right-click them and choose "Hold on updates".
  5. From the Options menu choose "Auto resume".
  6. Click "Resume" at the bottom of the window to begin.
  7. Move the "Auto resume" slider at the bottom of the window to change the speed of animation.



13. ic library

13.1. How do I do symbolic finite domains with ic?

ic does not directly support using symbols as the domain values. This support is provided by the ic_symbolic library.

13.2. What do "Delayed goals" mean?

Delayed goals correspond to unresolved constraints. If ECLiPSe has delayed goals at the end of computation, it reflects the fact that the variable's ranges could possibly be further reduced in the future. Delayed goals also reflect the fact that ic does not guarantee the existence of solutions in the computed ranges (in interval computation terminology, it is not sound). However, it guarantees that there are no solutions outside these ranges (it is complete).

If delayed goals occur, you should check that all decision variables have been labelled, and that the constraints have assigned values to all other variables. If so, then the existence of a few delayed goals is probably not significant: they likely occur because of interval arithmetic (see next question).

13.3. Why does ic give me so many delayed goals?

Interval arithmetic is not like arithmetic with integers or reals. A major reason why ic gives delayed goals (beyond unresolved constraints you have posted) is because some arithmetic operations cannot be resolved: for example, is 1.0__2.0 > 1.5__2.5? In tkeclipse, select "Delayed Goals" from the Tools menu to see all delayed goals. You can then examine them to see whether they are significant for you.

13.4. What's the difference between ; and #\/?

; is Prolog disjunction; #\/ is a constraint (disjunctive constraint). ; introduces a choice point in your code, which you might use to write a search procedure; #\/ imposes a constraint, which you might use to model a problem.

13.5. Why are the same constraints in ic and ic_global?

The constraints have the same declarative semantics (what they do, conceptually), but different operational semantics (how they do it, in practice). Those in ic_global perform more computation, but achieve more propagation. In simple terms, the prpagation in the ic_global takes a more "global" view of the constraint by reasoning over several variables at the same time, rather than just pairs of variables. For example, all_different in ic is decomposed into #\= constraints between all possible pairs of variables, where as the ic considers the variables in the constraint together.


14. eplex library

14.1. What LP/MIP solvers does ECLiPSe have?

ECLiPSe is able to interface with the open-source Coin-OR project's solvers via their Open Solver Interface (OSI); currently this is mainly interfaced to the CLP/CBC solvers, with a prototype to SYMPHONY/CLP solvers. It is also able to interface to the commercial solvers  ILOG's CPLEX and Dash Optimization's Xpress-MP, but no license for either is included with ECLiPSe 5.8 or later. Both companies offer academic licences at discounted rates. Dash offers free academic licenses to Universities through their Academic Partner Program.

The interface to Xpress-MP is only up to versions of Xpress-MP developed in 2005, because the developers does not have access to later versions of the solvers. If anyone wants to continue the development of the interface, or provide access to Xpress-MP solver for development, please contact the developers via the mail list.

14.2. How do I setup ECLiPSe with CPLEX?

To use eplex with CPLEX with a normal license file, you need to have the environment variable ILOG_LICENSE_FILE setup to point to the location of your license file (access.ilm). Note that we do not distribute a binary package for the eplex CPLEX interface, because this requires the commercial binaries from ILOG to be included in the distribution. Instead, you need to compile ECLiPSe from the source to use it. See the Setup Guide included in the source distribution for more details.

14.3. What sort of problems can I solve using the eplex library?

The exact types of problems that can be solved depend on the solver that eplex is interfaced to. At the minimum, eplex should be able to solve linear problems (LP), and probably also mixed integer linear problems (MILP). In addition, eplex supports the specification of a quadratic objective function, so if supported by the solver, it can also solve quadratic problems (QP) and mixed integer quadratic problems (MIQP). Note that if you are using a commercial solver, your license may not permit you to solve all problem types, even if the solver supports it.

14.4. What sort of problem solving methods is supported by the eplex library?

The exact method used to solve the problem is determined by the solver. The eplex library does provide options to specify the solving method that should be used, but this will only be meaningful if the solver supports the specified method. The common solving methods are: Simplex (primal and dual), and interior point (barrier) methods. Note that some solvers places restrictions on the problem types that can be solved by a particular method. In addition, for commercial solvers, your license may limit the solving methods you can use.


15. SBDS library

15.1. What is SBDS?

A library for symmetry breaking during search.

15.2. How do I identify symmetry?



15.3. How do I write symmetry breaking functions?



15.4. How do I write search predicates for use with SBDS?



15.5. How do I adapt existing code for use with SBDS?



15.6. Can I use SBDS with other libraries?




16. Embedding and Interfacing

16.1. How do I call C/C++ functions from ECLiPSe? And ECLiPSe from C/C++?

Both are possible. See "Embedding and Interfacing Manual".

16.2. How do I compile an .ecl file from an external program?

Call the ECLiPSe compile/1 predicate using the ECLiPSe external interface, from your external program. For example, from C++, any of the following (which are all equivalent):
post_goal(term(EC_functor("compile",1),"predicate"));
post_goal("compile(\"predicate\")");
post_goal("compile('predicate')");



16.3. How do I specify the pathname of the ECLiPSe file when compiling ECLiPSe from C++?

ECLiPSe expects the file with the predicate called to be in the running process's "current directory". When the predicate is invoked from an external program, the current directory is not under ECLiPSe's control.

Specify an absolute pathname to your ecl file by: post_goal(term(EC_functor("compile",1),"//C/foo/bar/predicate")); (but note the generic ECLiPSe pathname syntax, see os_file_name/2).



16.4. My C++ program calls ECLiPSe iteratively, but it stops with the error: "Cannot reserve stack space in alloc_stack_pairs()"

You probably initialise ECLiPSe repeatedly. You are supposed to call ec_init() just once, and then post goals repeatedly. Do not call ec_cleanup() and do not try to re-init ECLiPSe.