FICO
FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Start/stopping Mosel from Excel and capturing output

Description

Not compatible with version of Mosel < 1.4.0.

This example demonstrates the following

  • How to start and stop a mosel model from Excel/VBA
  • How to stop the XPRMrunmod call from locking up the Excel interface
  • How to capture the Mosel output and print to a worksheet and the Immediate window

The I/O driver functionality is used with XPRMsetdefstream to redirect the Mosel output streams to a VB callback function.

Inside this callback function we do 3 tasks.

  1. Print the message to our sheet and the VB editors Immediate window
  2. Check to see if our stop flag has been set and stop Mosel if it has
  3. Call DoEvents to tell Excel to process its Windows message queue and thus service its GUI interface

excelmosel2.zip[download all files]

Source Files
By clicking on a file name, a preview is opened at the bottom of this page.
Model[download]

Data Files





s8els.dat

! Data file for `s8els.mos'

DEMAND:    [ 2  3  5  3  4  2  5  4  1  3  4  2  3  5  2  3  1  2  3  5  
             3  1  2  3  5  3  1  2  3  3  4  5  1  4  1  3  1  2  3  3  
             3  5  2  1  2  1  3  3  5  2  2  1  3  2  3  4  2  5  4  1  
             2  2  1  3  2  1  2  2  3  3  2  2  3  1  2  3  2  1  2  1]

SETUPCOST: [17 14 11  6  9  6 15 10  8  7 12  9 10  8 12  6 10 12  7  9]

PRODCOST:  [ 5  3  2  1  3  1  4  3  2  2  3  1  2  3  2  3  3  2  2  1  
             1  4  2  3  1  3  1  2  3  3  3  4  4  2  2  4  2  3  1  3  
             3  3  3  4  4  3  3  3  2  2  1  1  3  3  3  2  2  3  3  3 
             2  2  2  3  3  3  4  4  4  3  3  2  2  2  3  3  3  4  4  3]

CAP:       [12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12]

ÿÿÿÿ

Back to examples browserPrevious exampleNext example