       tf.set 'B', tfB
       tf.set 'C', tfC
       tf.computeCoordinates(tfA, tfB, tfC)
-      isOptimal = self.checkTargetFunctionOnOptimalMax(tf, points)
+      if(type is "max")
+        isOptimal = self.checkTargetFunctionOnOptimalMax(tf, points)
+      else if (type is "min")
+        isOptimal = self.checkTargetFunctionOnOptimalMin(tf, points)
       if(isOptimal)
         @set 'pointOptimalSolution', point
         return tf

          window.board.removeObject(intersection)
    @removeRepeated(intersections)
    @checkPointsInInequalities(intersections, inequalities)
    tf = @findOptimalSolution(inequalities, targetFunctionInequality, intersections, lineList)
    console.log "End"
    return tf


      if(isOptimal)
        pointX = point.X()
        tfY = ((-tfA / tfB * pointX) + (tfC / tfB))
        tfY -= 0.000001
        if point.Y() < tfY
          isOptimal = no
        return
      return
    isOptimal

  findOptimalSolution: (inequalities, targetFunctionInequality, points, lineList, type)->
    self = @
    isOptimal = yes
    targetFunction = null
