Commits

Lev Panov  committed eee1768

condmin minor upd

  • Participants
  • Parent commits 31a1506

Comments (0)

Files changed (1)

File labs/cpplex/condmin/condmin.cc

         Implementation of the class that will incapsulate the
         convex comditional minimization problem solving behavior.
     */
-#if 0
+
 Condmin::Condmin(char const * name)
     : name(name),
       solution_dimension(0),
     long double bound;
     
     /// Set four constraints
+    //  2x - y <= 40    y >= 2x - 40
+    // -7x + y <= 25    y <= 7x + 25
+    //  5x + y <= 1000  y <= -5x + 100
     coefficients(0) =    2.0;
-    coefficients(1) =   -1.0;
+    coefficients(1) =   -1.0;    
 //    bound = 20.0; // xxx task
     bound = -40.0;
     add_constraint( Constraint( coefficients, CT_LESS_EQUAL, bound ) );
 //    bound = 60.0;
 //    add_constraint( Constraint( coefficients, CT_MORE_EQUAL, bound ) );
     
-    coefficients(0) =    5.0;
+    coefficients(0) =    5.0;  /// minus
     coefficients(1) =    1.0;
 //    bound = 200.0;
-    bound = 1000.0;
+    bound = 1200.0;              /// 100
     add_constraint( Constraint( coefficients, CT_LESS_EQUAL, bound ) );
     
     /// FIXME: define objective function here somehow
 //       printf("step=%02d: x=(%2.6lf,%2.6lf,%2.6lf,%2.6lf), f=%4.5lf, nu=%2.6lf", step, x[0], x[1], x[2], x[3], f_val, nu);
 //       printf(", diff=%1.7lf\n", alpha * s.Length());
         
-       /// Cheat a bit
-//       if (step == 1)
-//           break;
+       if (step == 1)
+           break;
     } while(dist(x, xp) > eps); /*while (nu <= -eps);*/
 //    } while (dot(g, x - xp) <= -eps);
  
     // xxx task
 //    x(0) = 25.0;
 //    x(1) = 55.0;
-    x(0) = 120.0;
-    x(1) = 570.0;
+    
+//    x(0) = 120.0;
+//    x(1) = 570.0;
+
+    x(0) = 120;
+    x(1) = 510;
+    
     return x;
 }
 
     /// Ok, we've done it
     return aux.solution;
 }
-#endif
+
 
 // 1D minimization on segment [point; point+dir]
 long double Condmin::rayMinimize( Matrix const & point, Matrix const & dir )