Initializing help system before first use

XPRB

  • java.lang.Object
    • com.dashoptimization.XPRB
  • All Implemented Interfaces:
    XOctrl


    public class XPRB
    extends java.lang.Object
    implements XOctrl
    This class contains the definition of constants and methods for initialization and general settings of BCL.
    • Constructor Detail

      • XPRB

        public XPRB()
             throws XPRBlicenseError
        Generate an XPRB object and initialize BCL. This method must be called first in order to use the library. In applications that create a large number of problems it is recommended to call the initialization once only per process for highest efficiency. The initialization of BCL Java does not initialize the Java interface of Xpress-Optimizer. If direct access to the Optimizer is required, this interface needs to be initialized by a separate call to XPRS.init.
        Throws:
        XPRBlicenseError - If no valid license is available.
    • Method Detail

      • license

        public static XPRBlicense license(java.lang.String path)
        Generate a license object. This method initiates the OEM licensing procedure.
        Parameters:
        path - path to the license file (may be null)
        Returns:
        A new license object.
        See Also:
        license(XPRBlicense lic)
      • setMsgLevel

        public static void setMsgLevel(int level)
        Set the message print level. BCL can produce different types of messages; status information, warnings and errors. This method controls which of these are output. In case of an error, an exception is raised before any message is output by BCL. The text and numbers of errors can be obtained with methods XPRBerror.getMessage() and XPRBerror.getErrorCode() respectively (the same methods apply to XPRBlicenseError).
             XPRB.setMsgLevel(0);
         
        Parameters:
        level - message level (= types of messages printed by BCL). Possible values:
        • 0 disable all output from BCL and Xpress-Optimizer
        • 2 print warnings
        • 3 print warnings and Optimizer log (default)
        • 4 all messages printed
      • setOutputStream

        public static void setOutputStream(java.lang.Object stream)
        Set the output stream object. BCL uses this object whenever it needs to display text (information, warning or error messages). The provided object must implement either a 'void write(String)' method (like in a Writer class) or a 'void print(String)' method (like in a printStream class). Each problem may have its own stream set using the corresponding method in the XPRBprob object.
             XPRB.setOutputStream(System.err);
         
        Parameters:
        stream - an object implementing either a 'write' or 'print' method
        See Also:
        XPRBprob.setOutputStream(java.lang.Object)
      • setRealFmt

        public static void setRealFmt(java.lang.String fmt)
        Set the format for printing real numbers. In problems with very large or very small numbers it may become necessary to change the printing format to obtain a more exact output. In particular, by changing the precision it is possible to reduce the difference between matrices loaded in memory into Xpress-Optimizer and the output produced by exporting them to a file.
             XPRB.setRealFmt("%.10f");
         
        Parameters:
        fmt - format string (as used by the C function printf). Possible values include:
        • "%g" default printing format (precision: 6 digits; exponential notation if the exponent resulting from the conversion is less than -4 or greater than or equal to the precision)
        • "%.numf print real numbers in the style [-]d.d where the number of digits after the decimal point is equal to the given precision num
      • setColOrder

        public static void setColOrder(int num)
        Set a column ordering criterion for matrix generation. BCL runs reproduce always the same matrix for a problem. This method allows the user to choose a different ordering criterion than the default one.
             XPRB.setColOrder(1);
         
        Parameters:
        num - ordering criterion. Possible values:
        • 0 default order
        • 1 alphabetical order
      • getVersion

        public static java.lang.String getVersion()
        Get the version number of BCL. This information is required if the user is reporting a problem.
             String version;
             version = XPRB.getVersion();
             System.out.println("BCL version number:" + version);
         
        Returns:
        BCL version number
      • newProb

        public XPRBprob newProb(java.lang.String name)
        Create and initialize a new problem. The name given to a problem determines the name and the location of the working files of Xpress-Optimizer. At the creation of a problem any existing working files of the same name are deleted. When solving several instances of a problem simultaneously the user must make sure to assign a different name to every instance. If no problem name is indicated, BCL creates a unique name including the full path to the temporary directory (Xpress-Optimizer creates its working files in the temporary directory).
             XPRBprob expl2;
             XPRB bcl;
        
             bcl=new XPRB();
             expl2 = bcl.XPRBprob("example2");
         
        Parameters:
        name - problem name, may be null
      • getTime

        public static int getTime()
        Get the running time.
             int starttime;
             starttime = XPRB.getTime();
             System.out.println("Current run time:" +
                 (XPRB.getTime()-starttime)/1000 + "seconds");
         
        Returns:
        time measure in milliseconds
      • beginLicensing

        public static boolean beginLicensing()
        Begin the OEM licensing process.
        Returns:
        true if no license has been obtained yet
      • endLicensing

        public static void endLicensing()
        End the OEM licensing process.
      • finalize

        public void finalize()
        Finalize BCL. This method is called automatically by the system. If this method is called explicitly from the user's program to force the finalization of BCL (releasing the license) any problems created by the program must have been finalized (see XPRBprob.finalize()) previously and the program must not access any BCL objects after this call.
             XPRB bcl=new XPRB();                // Initialize BCL
             XPRBprob expl2;
             expl2 = new XPRBprob("example2");   // Create a problem
             ...
             prob.finalize();                    // Finalize the problem
             prob=null;
             bcl.finalize();                     // Finalize BCL (release license)
             bcl=null;
         
        Overrides:
        finalize in class  java.lang.Object

© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.