Hi Liu Yu, ECLiPSe is a programming language, and you should write your program (and thus the constraints you want to use) in ECLiPSe, and not try to do it from C++. In ECLiPSe, you can write the expressions more or less like you have presented them: C1/X1 =< R1 (note =< is used instead of <=, as <= looks like implication) and to write this as a constraint, with X1 taking real values, you need lib(ic), and use $=< for your operator: C1/X1 $=< R1 liu.yu.senior.china wrote: > Dear Sir or Madam, > > I am new to eclipse and clp and I have nonlinear constraints as follows: > > only x1..xn are vaiables and all the thers are constants. > > c1/x1<=r1 > c1/x1+c2/x2<=r2 > c1/x1+c2/x2+c3/x3<=r3 > c1?x1+c2/x2+c3/x3+..+cn/xn<=rn > > I was wondering if I can use a single for loop to post all the constraints. Is there any eclipse data type for me to store expressions like c1/x1+c2/x2...? > Yes, in ECLiPSe you can write arbitrarily complex expressions without any problems. > Another constraint is like > > exp(c1*x1)+exp(c2*x2)+...+exp(cn*xn)>=constant exp(Expr) (e to the power of Expr) is supported by lib(ic). > > How can I build the above constraints using c++ API? > As stated before -- it is strongly recommended that you *do not* build such complex data structures in C++. ECLiPSe is not designed to be a constraint library for use with C++. If you want to do this, you are probably better off using a different package that is designed for this. You should do your programming in ECLiPSe itself. The recommended way to use the ECLiPSe C++ interface is to keep the interaction between C++ and ECLiPSe simple -- so for example, C++ should just call some simple top-level query, and allow ECLiPSe to do the rest. Having said this, you can build arbitrarily complex ECLiPSe structures using the C++ interface, and so you can build any expressions you like. It is not recommended because it is cumbersome, and it is easy to make mistakes, and such mistakes may be hard to catch. If you really want to build such expressions, the embedding and interfacing manual describes how to build structures using the C++ interface. Cheers, Kish Shen > Thank you in advance > > 2009-08-22 > > > > liu.yu.senior.china > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > > > ------------------------------------------------------------------------ > > _______________________________________________ > ECLiPSe-CLP-Users mailing list > ECLiPSe-CLP-Users_at_lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users -- 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 Mon Aug 24 2009 - 15:05:11 CEST
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST