Re: [eclipse-clp-users] API for c++ nolinear constraints

From: liu.yu.senior.china <>
Date: Mon, 31 Aug 2009 22:56:08 -0600
Hi, Kish Shen

Thank you very much for your reply. It is very helpful. Now I am learning how to use the command line interface of eclipse to read, execute and write files. I am trying the sendmore.ecl example. I can compile it successfully. But I don't know how to run the code, or it is already run during compilation? Then how to query the values of S, E... or Digits list?

I am having a hard time reading the manuals.  




发件人: Kish Shen 
发送时间: 2009-08-26  08:27:51 
收件人: liu.yu.senior.china 
抄送: eclipse-clp-users 
主题: Re: [eclipse-clp-users] API for c++ nolinear constraints 
liu.yu.senior.china wrote:
> This is a very good suggestion. But how to do this? Do you mean besides the c++ code, I should code 
> e a file containing eclipse code and use the c++ code to pass the parameters and call the eclipse 
> file?
> again, do you have examples?
There are various ways to pass the parameters from C++ to ECLiPSe.
You can write your parameters into a file that you read in your ECLiPSe 
program (which you write, and not generate from C++ as you suggest). 
This is how a lot of ECLiPSe program works -- you read in data from a 
file, which is then used to generate your constraints -- this allows 
your program to deal with different problem instances.
Some of the examples show how a program can read data and generate the 
constraints from them -- rostering (in the planning and scheduling 
section of the ECLiPSe code samples page) is a good example. One 
difference from real applications is that to keep things simple, the 
data are in the same file as the program. Also, the data is in ECLiPSe 
format (as Prolog facts). Neither of these are requirements -- the data 
can be in non-Prolog syntax and in different files from your program.
You just need to use the I/O facilities of ECLiPSe (as described in the 
manual) to read the data.
An alternative to passing the parameters via files is to pass the 
parameters in a call to an ECLiPSe goal from C++, as one of the 
arguments. You can then generate the constraints from the argument in 
your ECLiPSe program (which implements the goal that you call from C++).
ECLiPSe is a general programming language, and there are many different 
ways to solve problems. It is therefore impossible to cover all possible 
instances with examples. The purpose of the examples is to show how 
programming can be done in ECLiPSe, and not really intended as templates 
that you can copy into your own code and use directly.
> The link and the sendmore example are too simple and general to help anything. Any complicated
> examples with nonlinear constraints using C++ API? Anyway, I appreciate all your help.
I am not sure why the sendmore example is too general -- if you mean you 
cannot just copy it and use it directly, you are probably right. As 
already mentioned, this is not the intention of the examples.
The example does show you how to construct nested terms, and also how 
you can construct a constraint expression with many variables. This 
should give you what you need to construct the constraints you 
mentioned. I do not see what is the significant differences between 
linear and nonlinear constraints -- you can write both as expressions in 
ECLiPSe (and thus in the C++ code you would write).
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.
Received on Tue Sep 01 2009 - 03:56:25 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET