[Coin-SMI] Changing right hand side of inequalities

Alan King kingaj at us.ibm.com
Fri May 27 20:19:53 EDT 2005


That's right:  SmiScnModel::readSmps() will not read all bounds formats 
correctly.  SmiScnModel seems to be working fine, though.

So its better to use the "direct interface pattern".  I have uploaded the 
nice Bug example using this pattern into Coin/Examples/Stoch/stoch.cpp. 

Thanks Francois!

Alan King




Francois Margot <fmargot at andrew.cmu.edu> 
Sent by: coin-smi-bounces at list.coin-or.org
05/20/2005 12:00 PM

To
coin-smi at list.coin-or.org
cc

Subject
[Coin-SMI] Changing right hand side of inequalities







I am trying to change the right hand side of inequalities in the .stoch 
file. 
When working with equalities, everything works as expected, but with 
inequalities, instead of changing the rhs, the code creates a ranged 
constraint. I list below the three input files creating the problem.

The code we use is basically the following:

smi.readSmps(bug);
OsiClpSolverInterface *clp = new OsiClpSolverInterface();
smi.setOsiSolverHandle(*clp);
OsiSolverInterface *osiStoch =smi.loadOsiSolverData();
osiStoch->writeMps("bug");

Using the following files:

----------------------------------------------------------
bug.core file:

NAME    BUG
ROWS
  N  obj
  G  C0
  G  C1
  G  C2
  G  C3
COLUMNS
   x01   obj   1
   x01   C3    1
   x01   C1    1
   x01   C0    1
   x02   obj   1
   x02   C2    1
   x02   C1    1
   x02   C0    1
   x03   obj   1
   x03   C3    1
   x03   C2    1
   x03   C0    1
   x04   obj   0.5
   x04   C3    1
   x04   C1    1
   x05   obj   0.5
   x05   C2    1
   x05   C1    1
   x06   obj   0.5
   x06   C3    1
   x06   C2    1
RHS
  RHS    C0    0
  RHS    C1    1
  RHS    C2    1
  RHS    C3    1
ENDATA
----------------------------------------------------------
bug.stoch file:

NAME          BUG
SCENARIOS     DISCRETE                REPLACE
  SC SCEN01    ROOT           0.500    STG02
     RHS       C1             1.000
     RHS       C2             1.000
     RHS       C3             0.000
  SC SCEN02    ROOT           0.500    STG02
     RHS       C1             0.000
     RHS       C2             1.000
     RHS       C3             0.000 
ENDATA

-----------------------------------------------------------
bug.time:

TIME          BUG
PERIODS       LP
     x01       C0                      STG01
     x04       C1                      STG02 
ENDATA 
-----------------------------------------------------------

bug.mps file obtained:


NAME          BLANK 
ROWS
  N  OBJROW
  G  R0000000
  E  R0000001
  E  R0000002
  L  R0000003
  L  R0000004
  E  R0000005
  L  R0000006
COLUMNS
     C0000000  OBJROW    1.             R0000000  1.
     C0000000  R0000001  1.             R0000003  1.
     C0000000  R0000004  1.             R0000006  1.
     C0000001  OBJROW    1.             R0000000  1.
     C0000001  R0000001  1.             R0000002  1.
     C0000001  R0000004  1.             R0000005  1.
     C0000002  OBJROW    1.             R0000000  1.
     C0000002  R0000002  1.             R0000003  1.
     C0000002  R0000005  1.             R0000006  1.
     C0000003  OBJROW    0.25           R0000001  1.
     C0000003  R0000003  1.
     C0000004  OBJROW    0.25           R0000001  1.
     C0000004  R0000002  1.
     C0000005  OBJROW    0.25           R0000002  1.
     C0000005  R0000003  1.
     C0000006  OBJROW    0.25           R0000004  1.
     C0000006  R0000006  1.
     C0000007  OBJROW    0.25           R0000004  1.
     C0000007  R0000005  1.
     C0000008  OBJROW    0.25           R0000005  1.
     C0000008  R0000006  1. 
RHS
     RHS       R0000001  1.             R0000002  1.
     RHS       R0000005  1. 
RANGES
     RANGE     R0000003   -1.           R0000004   -1.
     RANGE     R0000006   -1. 
ENDATA
------------------------------------------------------------------

Note that R0000001, R0000002, and R0000005 become equalities (instead of 
>= 1)
and R0000003, R0000004, and R0000006 become ranged constraints 
(instead of >= 0).

If the proper way to change the rhs of inequalities is something else, 
I would appreciate a simple example.

Francois
_______________________________________________
Coin-SMI mailing list
Coin-SMI at list.coin-or.org
http://list.coin-or.org/mailman/listinfo/coin-smi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/smi/attachments/20050527/e38e47f6/attachment.html 


More information about the Coin-SMI mailing list