XPRBsol
| XPRBsol | 
  Description
 
 
 Methods for defining, modifying and accessing
 solutions. Note that all variables in a solution must belong to the same problem as the solution itself.
 
 
  Constructors
 
  
  Methods
 
  
 Delete a variable from a solution.
  
 Get the size of a solution.
  
 Get the value assigned to a variable in a solution.
  
 Test the validity of the solution object.
  
 Print out a solution
  
 Reset the solution object.
  
 Set a variable to the given value in a solution.
 
 Constructor detail
 
 | 
     XPRBsol
     | |||
| 
     Synopsis
     | 
     XPRBsol();
      XPRBsos(xbsol *s); | ||
| 
     Argument
     | 
 | ||
| 
     Description
     | 
     Create a new solution object.
     | ||
|  | |||
 Method detail
 | 
     delVar
     | |||||||
| 
     Synopsis
     | 
     int delVar(XPRBvar& var);
     | ||||||
| 
     Argument
     | 
 | ||||||
| 
     Return value
     | 
      0 if method executed successfully, 1 otherwise.
      | ||||||
| 
     Description
     | |||||||
| 
     Example
     | 
      See
      XPRBsol.setVar.
       | ||||||
| 
     Related topics
     | 
      Calls
     XPRBdelsolvar
      | ||||||
| 
     getSize
     | |||||||
| 
     Synopsis
     | 
     int getSize();
     | ||||||
| 
     Return value
     | 
      Size (= number of variables assigned to a value) of the solution, or -1 in case of an error.
      | ||||||
| 
     Description
     | |||||||
| 
     Example
     | 
      See
      XPRBsol.setVar.
       | ||||||
| 
     Related topics
     | 
      Calls
     XPRBgetsolsize
      | ||||||
| 
     getVar
     | |||||||
| 
     Synopsis
     | 
     int getVar(XPRBvar& var, double *val);
     | ||||||
| 
     Arguments
     | 
 | ||||||
| 
     Return value
     | 
 | ||||||
| 
     Description
     | |||||||
| 
     Example
     | 
      See
      XPRBsol.setVar.
       | ||||||
| 
     Related topics
     | 
      Calls
     XPRBgetsolvar
      | ||||||
| 
     isValid
     | |||||||
| 
     Synopsis
     | 
     bool isValid();
     | ||||||
| 
     Return value
     | 
      true if object is valid,
      false otherwise.
      | ||||||
| 
     Description
     | |||||||
| 
     print
     | |||||||
| 
     Synopsis
     | 
     int print();
     | ||||||
| 
     Return value
     | 
      0 if function executed successfully, 1 otherwise.
      | ||||||
| 
     Description
     | 
     
     This method prints out a solution (note that
     XPRBsol solutions represent user-defined solutions to be passed to the Optimizer, not solutions coming from the Optimizer). A solution is printed as a sequence like "
     varname =
     value, ... ". If the solution doesn't contain any variable, only an empty line is printed.. It is not available in the
     student version.
     | ||||||
| 
     Example
     | 
      See
      XPRBsol.setVar.
       | ||||||
| 
     Related topics
     | 
      Calls
     XPRBprintsol
      | ||||||
| 
     reset
     | |||||||
| 
     Synopsis
     | 
     void reset();
     | ||||||
| 
     Description
     | |||||||
| 
     Example
     | 
      See
      XPRBsol.setVar.
       | ||||||
| 
     Related topics
     | 
      Calls
     XPRBdelsol
      | ||||||
| 
     setVar
     | |||||||
| 
     Synopsis
     | 
     int setVar(XPRBvar& var, double val);
     | ||||||
| 
     Arguments
     | 
 | ||||||
| 
     Return value
     | 
      0 if method executed successfully, 1 otherwise.
      | ||||||
| 
     Description
     | |||||||
| 
     Example
     | 
      This example sets variable x and y in solution
      sol1 and then changes them.
       XPRBvar x, y;
XPRBsol sol1;
XPRBprob prob("myprob");
double d;
x = prob.newVar("x", XPRB_PL, 0, 200);
y = prob.newVar("y", XPRB_PL, 0, 200);
sol1 = prob.newSol();
sol1.setVar(x, 7.0);
sol1.setVar(y, 15.0);
cout << "Sol1: ";
sol1.print();                         // Sol1: x = 7, y = 15
sol1.setVar(x, 10.0);
sol1.getVar(x, &d);
cout << "In sol1, x = " << d << endl; // In sol1, x = 10
sol1.delVar(y);
cout << "Sol1: ";
sol1.print();                         // Sol1: x = 10
sol1.reset(); | ||||||
| 
     Related topics
     | 
      Calls
     XPRBsetsolvar
      | ||||||
|  | |||||||
 
