From Lesta@t-online.de  Mon Dec  4 22:42:57 2000
Received: from mailout00.sul.t-online.com (mailout00.sul.t-online.com [194.25.134.16])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id WAA04911
	for <prolog@swi.psy.uva.nl>; Mon, 4 Dec 2000 22:42:56 +0100 (MET)
Received: from fwd04.sul.t-online.com 
	by mailout00.sul.t-online.com with smtp 
	id 1433O9-0000dY-05; Mon, 04 Dec 2000 22:43:09 +0100
Received: from t-online.de (05121269112-0001@[62.158.100.155]) by fwd04.sul.t-online.com
	with esmtp id 1433Ny-1NTjaiC; Mon, 4 Dec 2000 22:42:58 +0100
Message-ID: <3A2C0FC1.78E4C360@t-online.de>
Date: Mon, 04 Dec 2000 22:42:25 +0100
From: Lesta@t-online.de (Uwe Lesta)
Organization: Lesta
X-Mailer: Mozilla 4.7 [de]C-DT  (WinNT; I)
X-Accept-Language: de,en
MIME-Version: 1.0
To: swi prolog mailing list <prolog@swi.psy.uva.nl>
Subject: How to construct a tree from a given structure and elements
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Sender: 05121269112-0001@t-dialin.net


Please give me some advises on the following problem :

% The structure of a maximum possible tree is given by

% tree_struct(+child, +parent, +max_childs).
tree_struct(node1, root, 2).
tree_struct(node2a, node1, 5).
tree_struct(node2b, node1, 8).
tree_struct(node3a, node2a, 2).
tree_struct(node3b, node2a, 1).
tree_struct(node3a, node2b, 2).
tree_struct(node3c, node2b, 10).
% ...

% elements are given

% material(+node, +amount).
material(node3a, 7).
material(node3c, 30).
material(node2b, 6).


% Now I will add some rules to give each node some points
% and a maximum of points which are allowed for the childrens.

% node_points(+node, +green_points(+max_allowed, +amount), 
+red_points(+max_allowed, +amount)).
node_points(node1, green_points(200, 0), red_points(100,0)).
node_points(node2a, green_points(70, 1), red_points(30,2)).
node_points(node2b, green_points(70, 2), red_points(30,5)).
node_points(node3a, green_points(8, 4), red_points(2,1)).
node_points(node3b, green_points(8, 8), red_points(2,1)).
node_points(node3c, green_points(8, 1), red_points(2,0)).


What is the best way to write a program that build a balanced tree
from this facts ?


I am looking forward to read your advises

Thank you for your time 


-- 


Regards

Uwe
Lesta@t-online.de

