Re: [eclipse-clp-users] y = a1b1 + a2b2 + a3b3 + ... + anbn

From: Philippe de Rochambeau <phiroc_at_...22...>
Date: Wed, 3 Dec 2014 23:13:47 +0100
```Hi,

let me make my question more specific.

I need to display the following hierarchical data, in a PDF document

Manifest 1
Drop 1
Customer 1
Customer 2
Customer 3
Drop 2
Customer 1
Customer 2
Drop 3
Customer 1
Customer 2
Customer 3
Customer 4
Customer 5
Customer 6

Manifest 2
Drop 1
Customer 1
Customer 2
Drop 2
Customer 1
Customer 2
Customer 3
...

A « Manifest » is a sheet of paper which provides information on a series of newspaper « Drops » ; i.e., locations where the newspaper is deposited.

A «  Customer » is a newspaper reader.

The above lines of data are difficult to fit on PDF pages because although each PDF page only fits, say, 10
lines of data, the number of drops and customers in each Manifest varies. For instance, although the data
below would fit on one PDF page, because the number of lines is equal to 8:

Manifest 1
Drop 1
Customer 1
Customer 2
Customer 3
Drop 2
Customer 1
Customer 2

the following 15 lines would have to be spread over two pages:

Manifest 1
Drop 1
Customer 1
Customer 2
Customer 3
Drop 2
Customer 1
Customer 2
Drop 3
Customer 1
Customer 2
Customer 3
Customer 4
Customer 5
Customer 6

like this

Manifest 1
Drop 1
Customer 1
Customer 2
Customer 3
Drop 2
Customer 1
Customer 2

---------------------------

Manifest 1 (continued)
Drop 3
Customer 1
Customer 2
Customer 3
Customer 4
Customer 5
Customer 6



Mathematically, the number of rows in each Manifest could be defined as

Rm = D1 + C1 + D2 + C2 +  Dn + Cn + 1

where Rm stands for «  number of rows in Manifest »
Dn: Drop n
Cn: Number of Customers in Drop n
+ 1: count Manifest line

For instance,

Manifest 1 at the very top of this e-mail could be modeled as

15 [lines] = 1 + 3 + 1 + 2 + 1 + 6 + 1

Is there a way in Eclipse CLP to compute the different combinations of numbers of Drops and Customers which, when added together, yield a number which is less than on equal to the maximum number of lines on a page (say, 10)?

Furthermore, assuming the total number of lines in a Manifest is greater than the max. number of lines on a PDF page, is there a way in CLP to compute the number of pages the data lines will require to be printed?

Because the number of combinations can be infinite, lets assume that the number of «  terms » (e.g., 1 + 3 + 1 + 2 + 1 + 6 + 1: 7 terms) must be less than 10.

Many thanks.

Philippe

Le 30 nov. 2014 ΰ 12:09, Philippe de Rochambeau <phiroc@...22...> a ιcrit :

> Hello,
>
> I have a programming project in which I need to display rows from a data array, in a PDF document, where each page should contain at most 25 rows.
>
> The data array is composed of groups where each group can be defined as follows:
>
> for instance,
>
> group1 = a1 x 2 + a2 x 5 + a3 x 1
>
> group2 = a4 x 1 + a5 x 2
>
> group3 = a6 x 12 + a7 x 12 + a8 x 1
>
>
> Is it possible to compute the number of As in each group (assuming it is <= 10, to make things simpler), and their respective multipliers, where group n <= 25, in CLP or otherwise?
>
> Many thanks.
>
> Philippe
>
>
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------