From: Hadrien C. <had...@em...> - 2004-10-25 12:10:01
|
Hello, The api concerning minization and maximization in not yet available on th= e Problem object. However, you can look at the following code which give yo= u an example of minimization. You only need to use the Solver object and specify a couple of options : public static void main(String[] args) { Problem pb =3D new Problem(); IntVar fctObj =3D pb.makeBoundIntVar("objectif",-10,1000); IntVar v1 =3D pb.makeEnumIntVar("v1",1,10); IntVar v2 =3D pb.makeEnumIntVar("v2",-3,10); IntVar v3 =3D pb.makeEnumIntVar("v3",1,10); pb.post(pb.eq(pb.sum(new IntVar[]{v1,v2,v3}),fctObj)); Solver solver =3D pb.getSolver(); solver.setDoMaximize(false); solver.setObjective(fctObj); solver.setRestart(false); solver.setFirstSolution(true); solver.generateSearchSolver(pb); solver.launch(); } regards, Hadrien and guillaume ----- Original Message -----=20 From: "Michel Lema=EEtre" <Mic...@ce...> To: <cho...@li...> Sent: Friday, October 22, 2004 3:46 PM Subject: [Choco-users] maximize/minimize > Is it possible to maximize/minimize in the current > Java version of choco ? > > > Michel Lema=EEtre > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D =3D > ONERA/DCSD/CD Centre de Toulouse > 2 avenue Edouard Belin - B.P. 4025 - 31055 Toulouse Cedex 4, FRANCE > Tel : +33 (0)5 62 25 26 60 Fax : +33 (0)5 62 25 25 64 > Michel . Lemaitre @ cert . fr http://www.cert.fr/dcsd/cd/lemaitre > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IT Product Guide on ITManagersJourna= l > Use IT products in your business? Tell us what you think of them. Give = us > Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more > http://productguide.itmanagersjournal.com/guidepromo.tmpl > _______________________________________________ > Choco-users mailing list > Cho...@li... > https://lists.sourceforge.net/lists/listinfo/choco-users > |