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

solve(A1) :-
(A1) + 1  $> (3.5),



?- 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
solve(A1, A2) :-
A1 :: -2147483648 .. 2147483647,
A2 :: -2147483648 .. 2147483647,

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

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
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 a separate note, please look at the following example. I read your posts
> 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.
> Please let me know your thoughts on this.

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

-- Joachim

Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
ECLiPSe-CLP-Users mailing list

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,
please advise the sender by replying promptly to this email and then delete
and destroy this email and any attachments without any further use, copying
or forwarding.
Received on Mon Dec 15 2014 - 01:53:18 CET

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:30 CEST