Initializing help system before first use

XPRMModel

  • java.lang.Object
    • com.dashoptimization.XPRMModel
  • All Implemented Interfaces:
    java.lang.Runnable


    public class XPRMModel
    extends java.lang.Object
    implements java.lang.Runnable
    A model in Mosel. This class contains the methods for executing models with Mosel.
    • Method Detail

      • bind

        public void bind(java.lang.String name,
                         java.lang.Object obj)
        Bind an object to a name. This method is used to associate a string with an object. This name can then be used to locate the object from this model especially when using the 'java' IO driver. The association cannot be used by other models.
        Parameters:
        name - name to be used as the reference
        obj - object associated to the name
        See Also:
        unbind(java.lang.String)
      • unbind

        public void unbind(java.lang.String name)
        Delete an association name-object. This method should be called once a name is not to be used again with this model so the object can be released.
        Parameters:
        name - name of the association to be removed
        See Also:
        bind(java.lang.String, java.lang.Object)
      • setExecParam

        public void setExecParam(java.lang.String name,
                                 int value)
        Add or update the value associated to an execution parameter. This routine adds or replace the assignment name=value in the execution parameter string ( execParams).
        Parameters:
        name - name of the parameter.
        value - value.
      • setExecParam

        public void setExecParam(java.lang.String name,
                                 double value)
        Add or update the value associated to an execution parameter. This routine adds or replace the assignment name=value in the execution parameter string ( execParams).
        Parameters:
        name - name of the parameter.
        value - value.
      • setExecParam

        public void setExecParam(java.lang.String name,
                                 boolean value)
        Add or update the value associated to an execution parameter. This routine adds or replace the assignment name=value in the execution parameter string ( execParams).
        Parameters:
        name - name of the parameter.
        value - value.
      • setExecParam

        public void setExecParam(java.lang.String name,
                                 java.lang.String value)
        Add or update the value associated to an execution parameter. This routine adds or replace the assignment name=value in the execution parameter string ( execParams).
        Parameters:
        name - name of the parameter.
        value - value.
      • resetExecParam

        public void resetExecParam(java.lang.String name)
        Remove the value associated to an execution parameter. This routine removes the assignment name=value from the execution parameters string ( execParams). No operation is performed if the parameter does not appear in the string.
        Parameters:
        name - name of the parameter.
      • clearExecParams

        public void clearExecParams()
        Clear the execution parameters string.
      • run

        public void run()
        Run the model. This method starts the execution of the model. The model parameters are initialised using execParams. If the model has been compiled with debug information and a debugger object debugger has been set up, the execution is started in debug mode: whenever the model is interrupted, the debugger function is called. Execution may be interrupted by calling stop(). After this function returns, execution status may be retrieved using getExecStatus() and result can be obtained with getExitCode() ( i.e. the parameter value of the Mosel exit procedure).
        Specified by:
        run in interface  java.lang.Runnable
      • setBreakpoint

        public int setBreakpoint(XPRMLocation l)
        Set a breakpoint at the specified location. Execution is interrupted when a breakpoint is reached. Breakpoints can be installed both before and during execution (from the debugger). Breakpoinst can be removed using clearBreakpoint(com.dashoptimization.XPRMLocation) or clearAllBreakpoints(). The model has to be compiled with option "-G" for this function to be effective.
        Parameters:
        l - location for the breakpoint
        Returns:
        0 if successful 1 otherwise (usually the model has not been compiled with option "-g")
        See Also:
        debugger
      • setStackFrame

        public XPRMLocation setStackFrame(int level)
        Set the current stack frame to the specified level. This function changes the current stack frame of the program: the initial level is 0, positive values indicate higher levels. The location returned corresponds to the function call or the current statement if the level is 0. Changing the stack frame modifies the behaviour of findIdentifier(java.lang.String) regarding local symbols: symbols returned are those of the specified stack level and not those of the interruption (level 0). This function can be called only from the debugger function.
        Parameters:
        level - newt stack frame level
        Returns:
        A location object corresponding to the current statement at the specified level or null if the level is not valid
      • getLocation

        public XPRMLocation getLocation(int lindex)
        Create a location based on a line index. All statements of a model and numbered from 0 to lastLineIndex. This function can be used to generate a location object (which provides information on the location of the statement in terms of line number and file name) based on a line index.
        Parameters:
        lindex - index for which a location is requested
        Returns:
        A new location object
      • stop

        public void stop()
        Interrupt execution.
      • isRunning

        public boolean isRunning()
        Check whether the model is being executed.
        Returns:
        true if model is running
      • reset

        public void reset()
        Reset model. Restore the state of the model before it was executed: all data is released, problems are cleared.
      • getVersion

        public XPRMVersion getVersion()
        Get Model version.
        Returns:
        Version information as a version object
      • getResult

        public int getResult()
        Get the result of the execution of the model. This method returns the result of the execution of a model ( i.e. the parameter value of the exit procedure) with method run().
        Returns:
        Result as an integer. If procedure exit has not been called in the model, the default value of 0 is returned.
      • getExitCode

        public int getExitCode()
        Get the result of the execution of the model. This method returns the result of the execution of a model ( i.e. the parameter value of the exit procedure) with method run().
        Returns:
        Result as an integer. If procedure exit has not been called in the model, the default value of 0 is returned.
      • getExecStatus

        public int getExecStatus()
        Get execution status. The execution status indicates whether the execution terminated normally.
        Returns:
        Execution status as an integer:
      • getProblemStatus

        public int getProblemStatus()
        Get active problem status after execution.
        Returns:
        Problem status as an integer:
      • solutionAvailable

        public boolean solutionAvailable()
        Check whether a solution is available.
        Returns:
        true if a solution is available
      • problemIsValid

        public boolean problemIsValid()
        Check whether the problem in the optimizer is valid. The problem may have been modified between the last optimisation and the end of the execution. In this case the solution returned may not be valid.
        Returns:
        true if the problem loaded into the optimizer corresponds to the problem stored in Mosel
      • getObjectiveValue

        public double getObjectiveValue()
        Get objective value of the active problem.
        Returns:
        Objective value or 0 if no problem has been solved
      • getName

        public java.lang.String getName()
        Get name of the model. This name is generated automatically when the model is loaded into memory.
        Returns:
        Name of the model as a string
      • getSysComment

        public java.lang.String getSysComment()
        Get system comment. The system comment is generated by the compiler.
        Returns:
        System comment as a string
      • getKeyFingerprint

        public java.lang.String getKeyFingerprint()
        Get key fingerprint. Fingerprint of the key used to sign the bim file
        Returns:
        Key fingerprint as a string of hexadecimal digits or null if the bim file was not signed
      • isEncrypted

        public boolean isEncrypted()
        Check whether the bim file was encrypted.
        Returns:
        true if the bim file was encrypted
      • isSigned

        public boolean isSigned()
        Check whether the bim file was signed.
        Returns:
        true if the bim file was signed
      • isSignatureVerified

        public boolean isSignatureVerified()
        Check whether the bim file signature has been verified.
        Returns:
        true if the bim file signature has been verified
      • isSignatureChecked

        public boolean isSignatureChecked()
        Check whether the bim file signature has been checked.
        Returns:
        true if the bim file signature has been checked
      • getNumber

        public int getNumber()
        Get model number. An order number is assigned to the model when it is loaded into memory.
        Returns:
        model number
      • getSize

        public long getSize()
        Get model size. This is the amount of memory (in bytes) used by the model. Note that memory allocated by modules is not counted (for instance memory used by the optimizer is not reported by this method).
        Returns:
        Amount of memory used in bytes
      • setDefaultStream

        public void setDefaultStream(int wmd,
                                     java.lang.String fileName)
                              throws java.io.IOException
        Set default input/output streams. This method defines the default streams that are opened when execution of the model starts. Using an empty string as the file name implies resetting to the corresponding original default stream (defined using XPRM.setDefaultStream(int, java.lang.String)).
        Parameters:
        wmd - stream to be set:
        fileName - extended file name to be used for the stream.
        Throws:
        java.io.IOException - If the stream cannot be set.
        See Also:
        XPRM.setDefaultStream(int, java.lang.String)
      • getAnnotations

        public XPRMAnnotation[] getAnnotations(java.lang.String prefix)
        Get the globally defined annotations.
        Parameters:
        prefix - prefix filter: only annotations which name begins with this prefix will be returned.
        Returns:
        globally defined annotations
      • getAnnotations

        public XPRMAnnotation[] getAnnotations(XPRMIdentifier ident,
                                               java.lang.String prefix)
        Get the annotations associated to the given symbol.
        Parameters:
        ident - identifier to consider
        prefix - prefix filter: only annotations which name begins with this prefix will be returned.
        Returns:
        annotations associated to ident
      • getAnnotations

        public XPRMAnnotation[] getAnnotations(java.lang.String idname,
                                               java.lang.String prefix)
        Get the annotations associated to the given symbol.
        Parameters:
        idname - identifier to consider
        prefix - prefix filter: only annotations which name begins with this prefix will be returned.
        Returns:
        annotations associated to idname
      • identifiers

        public XPRMIdentifiers identifiers()
        Get an iterator to enumerate all identifiers of the model.
        Returns:
        An identifier iterator
      • annotatedIdentifiers

        public XPRMIdentifiers annotatedIdentifiers()
        Get an iterator to enumerate all annotated identifiers of the model.
        Returns:
        An identifier iterator
      • localIdentifiers

        public XPRMIdentifiers localIdentifiers()
        Get an iterator to enumerate all local identifiers of the model in the current context. This method can only be used during a debugging session.
        Returns:
        An identifier iterator
      • findIdentifier

        public XPRMIdentifier findIdentifier(java.lang.String ident)
                                      throws java.util.NoSuchElementException
        Find an identifier of the model.
        Parameters:
        ident - identifier to find
        Returns:
        The identifier object associated to the given string
        Throws:
        java.util.NoSuchElementException - If the identifier cannot be found.
      • findTypeCode

        public int findTypeCode(java.lang.String ident)
                         throws java.util.NoSuchElementException
        Find a code of a type.
        Parameters:
        ident - type name
        Returns:
        The type code associated to the given name
        Throws:
        java.util.NoSuchElementException - If the type does not exist or is not used by the model.
      • parameters

        public XPRMParameters parameters()
        Get an iterator to enumerate all parameters of the model.
        Returns:
        A parameter iterator
      • dependencies

        public XPRMDependencies dependencies()
        Get an iterator to enumerate all dependencies (modules+packages) of the model.
        Returns:
        A dependency iterator
      • requirements

        public XPRMRequirements requirements()
        Get an iterator to enumerate all requirements of the model.
        Returns:
        A requirement iterator
      • selectProblem

        public void selectProblem(XPRMProblem prob)
        Select the active problem. This method can only be used after the execution of the model. It allows to select which problem should be considered for all operations related to problems (like matrix exportation or solution status). The main problem is automatically selected after the end of the execution of a model.
        Parameters:
        prob - a problem reference. If null, the main problem is selected
        Throws:
        java.lang.RuntimeException - If the selection fails
        See Also:
        selectMainProblem()
      • selectProblem

        public void selectProblem(XPRMExternal prob)
        Select the active problem. This method can only be used after the execution of the model. It allows to select which problem should be considered for all operations related to problems (like matrix exportation or solution status). The main problem is automatically selected after the end of the execution of a model.
        Parameters:
        prob - a problem reference. If null, the main problem is selected
        Throws:
        java.lang.RuntimeException - If the selection fails
      • exportProblem

        public void exportProblem(java.lang.String options,
                                  java.lang.String filename)
                           throws java.io.IOException
        Export the active problem to an MPS or LP format matrix file.
        Parameters:
        options - possible values (may be combined e.g. "sp"):
        • "" LP output format, minimization (default)
        • "m" MPS output format
        • "p" maximization (only relevant for LP format - default is minimization)
        • "s" use scrambled names
        filename - file name to use. If null, current default output stream is used
        Throws:
        java.io.IOException - If the file cannot be written.
        java.lang.RuntimeException - If no problem is available.
      • expandType

        public XPRMTyped expandType(int typecode)
        Generate a type object based on a type code designing a user type.
        Parameters:
        typecode - type to expand
        Returns:
        The corresponding type object as a XPRMType, a XPRMNativeType or a XPRMUserType
      • finalize

        public void finalize()
        Finalize the model. This procedure is normally automatically called by the Java Garbage Collector.
        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.