asyncfix01.gms : Test asynchronous solves with holdFixed

Description

This test ensures that asynchronous solves with holdFixed=1 do not
create inconsistent solutions.

Contributor: Michael Bussieck, June 2021


Small Model of Type : GAMS


Category : GAMS Test library


Main file : asyncfix01.gms

$title Test asynchronous solves with holdFixed (ASYNCFIX01,SEQ=863)

$onText
This test ensures that asynchronous solves with holdFixed=1 do not
create inconsistent solutions.

Contributor: Michael Bussieck, June 2021
$offText

Set
   alloy 'products on the market' / a*i /
   elem  'required elements'      / lead, zinc, tin /;

Table compdat(*,alloy) 'composition data (pct and price)'
            a    b    c    d    e    f    g    h    i
   lead    10   10   40   60   30   30   30   50   20
   zinc    10   30   50   30   30   40   20   40   30
   tin     80   60   10   10   40   30   50   10   50
   price  4.1  4.3  5.8  6.0  7.6  7.5  7.3  6.9  7.3;

Parameter
   rb(elem)  'required blend' / lead 30, zinc 30, tin 40 /
   ce(alloy) 'composition error (pct-100)';

ce(alloy) = sum(elem, compdat(elem,alloy)) - 100;
display ce;

Variable
   v(alloy) 'purchase of alloy (pounds)'
   phi      'total cost';

Positive Variable v;

Equation
   pc(elem) 'purchase constraint'
   mb       'material balance'
   ac       'accounting: total cost';

pc(elem).. sum(alloy, compdat(elem,alloy)*v(alloy)) =e= rb(elem);

mb..       sum(alloy, v(alloy)) =e= 1;

ac..       phi =e= sum(alloy, compdat("price",alloy)*v(alloy));

Model
   b1 'problem without mb' / pc,     ac /
   b2 'problem with mb'    / pc, mb, ac /;

v.fx('c') = 0.1;
b2.holdfixed = 1;

Parameter h(alloy);

b2.solvelink = %solveLink.AsyncGrid%;

solve b2 minimizing phi using lp;
h('a') = b2.handle;
display$ReadyCollect(h) 'waiting';
v.fx('c') = 10000;
option AsyncSolLst=1;
display$handlecollect(b2.handle) 'collecting';
abort$(abs(1-sum(alloy, v.l(alloy)))>1e-5) 'bad point';
display$handledelete(b2.handle) 'collecting';


v.fx('c') = 0.1;
b2.solvelink = %solveLink.AsyncThreads%;

solve b2 minimizing phi using lp;
h('a') = b2.handle;
display$ReadyCollect(h) 'waiting';
v.fx('c') = 10000;
option AsyncSolLst=1;
display$handlecollect(b2.handle) 'collecting';
abort$(abs(1-sum(alloy, v.l(alloy)))>1e-5) 'bad point';
display$handledelete(b2.handle) 'collecting';