message: improved nonlinear cg example
diff: // copied, modified, or distributed except according to those terms.
  extern crate argmin;
  -extern crate argmin_testfunctions;
  -extern crate rand;
  -use argmin::solver::conjugategradient::*;
  -use argmin_testfunctions::{rosenbrock_2d, rosenbrock_2d_derivative};
  -// use argmin_testfunctions::{sphere, sphere_derivative};
  -// use argmin_core::WriteToFile;
  use argmin::prelude::*;
  +use argmin::solver::conjugategradient::NonlinearConjugateGradient;
  +use argmin::testfunctions::{rosenbrock_2d, rosenbrock_2d_derivative};
  #[derive(Clone)]
  -struct MyProblem {}
  +struct Rosenbrock {}
  -impl ArgminOperator for MyProblem {
  +impl ArgminOperator for Rosenbrock {
  type Parameters = Vec<f64>;
  type OperatorOutput = f64;
  type Hessian = ();
  @@ -32,24 +28,45 @@ impl ArgminOperator for MyProblem {
  }
  fn run() -> Result<(), Error> {
  - // definie inital parameter vector
  + // Set up cost function
  + let operator = Rosenbrock {};
  +
  + // define inital parameter vector
  let init_param: Vec<f64> = vec![1.2, 1.2];
  - let operator = MyProblem {};
  - // Set up Conjugate Gradient method
  - let iters = 20;
  + // Set up nonlinear conjugate gradient method
  let mut solver = NonlinearConjugateGradient::new_pr(&operator, init_param)?;
  - solver.set_max_iters(iters);
  +
  + // Set maximum number of iterations
  + solver.set_max_iters(20);
  +
  + // Set target cost function value
  solver.set_target_cost(0.0);
  +
  + // Set the number of iterations when a restart should be performed
  + // This allows the algorithm to "forget" previous information which may not be helpful anymore.
  solver.set_restart_iters(10);
  +
  + // Set the value for the orthogonality measure.
  + // Setting this parameter leads to a restart of the algorithm (setting beta = 0) after two
  + // consecutive search directions are not orthogonal anymore. In other words, if this condition
  + // is met:
  + //
  + // `|\nabla f_k^T * \nabla f_{k-1}| / | \nabla f_k ||^2 >= v`
  + //
  + // A typical value for `v` is 0.1.
  solver.set_restart_orthogonality(0.1);
  - // solver.add_writer(WriteToFile::new());
  +
  + // Attach a logger
  solver.add_logger(ArgminSlogLogger::term());
  - // solver.add_logger(ArgminSlogLogger::file("file.log")?);
  +
  + // Run solver
  solver.run()?;
  // Wait a second (lets the logger flush everything before printing to screen again)
  std::thread::sleep(std::time::Duration::from_secs(1));
  +
  + // Print result
  println!("{:?}", solver.result());
  Ok(())
  }
  