<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Representaiton for PC Configuration Example 
% 
%               Jessica Chen-Burger 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Description of boards available 
% 

class(board). 

class(processor). 
is_a(processor,       board). 
property(processor, capability, [processor]). 
property(processor, length,     long).
property(processor, extra_power_data, extra).
property(processor, cost, 200).

class(disk_controller). 
is_a(disk_controller, board).
property(disk_controller, capability, [disk_io]). 
property(disk_controller, length,     long).
property(disk_controller, extra_power_data, normal). 
property(disk_controller, cost,      50).
static_constraint([allocate(disk_controller, Slot1),
                   allocate(processor,       Slot2)], 
                  [next_to(Slot1, Slot2)]).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definition of predicate next_to(A, B). 
next_to(A, B) :-
    instance_of(A, slot), 
    instance_of(B, slot), 
    ( next_to(A, B);
      next_to(B, A)). 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definition of predicate: 
%  allocate(Board, Slot): 
%  A Board (type) has been allocated to a Slot. 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

class(io). 
is_a(io,              board).
property(io, capability,       [other_io]). 
property(io, length,           short).
property(io, extra_power_data, normal). 
property(io, cost,             50).

class(optionI). 
is_a(optionI,         board).
property(optionI, capability, [fast_graphics]).
property(optionI, length,     long).
property(optionI, extra_power_data, extra). 
property(optionI, cost,       100).
static_constraint([allocate(optionI,    Slot1),
                   allocate(processor,  Slot2)],
                  [next_to(Slot1, Slot2)]).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% static_constratin(Pre_conditions, Conclusions). 
%% both arguments are described in conjunctive normal form.  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

class(optionII). 
is_a(optionII,        board).
property(optionII, capability, [fast_graphics, video_in]).
property(optionII, length,     short).
property(optionII, extra_power_data, extra). 
property(optionII, cost,       300).

class(optionIII). 
is_a(optionIII,       board).
property(optionIII, capability,       [sound]).
property(optionIII, length,           long).
property(optionIII, extra_power_data, normal). 
property(optionIII, cost,             50).
static_constraint([allocate(optionIII,  Slot1),
                   allocate(io,         Slot2)], 
                  [next_to(Slot1, Slot2]).

class(optionIV). 
is_a(optionIV,        board).
property(optionIV, capability,       [video_in]).
property(optionIV, length,           short).
property(optionIV, extra_power_data, normal). 
property(optionIV, cost,             50).
static_constraint([allocate(optionIV,        Slot1),
                   allocate(disk_controller, Slot2)], 
                  [next_to(Slot1, Slot2)]).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Description of the mother board used: 
%% note that instances are used here to indicate that 
%% a particular type of board with 6 slot instances are 
%% used. 

class(mother_board).
is_a(mother_board, device).

instance_of(mother_boardx, mother_board).
has(mother_boardx, slot1).
has(mother_boardx, slot2).
has(mother_boardx, slot3).
has(mother_boardx, slot4).
has(mother_boardx, slot5).
has(mother_boardx, slot6).

class(slot).
is_a(slot, device). 

instance_of(slot1, slot). 
instance_att(slot1, position, 1). 
instance_att(slot1, length, long). 
instance_att(slot1, extra_power_data, normal).
next_to(slot1, slot2). 
 
instance_of(slot2, slot). 
instance_att(slot2, position, 2). 
instance_att(slot2, length, long). 
instance_att(slot2, extra_power_data, extra). 
next_to(slot2, slot3). 

instance_of(slot3, slot). 
instance_att(slot3, position, 3). 
instance_att(slot3, length, long). 
instance_att(slot3, extra_power_data, extra). 
next_to(slot3, slot4). 

instance_of(slot4, slot). 
instance_att(slot4, position, 4). 
instance_att(slot4, length,   short). 
instance_att(slot4, extra_power_data, extra). 
next_to(slot4, slot5). 

instance_of(slot5, slot). 
instance_att(slot5, position, 5). 
instance_att(slot5, length,   short). 
instance_att(slot5, extra_power_data, normal).  
next_to(slot5, slot6). 

instance_of(slot6, slot). 
instance_att(slot6, position, 6). 
instance_att(slot6, length,   short). 
instance_att(slot6, extra_power_data, normal).  

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% OVERALL constraint for a goal state: 
%% i.e. must have a processor, disk_controller and an io, 
%% this is independent of the customer, or the mother
%% board type. Notice that a class type has been specified
%% because we may not know if there is such a board in 
%% stock. 

static_constraint([], [allocate(processor,        Slot1),
                       allocate(disk_controller,  Slot2),
                       allocate(io,               Slot3),
                       total_cost(Cost)]). 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Dynamic constraint: 
%% constraint that may be negociatable, 
%% e.g. less than 500 pounds, and with sound card. 
%% The specificaton for capability is the "minimum specification", 
%% i.e. it is possible that a card that has more than one
%% capabilities. 

dynamic_constraint([], [total_cost(Cost), 
                        less_than(Cost, 500), 
                        allocate(Board, _),
                        property(Board, capability, [sound])
                       ]). 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% initial state

initial_state([total_cost(0)]). 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% end of file 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



</pre></body></html>