problemset4 - import mit16_410_13.*; import...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import mit16_410_13.*; import java.util.LinkedList; public class ProblemSet4 { public static void main (String [] args) throws Exception { { System.out.println("\nProblem set 4 Problem 1"); Simplex problem=new Simplex(); LinkedList ofl=new LinkedList(); ofl.add(new Variable("x1", 1)); ofl.add(new Variable("x2", 2)); problem.addObjectiveFunction("z", ofl); LinkedList c1l=new LinkedList(); c1l.add(new Variable("x1", 1)); c1l.add(new Variable("x2", 3)); problem.addConstraint("<=", 8, c1l, "y1"); LinkedList c2l=new LinkedList(); c2l.add(new Variable("x1", 1)); c2l.add(new Variable("x2", 1)); problem.addConstraint("<=", 4, c2l, "y2"); problem.describeProblem(System.out); try { problem.solveProblem(); System.out.print("\n\nSolved in "); System.out.print(problem.getSolutionTime()/1000.0); System.out.println(" seconds.\n"); problem.printSolution(System.out); } catch (SimplexException e) { System.out.println("Simplex Exception"); } } { System.out.println("\nProblem set 4 Problem 2"); Simplex problem=new Simplex();
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

problemset4 - import mit16_410_13.*; import...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online