[eclipse-users] Maximization.

From: Amine Marref <marref_at_cs.york.ac.uk>
Date: Sun, 04 Nov 2007 15:16:57 +0000
Hi,

I am new to Eclipse. Is it possible to maximize as opposed to minimize 
an objective function? I have a problem that is solved efficiently with 
an integer programming solver but does not seem to work in Eclipse.

I want to use minimize/2 in order to maximize, for this I invert the 
sign of the cost variable. In the file I attach, the objective is to 
maximize the linear expression "Sum".

Any help?


:- lib(fd).
solve:-
Edges = [E_1,E_2,E_3,E_4,E_5,E_6,E_7,E_8,E_9,E_10,E_11,E_12,E_13,E_14,E_15,E_16,E_17,E_18,E_19,E_20,E_21,E_22,E_23,E_24,E_25,E_26,E_27,E_28,E_29,E_30,E_31,E_32,E_33,E_34,E_35,E_36,E_37,E_38,E_39,E_40,E_41,E_42,E_43,E_44,E_45,E_46,E_47,E_48,E_49,E_50,E_51,E_52,E_53,E_54,E_55,E_56],
Sum :: [1..400000],
Edges :: [0..1000],
E_1 #= 1,
E_56 #= 1,
E_1 - E_2 #= 0,
E_2 + E_53 - E_3 - E_4 #= 0,
E_3 - E_5 #= 0,
E_4 - E_6 - E_7 #= 0,
E_6 - E_8 - E_9 #= 0,
E_8 - E_10 - E_11 #= 0,
E_10 - E_12 #= 0,
E_9 + E_11 + E_12 - E_13 #= 0,
E_7 - E_14 - E_15 #= 0,
E_14 - E_16 - E_17 #= 0,
E_16 - E_18 #= 0,
E_17 + E_18 - E_19 - E_20 #= 0,
E_19 - E_21 #= 0,
E_20 + E_21 - E_22 - E_23 #= 0,
E_22 - E_24 #= 0,
E_23 + E_24 - E_25 #= 0,
E_25 + E_46 - E_26 - E_27 #= 0,
E_26 - E_28 #= 0,
E_27 - E_29 #= 0,
E_29 + E_33 - E_30 - E_31 #= 0,
E_30 - E_32 #= 0,
E_31 - E_33 #= 0,
E_32 - E_35 #= 0,
E_35 + E_39 - E_36 - E_37 #= 0,
E_36 - E_38 #= 0,
E_37 - E_39 #= 0,
E_38 - E_40 - E_41 #= 0,
E_40 - E_42 #= 0,
E_41 + E_42 - E_43 - E_44 #= 0,
E_43 - E_45 #= 0,
E_44 + E_45 - E_46 #= 0,
E_28 - E_47 - E_48 #= 0,
E_47 - E_49 #= 0,
E_48 + E_49 - E_50 - E_51 #= 0,
E_50 - E_52 #= 0,
E_13 + E_15 + E_51 + E_52 - E_53 #= 0,
E_5 - E_54 #= 0,
E_54 - E_56 #= 0,
20*E_2 - E_4 #>= 0,
10*E_25 - E_27 #>= 0,
5*E_29 - E_31 #>= 0,
5*E_35 - E_37 #>= 0,
W_1 #= 32,
W_2 #= 75,
W_53 #= 44,
W_3 #= 47,
W_4 #= 47,
W_6 #= 34,
W_8 #= 34,
W_10 #= 71,
W_9 #= 34,
W_11 #= 71,
W_12 #= 116,
W_7 #= 34,
W_14 #= 47,
W_16 #= 185,
W_17 #= 185,
W_18 #= 119,
W_19 #= 103,
W_20 #= 103,
W_21 #= 100,
W_22 #= 100,
W_23 #= 100,
W_24 #= 103,
W_25 #= 89,
W_46 #= 87,
W_26 #= 47,
W_27 #= 47,
W_29 #= 32,
W_33 #= 23,
W_30 #= 81,
W_31 #= 81,
W_32 #= 20,
W_35 #= 32,
W_39 #= 47,
W_36 #= 81,
W_37 #= 81,
W_38 #= 20,
W_40 #= 47,
W_41 #= 47,
W_42 #= 21,
W_43 #= 47,
W_44 #= 47,
W_45 #= 53,
W_28 #= 20,
W_47 #= 127,
W_48 #= 127,
W_49 #= 24,
W_50 #= 54,
W_13 #= 44,
W_15 #= 47,
W_51 #= 54,
W_52 #= 22,
W_5 #= 20,
W_54 #= 80,
W_56 #= 24,
W_34 #= 0,
W_55 #= 0,

% Objective function
Sum #= W_1*E_1 + W_2*E_2 + W_3*E_3 + W_4*E_4 + W_5*E_5 + W_6*E_6 + W_7*E_7 + W_8*E_8 + W_9*E_9 + W_10*E_10 + W_11*E_11 + W_12*E_12 + W_13*E_13 + W_14*E_14 + W_15*E_15 + W_16*E_16 + W_17*E_17 + W_18*E_18 + W_19*E_19 + W_20*E_20 + W_21*E_21 + W_22*E_22 + W_23*E_23 + W_24*E_24 + W_25*E_25 + W_26*E_26 + W_27*E_27 + W_28*E_28 + W_29*E_29 + W_30*E_30 + W_31*E_31 + W_32*E_32 + W_33*E_33 + W_34*E_34 + W_35*E_35 + W_36*E_36 + W_37*E_37 + W_38*E_38 + W_39*E_39 + W_40*E_40 + W_41*E_41 + W_42*E_42 + W_43*E_43 + W_44*E_44 + W_45*E_45 + W_46*E_46 + W_47*E_47 + W_48*E_48 + W_49*E_49 + W_50*E_50 + W_51*E_51 + W_52*E_52 + W_53*E_53 + W_54*E_54 + W_55*E_55 + W_56*E_56 + 0,
minimize(labeling(Edges),-Sum).
Received on Sun Nov 04 2007 - 15:18:41 CET

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET