Re: [eclipse-clp-users] Time out issue with long integer

From: Edgaonkar, Shrirang <Shrirang.Edgaonkar_at_...390...>
Date: Mon, 15 Dec 2014 01:53:06 +0000
```Dear Joachim,

Here is the problem. The following script runs with locate to give me a bounded real 2.5 .. 2.9.

Problem with locate

:-lib(ic).
solve(A1) :-
%%Domain
%%Constraints
(A1) + 1  \$> (3.5),

%%Search
locate([A1],1e-1).

Output

?- solve(A1).
A1 = A1{2.5 .. 2.9723527865385617}
There is 1 delayed goal.
Yes (0.00s cpu, solution 1, maybe more)
----------------------------------------------------------------------------------

So I represent the same number as a fraction(A1/A2). Using search it will give me A1 and A2.. Outside the scope of eclipse, I calculate the fraction
to be 2.5000000005820766092701993438579. But I need a fraction close to 2.6 or 2.51 since that is my border value. Moreover, this approach also solves other complex constraints.

Solution with search
:-lib(ic).
solve(A1, A2) :-
%%Domain
A1 :: -2147483648 .. 2147483647,
A2 :: -2147483648 .. 2147483647,

%%Constraints
(A1/A2) + 1  \$> (3.5),
%%Search
search([A1, A2],0,input_order,indomain_min,complete,[]).

Output
A1 = -2147483648
A2 = -858993459
There are 2 delayed goals.
Yes (0.00s cpu, solution 1, maybe more)

Operation outside eclipse system
A1/A2 = 2.5000000005820766092701993438579

Thanks and Regards,
Shrirang Edgaonkar
________________________________________
From: Joachim Schimpf [jschimpf@...311...]
Sent: 13 December 2014 00:02:14
To: eclipse-clp-users_at_lists.sourceforge.net
Subject: Re: [eclipse-clp-users] Time out issue with long integer

On 12/12/14 03:51, Edgaonkar, Shrirang wrote:
> Dear Joachim,
>
> It would be great if the problem would be fixed. I read your email and
> understood. The large domain is due to the LONG range used in java as I am
> mapping it with variables in java. In few cases, I could be in a situation
> where the no of constraints are very less. The above bug fix will also help
> me in my approach for real numbers. Please see below.

As I mentioned in my earlier reply, you should simply use indomain_split, which
will give you the expected answer:

?- X :: -9223372036854775808 .. 9223372036854775807,
X \$> 115000000000,
search([X], 0, input_order, indomain_split, complete, []).
X = 115000000001
Yes (0.00s cpu, solution 1, maybe more)

>
> on real numbers and understand the limitation to solve equations if the a
> finite solution is non existant.
>
> To counter the same, I have come up with the following solution.
...
>

It's difficult to make a recommendation without knowing what kind of problem you
are actually trying to solve.

-- Joachim

------------------------------------------------------------------------------
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
_______________________________________________
ECLiPSe-CLP-Users mailing list
ECLiPSe-CLP-Users_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users

______________________________________________________________________
Disclaimer: This email and any attachments are sent in strictest confidence
for the sole use of the addressee and may contain legally privileged,
confidential, and proprietary data. If you are not the intended recipient,