document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. using Microsoft.SolverFoundation.Services;
  2. using System;
  3.  
  4. namespace Foundation
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             // gifle:         50 lignes de code en+ par jour, 2 bugs en+ par jour
  11.             // coup de pied: 100 lignes de code en+ par jour, 5 bugs en+ par jour
  12.             // tazer:        200 lignes de code en+ par jour, 11 bugs en+ par jour
  13.  
  14.             var context = SolverContext.GetContext();
  15.             var model = context.CreateModel();
  16.  
  17.             // Création des décisions que le système doit prendre (les résultats)
  18.             var gifles = new Decision(Domain.IntegerNonnegative, "gifles");
  19.             var pieds = new Decision(Domain.IntegerNonnegative, "pieds");
  20.             var tazer = new Decision(Domain.IntegerNonnegative, "tazer");
  21.             model.AddDecisions(gifles, pieds, tazer);
  22.  
  23.             var productivite = gifles * 50 + pieds * 100 + tazer * 200;
  24.             var bugs = gifles * 2 + pieds * 5 + tazer * 11;
  25.             var coups = gifles + pieds + tazer;
  26.  
  27.             model.AddGoal("productivite", GoalKind.Maximize, productivite);
  28.             model.AddGoal("bugs", GoalKind.Minimize, bugs);
  29.             model.AddGoal("coups", GoalKind.Minimize, coups);
  30.  
  31.             model.AddConstraints("conventionTaz", tazer <= 2);
  32.             model.AddConstraints("conventionSyntouxe", coups <= 10);
  33.             model.AddConstraints("qualite", bugs <= 50);
  34.  
  35.             var solution = context.Solve();
  36.             solution.GetReport().WriteTo(Console.Out);
  37.  
  38.             Console.ReadKey();
  39.         }
  40.     }
  41. }
');