%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Representation of PC Configuration Example % Definition of The Domain % % Jessica Chen-Burger % % In this document, we will adopt a convention that words starting % with a capital letter stand for variables, whereas words starting % with a lower case letter stand for constants. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % (1) def_predicate(Predicate, A_list_of_definition_for_predicate) % % The def_predicate/2 defines other predicates. % % The content in the Definition_for_predicate defines the Predicate, % where the "," symbol denotes conjunction, ";" denotes disjunction, % and predicate not/1 denotes negation. % % The predicate exist/1 denotes the existential quantification, % predicate forall/1 denotes the universal quantification. When no % quantification predicates are used, all variables are universally % quantified. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % class_rel(Relationship, Sub_class, Super_class) def_predicate(class(X), [atomic(X)]). def_predicate(class_rel(is_a, X, Y), [class(X), class(Y)]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (2) axiom(Conclusion, Hypothesis) % % The axiom/2 defines other predicates. % % The content stores in the Hypothesis implies the Conclusion. % Rules for describing the Hypothesis is the same as it is described % in the A_list_of_definition_for_predicate in predicate % def_predicate/2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The is_a/2 predicate is transitive axiom(class_rel(is_a, X, Z), [class_rel(is_a, X, Y), class_rel(is_a, Y, Z)]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Property name of a class is normally a string which is represented % here as an atom, i.e. constants connected by under scores. def_predicate(string(X), [atom(X)]). def_predicate(property_name(X), [string(X)]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Property value is either an atom, number or a compounded % term def_predicate(constant(X), [atomic(X)]). def_predicate(property_value(X), [atomic(X); compound(X)]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % att_domain(Class, Attribute_name, Attribute_value) % % Defining the attributes for instances and the domain for the % attribute value. def_predicate(att_domain(X, Y, Z), [class(X), attribute_name(Y), value_domain(Z)] ). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % property(Class, Property_name, Property_value) def_predicate(property(X, Y, Z), [class(X), property_name(Y), property_value(Z)]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def_predicate(instance(X), [atomic(X)]). def_predicate(instance_of(X, Y), [instance(X), class(Y) ]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Description of boards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% class(board). class(processor). class_rel(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). class_rel(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). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def_predicate(allocate(X, Y), [instance_of(X, board), instance_of(Y, slot) ]). def_predicate(next_to(X,Y), [instance_of(X, slot), instance_of(Y, slot) ]) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % static_constraint(List_of_types_of_variables, % List_of_hypothesis, % List_of_conclusions) % % 1. For all constraint rules, unless stated, all % variables are universaly quantified. % 2. The existence quantification is defined using the % predicate exist/1. % 3. The universal quantification is defined using the % predicate forall/1. % 4. When quantifications are involved in a complicated % ordered sequence, such order is specified in % the order described in the List_of_hypothesis. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% static_constraint([slot(Slot1), slot(Slot2)], [allocate(disk_controller, Slot1), allocate(processor, Slot2)], [next_to(Slot1, Slot2)]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Axiom of predicate next_to(A, B). Not used. % % next_to(A, B) :- % instance_of(A, slot), % instance_of(B, slot), % ( next_to(A, B); % next_to(B, A)). % axiom(next_to(A, B), [ not(A = B) ]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Definition of predicate: % allocate(Board, Slot): % A Board (type) has been allocated to a Slot. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% class(io). class_rel(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). class_rel(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([slot(Slot1), slot(Slot2)], [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). class_rel(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). class_rel(is_a, optionIII, board). property(optionIII, capability, [sound]). property(optionIII, length, long). property(optionIII, extra_power_data, normal). property(optionIII, cost, 50). static_constraint([slot(Slot1), slot(Slot2)], [allocate(optionIII, Slot1), allocate(io, Slot2)], [next_to(Slot1, Slot2]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% class(optionIV). class_rel(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([slot(Slot1), slot(Slot2)], [allocate(optionIV, Slot1), allocate(disk_controller, Slot2)], [next_to(Slot1, Slot2)]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def_predicate(has(X, Y), [instance(X), instance(y) ]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def_predicate(attribute_name(Y), [string(Y)]). def_predicate(attribute_value(X), [atomic(X); compound(X)]). def_predicate(instance_att(X, Y, Z), [instance(X), attribute_name(Y), attribute_value(Z) ]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 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). class_rel(is_a, mother_board, device). class(slot). class_rel(is_a, slot, device). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 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. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % def_predicate(Predicate_name, Definition_for_the_predicate %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def_predicate(cost(X), [number(X); real(X)]). def_predicate(total_cost(X), [number(X); real(X)]). def_predicate(less_than(X), [number(X); real(X)]). def_predicate(special_req(X, Y, Z), [property(X, Y, _), property_value(Z)]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% static_constraint([slot(Slot1), slot(Slot2), slot(Slot3), cost(Cost)], [], [allocate(processor, Slot1), allocate(disk_controller, Slot2), allocate(io, Slot3), total_cost(Cost)]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % end of file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%