Changeset 1902 for trunk


Ignore:
Timestamp:
Jan 3, 2013 12:07:26 PM (7 years ago)
Author:
stefan
Message:

patch by Miles Lubin to make solve options available in C interface

Location:
trunk/Clp/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/Clp_C_Interface.cpp

    r1901 r1902  
    766766     return model->model_->initialSolve();
    767767}
     768/* Pass solve options. (Exception to direct analogue rule) */
     769COINLIBAPI int COINLINKAGE
     770Clp_initialSolveWithOptions(Clp_Simplex * model, Clp_Solve * s)
     771{
     772     return model->model_->initialSolve(s->options);
     773}
    768774/* Barrier initial solve */
    769775COINLIBAPI int COINLINKAGE
     
    12121218#endif
    12131219
     1220COINLIBAPI Clp_Solve * COINLINKAGE
     1221ClpSolve_new()
     1222{
     1223    return new Clp_Solve();
     1224}
     1225
     1226COINLIBAPI void COINLINKAGE
     1227ClpSolve_delete(Clp_Solve * solve)
     1228{
     1229    delete solve;
     1230}
     1231
     1232// space- and error-saving macros
     1233#define ClpSolveGetIntProperty(prop) \
     1234COINLIBAPI int COINLINKAGE \
     1235ClpSolve_ ## prop (Clp_Solve *s) \
     1236{ \
     1237    return s->options.prop(); \
     1238}
     1239
     1240#define ClpSolveSetIntProperty(prop) \
     1241COINLIBAPI void COINLINKAGE \
     1242ClpSolve_ ## prop (Clp_Solve *s, int val) \
     1243{ \
     1244    s->options.prop(val); \
     1245}
     1246
     1247COINLIBAPI void COINLINKAGE
     1248ClpSolve_setSpecialOption(Clp_Solve * s, int which, int value, int extraInfo)
     1249{
     1250    s->options.setSpecialOption(which,value,extraInfo);
     1251}
     1252
     1253COINLIBAPI int COINLINKAGE
     1254ClpSolve_getSpecialOption(Clp_Solve * s, int which)
     1255{
     1256    return s->options.getSpecialOption(which);
     1257}
     1258
     1259COINLIBAPI void COINLINKAGE
     1260ClpSolve_setSolveType(Clp_Solve * s, int method, int extraInfo)
     1261{
     1262    s->options.setSolveType(static_cast<ClpSolve::SolveType>(method), extraInfo);
     1263}
     1264
     1265ClpSolveGetIntProperty(getSolveType)
     1266
     1267COINLIBAPI void COINLINKAGE ClpSolve_setPresolveType(Clp_Solve * s, int amount, int extraInfo)
     1268{
     1269    s->options.setPresolveType(static_cast<ClpSolve::PresolveType>(amount),extraInfo);
     1270}
     1271
     1272ClpSolveGetIntProperty(getPresolveType)
     1273
     1274ClpSolveGetIntProperty(getPresolvePasses)
     1275
     1276
     1277COINLIBAPI int COINLINKAGE
     1278ClpSolve_getExtraInfo(Clp_Solve * s, int which) {
     1279     return s->options.getExtraInfo(which);
     1280}
     1281
     1282ClpSolveSetIntProperty(setInfeasibleReturn)
     1283ClpSolveGetIntProperty(infeasibleReturn)
     1284
     1285ClpSolveGetIntProperty(doDual)
     1286ClpSolveSetIntProperty(setDoDual)
     1287
     1288ClpSolveGetIntProperty(doSingleton)
     1289ClpSolveSetIntProperty(setDoSingleton)
     1290
     1291ClpSolveGetIntProperty(doDoubleton)
     1292ClpSolveSetIntProperty(setDoDoubleton)
     1293
     1294ClpSolveGetIntProperty(doTripleton)
     1295ClpSolveSetIntProperty(setDoTripleton)
     1296
     1297ClpSolveGetIntProperty(doTighten)
     1298ClpSolveSetIntProperty(setDoTighten)
     1299
     1300ClpSolveGetIntProperty(doForcing)
     1301ClpSolveSetIntProperty(setDoForcing)
     1302
     1303ClpSolveGetIntProperty(doImpliedFree)
     1304ClpSolveSetIntProperty(setDoImpliedFree)
     1305
     1306ClpSolveGetIntProperty(doDupcol)
     1307ClpSolveSetIntProperty(setDoDupcol)
     1308
     1309ClpSolveGetIntProperty(doDuprow)
     1310ClpSolveSetIntProperty(setDoDuprow)
     1311
     1312ClpSolveGetIntProperty(doSingletonColumn)
     1313ClpSolveSetIntProperty(setDoSingletonColumn)
     1314
     1315ClpSolveGetIntProperty(presolveActions)
     1316ClpSolveSetIntProperty(setPresolveActions)
     1317
     1318ClpSolveGetIntProperty(substitution)
     1319ClpSolveSetIntProperty(setSubstitution)
     1320
    12141321#if defined(__MWERKS__)
    12151322#pragma export off
  • trunk/Clp/src/Clp_C_Interface.h

    r1901 r1902  
    1212#include "Coin_C_defines.h"
    1313
     14#if defined (CLP_EXTERN_C)
     15typedef struct {
     16  ClpSolve options;
     17} Clp_Solve;
     18#else
     19typedef void Clp_Solve;
     20#endif
     21
    1422/** This is a first "C" interface to Clp.
    1523    It has similarities to the OSL V3 interface
     
    2331     /**@name Constructors and destructor
    2432        These do not have an exact analogue in C++.
    25         The user does not need to know structure of Clp_Simplex.
    26 
    27         For all functions outside this group there is an exact C++
     33        The user does not need to know structure of Clp_Simplex or Clp_Solve.
     34
     35        For (almost) all Clp_* functions outside this group there is an exact C++
    2836        analogue created by taking the first parameter out, removing the Clp_
    2937        from name and applying the method to an object of type ClpSimplex.
     38       
     39        Similarly, for all ClpSolve_* functions there is an exact C++
     40        analogue created by taking the first parameter out, removing the ClpSolve_
     41        from name and applying the method to an object of type ClpSolve.
    3042     */
    3143     /*@{*/
     
    3547     /** Destructor */
    3648     COINLIBAPI void COINLINKAGE Clp_deleteModel(Clp_Simplex * model);
     49     /** Default constructor */
     50     COINLIBAPI Clp_Solve * COINLINKAGE ClpSolve_new();
     51     /** Destructor */
     52     COINLIBAPI void COINLINKAGE ClpSolve_delete(Clp_Solve * solve);
    3753     /*@}*/
    3854
     
    258274      */
    259275     COINLIBAPI int COINLINKAGE Clp_initialSolve(Clp_Simplex * model);
     276     /** Pass solve options. (Exception to direct analogue rule) */
     277     COINLIBAPI int COINLINKAGE Clp_initialSolveWithOptions(Clp_Simplex * model, Clp_Solve *);
    260278     /** Dual initial solve */
    261279     COINLIBAPI int COINLINKAGE Clp_initialDualSolve(Clp_Simplex * model);
     
    401419     COINLIBAPI void COINLINKAGE Clp_setSmallElementValue(Clp_Simplex * model, double value);
    402420     /*@}*/
     421
     422     
     423     /**@name Get and set ClpSolve options
     424     */
     425     /*@{*/
     426     COINLIBAPI void COINLINKAGE ClpSolve_setSpecialOption(Clp_Solve *, int which, int value, int extraInfo);
     427     COINLIBAPI int COINLINKAGE ClpSolve_getSpecialOption(Clp_Solve *, int which);
     428
     429     /** method: (see ClpSolve::SolveType)
     430         0 - dual simplex
     431         1 - primal simplex
     432         2 - primal or sprint
     433         3 - barrier
     434         4 - barrier no crossover
     435         5 - automatic
     436         6 - not implemented
     437       -- pass extraInfo == -1 for default behavior */
     438     COINLIBAPI void COINLINKAGE ClpSolve_setSolveType(Clp_Solve *, int method, int extraInfo);
     439     COINLIBAPI int COINLINKAGE ClpSolve_getSolveType(Clp_Solve *);
     440
     441     /** amount: (see ClpSolve::PresolveType)
     442         0 - presolve on
     443         1 - presolve off
     444         2 - presolve number
     445         3 - presolve number cost
     446       -- pass extraInfo == -1 for default behavior */
     447     COINLIBAPI void COINLINKAGE ClpSolve_setPresolveType(Clp_Solve *, int amount, int extraInfo);
     448     COINLIBAPI int COINLINKAGE ClpSolve_getPresolveType(Clp_Solve *);
     449
     450     COINLIBAPI int COINLINKAGE ClpSolve_getPresolvePasses(Clp_Solve *);
     451     COINLIBAPI int COINLINKAGE ClpSolve_getExtraInfo(Clp_Solve *, int which);
     452     COINLIBAPI void COINLINKAGE ClpSolve_setInfeasibleReturn(Clp_Solve *, int trueFalse);
     453     COINLIBAPI int COINLINKAGE ClpSolve_infeasibleReturn(Clp_Solve *);
     454
     455     COINLIBAPI int COINLINKAGE ClpSolve_doDual(Clp_Solve *);
     456     COINLIBAPI void COINLINKAGE ClpSolve_setDoDual(Clp_Solve *, int doDual);
     457
     458     COINLIBAPI int COINLINKAGE ClpSolve_doSingleton(Clp_Solve *);
     459     COINLIBAPI void COINLINKAGE ClpSolve_setDoSingleton(Clp_Solve *, int doSingleton);
     460
     461     COINLIBAPI int COINLINKAGE ClpSolve_doDoubleton(Clp_Solve *);
     462     COINLIBAPI void COINLINKAGE ClpSolve_setDoDoubleton(Clp_Solve *, int doDoubleton);
     463
     464     COINLIBAPI int COINLINKAGE ClpSolve_doTripleton(Clp_Solve *);
     465     COINLIBAPI void COINLINKAGE ClpSolve_setDoTripleton(Clp_Solve *, int doTripleton);
     466
     467     COINLIBAPI int COINLINKAGE ClpSolve_doTighten(Clp_Solve *);
     468     COINLIBAPI void COINLINKAGE ClpSolve_setDoTighten(Clp_Solve *, int doTighten);
     469
     470     COINLIBAPI int COINLINKAGE ClpSolve_doForcing(Clp_Solve *);
     471     COINLIBAPI void COINLINKAGE ClpSolve_setDoForcing(Clp_Solve *, int doForcing);
     472
     473     COINLIBAPI int COINLINKAGE ClpSolve_doImpliedFree(Clp_Solve *);
     474     COINLIBAPI void COINLINKAGE ClpSolve_setDoImpliedFree(Clp_Solve *, int doImpliedFree);
     475     
     476     COINLIBAPI int COINLINKAGE ClpSolve_doDupcol(Clp_Solve *);
     477     COINLIBAPI void COINLINKAGE ClpSolve_setDoDupcol(Clp_Solve *, int doDupcol);
     478     
     479     COINLIBAPI int COINLINKAGE ClpSolve_doDuprow(Clp_Solve *);
     480     COINLIBAPI void COINLINKAGE ClpSolve_setDoDuprow(Clp_Solve *, int doDuprow);
     481
     482     COINLIBAPI int COINLINKAGE ClpSolve_doSingletonColumn(Clp_Solve *);
     483     COINLIBAPI void COINLINKAGE ClpSolve_setDoSingletonColumn(Clp_Solve *, int doSingleton);
     484
     485     COINLIBAPI int COINLINKAGE ClpSolve_presolveActions(Clp_Solve *);
     486     COINLIBAPI void COINLINKAGE ClpSolve_setPresolveActions(Clp_Solve *, int action);
     487
     488     COINLIBAPI int COINLINKAGE ClpSolve_substitution(Clp_Solve *);
     489     COINLIBAPI void COINLINKAGE ClpSolve_setSubstitution(Clp_Solve *, int value);
     490
     491     /*@}*/
    403492#ifdef __cplusplus
    404493}
Note: See TracChangeset for help on using the changeset viewer.