en pt-br

Main.ComentáriosDaProva History

Hide minor edits - Show changes to markup

June 27, 2008, at 05:12 PM by claudio -
June 27, 2008, at 05:12 PM by claudio -
Added line 4:
Changed lines 10-11 from:
to:
Deleted lines 29-30:

@]

Changed lines 54-55 from:
to:

@]

Added line 58:

[@

Changed line 79 from:

[@

to:
Changed line 91 from:

@]

to:
Changed lines 100-101 from:
to:

@]

June 27, 2008, at 05:10 PM by claudio -
Changed line 4 from:
to:

[@

Changed line 10 from:

/*

to:
Changed lines 30-31 from:
  • /
to:

@]

June 27, 2008, at 05:09 PM by claudio -
Changed line 62 from:
		  Variaveis = [A,B,C],
to:
		  Variaveis = [A,B,C],
Changed lines 65-67 from:
		  tuples_in([ [A, T1]],1, 5],[2,1],[3,3],[4,4],[5,6?), 
		  tuples_in([ [B, T2]], 1,8], [2,8], [3,5], [4,7], [5,3?),
		  tuples_in( [ [C, T3]],1,4],[2, 9], [3,1],[4, 5], [5,2?),
to:
		  tuples_in([ [A, T1]],[ [1, 5],[2,1],[3,3],[4,4],[5,6]]),
		  tuples_in([ [B, T2]], [ [1,8], [2,8], [3,5], [4,7], [5,3]]),
		  tuples_in( [ [C, T3]],[ [1,4],[2, 9], [3,1],[4, 5], [5,2]]),
Changed lines 69-70 from:
		  sum([T1,T2,T3], #>=, 15).
to:
		  sum([T1,T2,T3], #>=, 15).
Changed line 79 from:

[=

to:

[@

Changed lines 81-91 from:
			 Variaveis = [A,B,C],
			Variaveis ins 1 .. 5, 
			all_different(Variaveis),
			tuples_in(A, T1?,1, 5],[2,1],[3,3],[4,4],[5,6?), 
			tuples_in(B, T2?, 1,8], [2,8], [3,5], [4,7], [5,3?),
			tuples_in(C, T3?,1,4],[2, 9], [3,1],[4, 5], [5,2?),
			 T1 + T2 + T3 #>= 15,  OK ou
			sum([T1,T2,T3], #>=, 15),
			labeling([max(T1 + T2 + T3)],  [A,B,C]). , nl, write([A,B,C]).

=]

to:
   		 Variaveis = [A,B,C],
	  	 Variaveis ins 1 .. 5, 
		 all_different(Variaveis),
		 tuples_in(A, T1?,1, 5],[2,1],[3,3],[4,4],[5,6?), 
		 tuples_in(B, T2?, 1,8], [2,8], [3,5], [4,7], [5,3?),
		 tuples_in(C, T3?,1,4],[2, 9], [3,1],[4, 5], [5,2?),
		  T1 + T2 + T3 #>= 15,  OK ou
		 sum([T1,T2,T3], #>=, 15),
		 labeling([max(T1 + T2 + T3)],  [A,B,C]). , nl, write([A,B,C]).

@]

June 27, 2008, at 05:07 PM by claudio -
Changed lines 65-67 from:
		  tuples_in(\[\[A, T1]],1, 5],[2,1],[3,3],[4,4],[5,6?), 
		  tuples_in(\[\[B, T2]], 1,8], [2,8], [3,5], [4,7], [5,3?),
		  tuples_in(\[\[C, T3]],1,4],[2, 9], [3,1],[4, 5], [5,2?),
to:
		  tuples_in([ [A, T1]],1, 5],[2,1],[3,3],[4,4],[5,6?), 
		  tuples_in([ [B, T2]], 1,8], [2,8], [3,5], [4,7], [5,3?),
		  tuples_in( [ [C, T3]],1,4],[2, 9], [3,1],[4, 5], [5,2?),
Changed line 79 from:
to:

[=

Changed line 81 from:
			Variaveis = [A,B,C],
to:
			 Variaveis = [A,B,C],
Added line 91:

=]

June 27, 2008, at 05:05 PM by claudio -
Changed line 62 from:
		  @@Variaveis = [A,B,C],
to:
		  Variaveis = [A,B,C],
Changed lines 64-67 from:
to:
		  all_different(Variaveis),
		  tuples_in(\[\[A, T1]],1, 5],[2,1],[3,3],[4,4],[5,6?), 
		  tuples_in(\[\[B, T2]], 1,8], [2,8], [3,5], [4,7], [5,3?),
		  tuples_in(\[\[C, T3]],1,4],[2, 9], [3,1],[4, 5], [5,2?),
June 27, 2008, at 05:04 PM by claudio -
Changed line 62 from:
		  Variaveis = [A,B,C],
to:
		  @@Variaveis = [A,B,C],
Changed lines 64-67 from:
to:
Changed lines 69-70 from:
		  sum([T1,T2,T3], #>=, 15).
to:
		  sum([T1,T2,T3], #>=, 15).
June 26, 2008, at 08:20 AM by claudio -
Deleted line 58:
Deleted lines 59-61:
Deleted lines 60-62:
Deleted line 61:
Deleted line 62:
Deleted line 63:
Deleted line 64:
Deleted line 65:
Deleted line 66:
Deleted lines 67-69:
Deleted line 68:
Deleted lines 70-73:
Deleted line 71:
Deleted line 72:
Deleted line 73:
Deleted line 74:
Deleted line 75:
Deleted line 76:
Deleted line 77:
Deleted lines 79-80:
Deleted line 80:
Deleted line 81:
Deleted line 82:
Deleted line 83:
Deleted line 84:
Deleted line 85:
Deleted lines 86-88:
Deleted line 87:
Deleted line 88:
Deleted line 93:
Deleted line 94:
Deleted line 95:
Deleted line 96:
Deleted line 97:
June 26, 2008, at 08:16 AM by claudio -
Changed lines 3-4 from:

<verbatim>

to:

Questões 7 e 4:

Changed lines 56-147 from:

</verbatim>

to:

Questão 8:

:- use_module(library(clpfd)).

:- use_module(library(simplex)).

fab([A,B,C]) :-

		  Variaveis = [A,B,C],

		  Variaveis ins 1 .. 5, 

		  all_different(Variaveis),

		  tuples_in(A, T1?,1, 5],[2,1],[3,3],[4,4],[5,6?), 

		  tuples_in(B, T2?, 1,8], [2,8], [3,5], [4,7], [5,3?),

		  tuples_in(C, T3?,1,4],[2, 9], [3,1],[4, 5], [5,2?),



		   T1 + T2 + T3 #>= 15,  OK ou

		  sum([T1,T2,T3], #>=, 15).

parte_1([A,B,C]) :- fab([A,B,C]), labeling([ff], [A,B,C]). %, nl, write([A,B,C]).

/*

?- parte_1(X).

X = [1, 3, 2] ;

X = [1, 4, 2] ;

X = [1, 5, 2] ;

X = [1, 2, 4] ;

  • /

parte_2([A,B,C]) :-

			Variaveis = [A,B,C],

			Variaveis ins 1 .. 5, 

			all_different(Variaveis),

			tuples_in(A, T1?,1, 5],[2,1],[3,3],[4,4],[5,6?), 

			tuples_in(B, T2?, 1,8], [2,8], [3,5], [4,7], [5,3?),

			tuples_in(C, T3?,1,4],[2, 9], [3,1],[4, 5], [5,2?),



			 T1 + T2 + T3 #>= 15,  OK ou

			sum([T1,T2,T3], #>=, 15),

			labeling([max(T1 + T2 + T3)],  [A,B,C]). , nl, write([A,B,C]).

/*

?- parte_2(X).

X = [5, 1, 2] ;

X = [5, 4, 2] ;

X = [1, 4, 2] ;

.................

  • /

Convenhamos que quase todo código foi fornecido na prova!

June 26, 2008, at 08:10 AM by claudio -
Changed line 3 from:

\beginverbatim smiley

to:

<verbatim>

Changed line 55 from:

\endverbatim smiley

to:

</verbatim>

June 26, 2008, at 08:08 AM by claudio -
Added lines 1-55:

A prova em si foi trivial. Bastava ler as partes a serem pesquisadas. As questões práticas, reintero, faltou empenho Prologuiano. Olhem as soluções:

\beginverbatim smiley etiqueta_1([], _) :- !. etiqueta_1( [X|R], L):-

       member(X,L),
       etiqueta_1( R , L).       

/* ?- etiqueta_1([A,B],[77,88,99]). A = 77, B = 77 ; A = 77, B = 88 ; A = 77, B = 99 ; ..... ?- etiqueta_1([A,B],[77]). A = 77, B = 77 ; fail.

?- etiqueta_1([A,B],[]). fail.

?- etiqueta_1([],[]). true.

  • /

todos_dif([], _) :- !. todos_dif( [X|R], L):-

       member(X,L),
       remove(X,L,L1),
       todos_dif( R , L1). 

remove(X,L,L1) :- delete(L,X,L1).

/* ?- todos_dif([A,B,C],[77,88,99,66,44]). A = 77, B = 88, C = 99 ; A = 77, B = 88, C = 66 ; A = 77, B = 88, C = 44 ; .................... bem como: ?- todos_dif([A,B,C],[77,88]). fail.

  • /

\endverbatim smiley